:root {
  --wine: #7b1e3b;
  --wine-2: #a63a54;
  --ink: #2b2b2b;
  --muted: #6b6b6b;
  --bg: #faf7f8;
  --card: #ffffff;
  --line: #e7d9de;
  --ok: #2e7d52;
}
* { box-sizing: border-box; }
/* The [hidden] attribute must always win over element display rules (e.g. .filters{display:grid}). */
[hidden] { display: none !important; }
body { margin: 0; font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; color: var(--ink); background: var(--bg); }

.skip-link { position: absolute; left: -999px; top: 0; background: var(--wine); color: #fff; padding: .5rem .75rem; }
.skip-link:focus { left: .5rem; z-index: 10; }

.site-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem 1.25rem; background: var(--wine); color: #fff; }
.brand { display: flex; align-items: center; gap: .75rem; }
.brand-mark { font-size: 1.8rem; }
.site-header h1, .brand-title { margin: 0; font-size: 1.4rem; font-weight: 800; color: inherit; line-height: 1.1; }
.tagline { margin: 0; font-size: .85rem; opacity: .9; }
.lang-switch { display: flex; gap: .25rem; }
.lang-btn { border: 1px solid rgba(255,255,255,.6); background: transparent; color: #fff;
  padding: .35rem .6rem; border-radius: 6px; cursor: pointer; font-weight: 600; }
.lang-btn[aria-pressed="true"] { background: #fff; color: var(--wine); }

.header-right { display: flex; align-items: center; gap: 1rem; }
/* Notification bell + dropdown */
.notif-wrap { position: relative; }
.notif-bell { position: relative; background: transparent; border: 1px solid rgba(255,255,255,.6); color: #fff;
  width: 38px; height: 38px; border-radius: 8px; cursor: pointer; font-size: 1.1rem; line-height: 1; }
.notif-bell:hover { background: rgba(255,255,255,.12); }
.notif-badge { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 4px;
  background: #e0483f; color: #fff; border-radius: 999px; font-size: .7rem; font-weight: 800; display: grid; place-items: center; }
.notif-panel { position: absolute; top: calc(100% + .5rem); right: 0; width: 340px; max-width: 90vw; z-index: 60;
  background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,.22); overflow: hidden; }
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: .7rem .9rem; border-bottom: 1px solid var(--line); }
.notif-head b { color: var(--wine); }
.notif-list { max-height: 60vh; overflow-y: auto; }
.notif-empty { margin: 0; padding: 1.4rem .9rem; color: var(--muted); text-align: center; font-size: .9rem; }
.notif-item { display: flex; gap: .6rem; width: 100%; text-align: left; background: transparent; border: 0;
  border-bottom: 1px solid #f0e6ea; padding: .7rem .9rem; cursor: pointer; align-items: flex-start; }
.notif-item:hover { background: #faf3f5; }
.notif-item.unread { background: #fbf1f4; }
.notif-item.unread:hover { background: #f7e8ed; }
.notif-icon { font-size: 1.1rem; line-height: 1.2; }
.notif-body { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.notif-text { color: var(--ink); font-size: .9rem; line-height: 1.35; }
.notif-time { color: var(--muted); font-size: .75rem; }

.account { display: flex; align-items: center; }
.account-name { color: #fff; font-size: .9rem; margin-right: .4rem; }
.account-btn { border: 1px solid rgba(255,255,255,.6); background: transparent; color: #fff;
  padding: .35rem .7rem; border-radius: 6px; cursor: pointer; font-weight: 600; }
.account-btn:hover { background: rgba(255,255,255,.12); }

.auth-dialog { border: none; border-radius: 14px; padding: 1.5rem; max-width: 420px; width: 92%;
  box-shadow: 0 10px 40px rgba(0,0,0,.25); color: var(--ink); }
.auth-dialog::backdrop { background: rgba(0,0,0,.45); }
.auth-close-form { text-align: right; margin: -.6rem -.6rem 0 0; }
.auth-close { border: none; background: transparent; font-size: 1.1rem; cursor: pointer; color: var(--muted); }
.auth-tabs { display: flex; gap: .5rem; margin-bottom: .5rem; }
.auth-tab { flex: 1; padding: .5rem; border: 1px solid var(--line); background: #fff; border-radius: 8px;
  cursor: pointer; font-weight: 600; color: var(--muted); }
.auth-tab[aria-selected="true"] { background: var(--wine); color: #fff; border-color: var(--wine); }
.auth-heading { margin: .4rem 0 .8rem; color: var(--wine); font-size: 1.2rem; }
.auth-error { background: #fde8ec; color: #a1223a; padding: .5rem .7rem; border-radius: 8px; font-size: .9rem; margin: 0 0 .6rem; }
.auth-form { display: flex; flex-direction: column; gap: .3rem; }
.auth-form > label { font-size: .82rem; font-weight: 600; color: var(--muted); margin-top: .35rem; }
.auth-form input[type=email], .auth-form input[type=password], .auth-form input[type=text], .auth-form select {
  padding: .5rem; border: 1px solid var(--line); border-radius: 8px; font-size: 1rem; min-height: 42px; }
.auth-form input:focus, .auth-form select:focus { outline: 3px solid var(--wine-2); outline-offset: 1px; }
.auth-form .check { display: flex; align-items: flex-start; gap: .5rem; font-weight: 400; color: var(--ink);
  font-size: .85rem; margin-top: .5rem; }
.auth-form .check input { margin-top: .2rem; min-height: auto; width: 18px; height: 18px; }
.auth-submit { margin-top: 1rem; background: var(--wine); color: #fff; border: none; padding: .7rem;
  border-radius: 8px; font-size: 1rem; font-weight: 700; cursor: pointer; }
.auth-submit:hover { background: var(--wine-2); }

.tabs { display: flex; gap: .25rem; padding: .5rem 1.25rem 0; background: var(--wine);
  border-bottom: 3px solid var(--wine-2); }
.tab { border: none; background: transparent; color: #f3dfe5; cursor: pointer;
  padding: .6rem 1rem; font-size: 1rem; font-weight: 600; border-radius: 8px 8px 0 0; }
.tab[aria-selected="true"] { background: var(--bg); color: var(--wine); }
.tab:focus-visible { outline: 3px solid #fff; outline-offset: -3px; }

main { max-width: 1100px; margin: 0 auto; padding: 1.25rem; }

.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.field { display: flex; flex-direction: column; gap: .25rem; }
.field label { font-size: .8rem; font-weight: 600; color: var(--muted); }
.field input, .field select { padding: .5rem; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; font-size: 1rem; min-height: 42px; }
.field input:focus, .field select:focus { outline: 3px solid var(--wine-2); outline-offset: 1px; }

.result-count { color: var(--muted); font-size: .9rem; margin: .25rem 0 1rem; }

.card-grid { list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
/* Admin renders block panels (sub-nav + form + user list) into #results — opt out of the grid. */
.card-grid.admin-view { display: block; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 1rem; }
.badge { display: inline-block; font-size: .75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .03em; color: var(--wine); background: #f3e7ea; padding: .15rem .5rem; border-radius: 999px; }
.match-badge { margin-top: .5rem; background: linear-gradient(135deg, #7b1e3b, #b8324f); color: #fff; }

/* Wishlist "where to buy" + cellar drink-by */
.wl-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .6rem; }
.wl-actions .pill { text-decoration: none; }
.drink-by-row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin: .5rem 0; }
.drink-by-set { font-size: .82rem; color: var(--muted); display: inline-flex; align-items: center; gap: .35rem; }
.drink-by-input { width: 74px; padding: .25rem .4rem; border: 1px solid #ccc; border-radius: 6px; font: inherit; font-size: .85rem; }
.badge.drink-soon { background: #f6e2c4; color: #8a5a12; }
.badge.drink-past { background: #f3d0cd; color: #a12f27; }
.card-title { margin: .6rem 0 .1rem; font-size: 1.05rem; }
.card-sub { margin: 0; color: var(--ink); font-weight: 600; }
.card-place { margin: .35rem 0; color: var(--muted); font-size: .85rem; }
.card-accent { margin: .25rem 0 0; color: var(--wine-2); font-weight: 700; }
.card-tags { margin: .35rem 0 0; display: flex; flex-wrap: wrap; gap: .3rem; }
.tag { font-size: .72rem; padding: .1rem .45rem; border-radius: 999px; background: #eee; color: var(--muted); }
.tag.ok { background: #e4f3ea; color: var(--ok); font-weight: 600; }

.map { height: 540px; width: 100%; border: 1px solid var(--line); border-radius: 12px; }
.map-legend { display: flex; align-items: center; gap: .4rem; margin: .6rem 0 0; color: var(--muted); font-size: .85rem; }
.map-legend .dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.map-legend .dot.winery { background: var(--wine); }
.map-legend .dot.event { background: var(--ok); margin-left: .8rem; }

.wine-thumb { position: relative; display: flex; align-items: center; justify-content: center; height: 96px;
  background: linear-gradient(180deg, #faf3f5, #ffffff); border: 1px solid var(--line);
  border-radius: 8px; margin-bottom: .5rem; overflow: hidden; }
.wine-thumb .bottle { height: 88px; width: auto; }
.wine-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
  background: #fff; }

/* Large card image (wine card hero) */
.wine-hero { position: relative; display: flex; align-items: center; justify-content: center; height: 240px;
  background: linear-gradient(180deg, #faf3f5, #f3e7ea); border: 1px solid var(--line);
  border-radius: 10px; margin-bottom: .7rem; overflow: hidden; }
.wine-hero-bottle { display: flex; align-items: center; justify-content: center; height: 100%; }
.wine-hero-bottle .bottle { height: 200px; width: auto; }
.wine-hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
  background: #fff; padding: .6rem; }
.wine-hero-badge { position: absolute; top: .6rem; left: .6rem; z-index: 1; }
.wine-winery { display: flex; align-items: center; gap: .5rem; margin-bottom: .35rem; }
.wine-winery .winery-logo { width: 28px; height: 28px; border-radius: 6px; }
.wine-winery-name { font-size: .84rem; font-weight: 700; color: var(--wine); overflow-wrap: anywhere; }
.winery-wine-grid .wine-hero { height: 170px; }
.winery-wine-grid .wine-hero-bottle .bottle { height: 140px; }

/* Event card hero banner + detail */
.event-hero { position: relative; display: flex; align-items: center; justify-content: center; height: 120px;
  border-radius: 10px; margin-bottom: .7rem; overflow: hidden;
  background: linear-gradient(135deg, #7b1e3b, #a63a54); }
.event-hero[data-type="tasting"] { background: linear-gradient(135deg, #7b1e3b, #b5566e); }
.event-hero[data-type="festival"] { background: linear-gradient(135deg, #a63a54, #d98a3a); }
.event-hero[data-type="harvest"] { background: linear-gradient(135deg, #6e3a24, #c68a3a); }
.event-hero[data-type="education"], .event-hero[data-type="masterclass"] { background: linear-gradient(135deg, #4a2c40, #7b1e3b); }
.event-emoji { font-size: 3rem; filter: drop-shadow(0 2px 4px rgba(0,0,0,.25)); }
.event-hero-badge { position: absolute; top: .6rem; left: .6rem; background: rgba(255,255,255,.9); }
.event-detail-hero { display: flex; align-items: center; justify-content: center; height: 140px; border-radius: 12px;
  margin-bottom: .8rem; background: linear-gradient(135deg, #7b1e3b, #a63a54); }
.event-emoji-lg { font-size: 4.5rem; filter: drop-shadow(0 2px 6px rgba(0,0,0,.3)); }
.detail-meta { margin: .4rem 0 .8rem; }
.detail-meta p { margin: .2rem 0; }
.detail-h { margin: .8rem 0 .3rem; color: var(--wine); font-size: 1rem; }
.detail-links { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; }
.detail-links a.pill { text-decoration: none; display: inline-flex; align-items: center; }

/* Event RSVP + add-to-calendar */
.rsvp-block { margin: 1rem 0 .4rem; }
.rsvp-title { margin: 0 0 .4rem; font-weight: 700; color: var(--ink); }
.rsvp-row { display: flex; gap: .6rem; flex-wrap: wrap; }
.rsvp-btn { cursor: pointer; }
.rsvp-btn.on { background: var(--wine); color: #fff; }
.rsvp-btn.on .rsvp-count { color: #fff; }
.rsvp-count { opacity: .8; font-weight: 600; }
.cal-block { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin: .3rem 0 .2rem; }
.cal-label { color: var(--muted); font-size: .85rem; font-weight: 600; }
.pill.subtle { border-color: var(--line); color: var(--wine-2); text-decoration: none; font-size: .85rem; padding: .3rem .7rem; }
.pill.subtle:hover { background: #faf3f5; }

.winery-wine-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; margin-top: .3rem; }
.winery-wine-grid .card { padding: .6rem; }
.winery-wine-grid .wine-thumb { height: 76px; margin-bottom: .35rem; }
.winery-wine-grid .wine-thumb .bottle { height: 68px; }
.winery-wine-grid .card-title { font-size: .92rem; margin: .3rem 0 .1rem; }
.winery-wine-grid .card-sub, .winery-wine-grid .card-place { font-size: .78rem; }

.card.clickable { cursor: pointer; }
.card.clickable:hover { border-color: var(--wine-2); box-shadow: 0 2px 10px rgba(123,30,59,.10); }
.empty { list-style: none; color: var(--muted); padding: 2rem; text-align: center; grid-column: 1 / -1; }

.detail-dialog { border: none; border-radius: 14px; padding: 1.5rem; max-width: 520px; width: 94%;
  max-height: 88vh; overflow: auto; box-shadow: 0 10px 40px rgba(0,0,0,.25); color: var(--ink); }
.detail-dialog::backdrop { background: rgba(0,0,0,.45); }
.detail-dialog h2 { margin: .5rem 0 .1rem; color: var(--wine); }
.detail-sub { margin: 0; font-weight: 600; }
.detail-meta { margin: .3rem 0; color: var(--muted); font-size: .88rem; }
.detail-h { margin: 1.1rem 0 .3rem; color: var(--wine); font-size: 1rem; }
.detail-summary { color: var(--wine-2); font-weight: 700; margin: .2rem 0 .5rem; }
.detail-actions { display: flex; gap: .6rem; align-items: center; margin: .9rem 0; flex-wrap: wrap; }
.cellar-add { display: flex; gap: .3rem; align-items: center; }
.cellar-add input { width: 58px; padding: .4rem; border: 1px solid var(--line); border-radius: 6px; font-size: 1rem; }

.pill { border: 1px solid var(--wine); background: #fff; color: var(--wine); padding: .4rem .8rem;
  border-radius: 999px; cursor: pointer; font-weight: 600; font-size: .9rem; }
.pill:hover { background: #f3e7ea; }
.pill.primary { background: var(--wine); color: #fff; }
.pill.primary:hover { background: var(--wine-2); }
.pill:disabled { opacity: .5; cursor: not-allowed; }
.pill.remove { border-color: var(--line); color: var(--muted); margin-top: .6rem; }

.rev-list { list-style: none; padding: 0; margin: .3rem 0; display: flex; flex-direction: column; gap: .6rem; }
.rev { border: 1px solid var(--line); border-radius: 8px; padding: .5rem .7rem; }
.rev-head { display: flex; justify-content: space-between; align-items: baseline; }
.rev-rating { color: var(--wine-2); font-weight: 700; }
.rev p { margin: .3rem 0 0; font-size: .9rem; }
.rev-tags { color: var(--muted); font-size: .8rem; }
.rev-form { display: flex; flex-direction: column; gap: .4rem; }
.rev-form label { font-size: .85rem; font-weight: 600; color: var(--muted); display: flex; flex-direction: column; gap: .25rem; }
.rev-form select, .rev-form textarea { padding: .5rem; border: 1px solid var(--line); border-radius: 8px; font-size: 1rem; font-family: inherit; }

.feed-toggle { list-style: none; grid-column: 1 / -1; display: flex; gap: .5rem; margin-bottom: .3rem; }
.feed-item .feed-head { display: flex; justify-content: space-between; align-items: baseline; }
.feed-wine { margin: .3rem 0; font-weight: 700; color: var(--wine); }
.feed-note { margin: .2rem 0 .6rem; font-size: .9rem; }
.feed-actions { display: flex; gap: .5rem; }
.pill.like, .pill.follow { padding: .3rem .7rem; font-size: .85rem; }
.pill.like.on { background: #f3e7ea; }
.pill.follow.on { background: var(--wine); color: #fff; }

.winery-card-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .1rem; }
.winery-card-head .card-title { margin: 0; }
.winery-logo-wrap { display: inline-flex; }
.winery-logo { width: 40px; height: 40px; border-radius: 8px; object-fit: contain; background: #fff;
  border: 1px solid var(--line); flex-shrink: 0; }
.winery-logo.mono { display: flex; align-items: center; justify-content: center; background: var(--wine);
  color: #fff; font-weight: 700; font-size: .95rem; border: none; }
.winery-detail-head { display: flex; align-items: center; gap: .8rem; margin-bottom: .3rem; }
.winery-detail-head .winery-logo { width: 52px; height: 52px; }
.winery-detail-head h2 { margin: 0; }

.winery-story { margin: .5rem 0 .8rem; font-size: .92rem; line-height: 1.45; }
.winery-wines { list-style: none; padding: 0; margin: .3rem 0; display: flex; flex-direction: column; gap: .3rem; }
.winery-wine { border: 1px solid var(--line); border-radius: 8px; padding: .4rem .6rem; cursor: pointer; }
.winery-wine:hover { border-color: var(--wine-2); background: #faf3f5; }
.winery-wine .muted { color: var(--muted); font-size: .85rem; }
.winery-link { color: var(--wine); font-weight: 600; }

.admin-row-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.admin-actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-top: .5rem; }
.admin-note { color: var(--ok); font-size: .82rem; font-weight: 600; }
.admin-images { margin-top: .6rem; display: flex; flex-direction: column; gap: .5rem; }
.admin-wine-img label { font-size: .82rem; font-weight: 600; color: var(--muted); display: block; margin-bottom: .2rem; }
.admin-img-row { display: flex; gap: .4rem; }
.admin-img-input { flex: 1; padding: .4rem; border: 1px solid var(--line); border-radius: 6px; font-size: .9rem; }
.admin-img-save { white-space: nowrap; }

.hero { display: flex; align-items: center; gap: 1rem; background: linear-gradient(135deg, var(--wine), var(--wine-2));
  color: #fff; padding: 1.4rem 1.5rem; border-radius: 14px; margin-bottom: 1.2rem; }
.hero-mark { font-size: 2.4rem; }
.hero h2 { margin: 0; font-size: 1.6rem; }
.hero p { margin: .2rem 0 0; opacity: .92; }

/* Big wide homepage banner (admin-editable) */
.home-hero { display: flex; align-items: flex-end; min-height: 260px; border-radius: 16px; margin-bottom: 1.4rem;
  color: #fff; padding: 2rem 2.2rem; overflow: hidden;
  background: linear-gradient(135deg, var(--wine), var(--wine-2)); background-size: cover; background-position: center; }
/* With an uploaded banner, present the admin's 1600×1200 (4:3) composition without cropping; the title
   sits at the bottom (align-items:flex-end above). max-height guards against an over-tall hero on wide layouts. */
.home-hero.has-image { aspect-ratio: 1600 / 1200; min-height: 0; max-height: 78vh; }
.home-hero-inner { max-width: 640px; width: 100%; }
.home-hero h2 { margin: 0 0 .5rem; font-size: 2.2rem; line-height: 1.15; text-shadow: 0 2px 8px rgba(0,0,0,.35); }
.home-hero p { margin: 0; font-size: 1.05rem; line-height: 1.5; opacity: .96; text-shadow: 0 1px 4px rgba(0,0,0,.35); }
@media (max-width: 680px) { .home-hero { min-height: 200px; padding: 1.4rem; } .home-hero h2 { font-size: 1.6rem; } }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; margin-bottom: 1.4rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 1rem; text-align: center;
  font: inherit; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .05s; }
.stat:hover { border-color: var(--wine-2); box-shadow: 0 2px 10px rgba(123,30,59,.10); }
.stat:active { transform: translateY(1px); }
.stat b { display: block; font-size: 1.6rem; color: var(--wine); }
.stat span { color: var(--muted); font-size: .85rem; }
.home-section { margin-bottom: 1.6rem; }
.home-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin: 0 0 .6rem; }
.home-link { color: var(--wine); margin: 0; font-size: 1.1rem; cursor: pointer; }
.home-link:hover { text-decoration: underline; }
.home-viewall { background: none; border: none; color: var(--wine-2); font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; padding: .2rem .3rem; white-space: nowrap; }
.home-viewall:hover { text-decoration: underline; }
.home-section h3 { color: var(--wine); margin: 0 0 .6rem; font-size: 1.1rem; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: .4rem .85rem; cursor: pointer;
  font-weight: 600; color: var(--ink); font-size: .9rem; }
.chip:hover { border-color: var(--wine-2); background: #faf3f5; }
.chip-count { color: var(--muted); font-weight: 400; font-size: .8rem; }
.home-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.home-reviews { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .8rem; }
.home-reviews li { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: .8rem; cursor: pointer; }
.home-reviews .feed-wine { color: var(--wine); font-weight: 700; margin: .3rem 0; }
.home-reviews .feed-note { font-size: .88rem; margin: .2rem 0 0; }
@media (max-width: 680px) { .stat-row { grid-template-columns: repeat(2, 1fr); } }

.site-footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 1.5rem; }

@media (max-width: 680px) { .filters { grid-template-columns: 1fr 1fr; } }

/* --- Admin: sub-nav + user management --- */
.account-btn.subtle { border-color: rgba(255,255,255,.35); opacity: .9; font-size: .82rem; }

/* Segmented sub-nav (Content | Users) */
.admin-subnav { display: inline-flex; gap: .25rem; margin: 0 0 1.2rem; padding: .25rem; background: #f1e9ec; border-radius: 10px; }
.admin-subtab { border: none; background: transparent; color: var(--wine); font: inherit; font-weight: 600;
  padding: .45rem 1.1rem; border-radius: 8px; cursor: pointer; }
.admin-subtab:hover { background: rgba(255,255,255,.6); }
.admin-subtab.active { background: #fff; color: var(--wine); box-shadow: 0 1px 4px rgba(123,30,59,.15); }
.admin-hint { color: var(--muted); font-size: .9rem; margin: 0 0 1rem; }

/* Add-user card */
.admin-adduser { padding: 1.2rem 1.3rem; margin-bottom: 1.6rem; }
.admin-adduser h3 { margin: 0 0 1rem; font-size: 1.05rem; color: var(--wine); }
.adduser-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem 1rem; }
.fld { display: flex; flex-direction: column; gap: .3rem; font-size: .82rem; color: var(--muted); }
.fld input, .fld select { padding: .55rem .65rem; border: 1px solid var(--line); border-radius: 8px; font: inherit; color: var(--ink); background: #fff; }
.fld input:focus, .fld select:focus { outline: 2px solid var(--wine-2); outline-offset: 1px; border-color: var(--wine-2); }
.adduser-foot { display: flex; align-items: center; justify-content: flex-end; gap: 1rem; margin-top: 1rem; }
.adduser-foot .admin-error { margin: 0; margin-right: auto; }
.admin-error { color: var(--wine); font-size: .85rem; }

/* User list */
.user-list-title { font-size: 1rem; color: var(--wine); margin: 0 0 .7rem; display: flex; align-items: center; gap: .5rem; }
.count-badge { background: #f1e9ec; color: var(--wine); font-size: .78rem; font-weight: 700; border-radius: 999px; padding: .05rem .5rem; }
.user-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.user-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .9rem;
  padding: .7rem .9rem; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.user-row.suspended { background: #faf4f4; border-color: #e9d9d9; }
.user-avatar { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  background: var(--wine); color: #fff; font-weight: 700; font-size: .9rem; flex: none; }
.user-row.suspended .user-avatar { background: var(--muted); }
.user-main { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.user-main b { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; }
.you-tag { background: #f1e9ec; color: var(--wine); }
.tag.off { background: #f4e0e0; color: var(--wine); font-weight: 600; }
.user-status { font-size: .68rem; }
.user-email { color: var(--muted); font-size: .82rem; overflow-wrap: break-word; min-width: 0; }
.user-controls { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; }
.user-role { padding: .4rem .55rem; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; cursor: pointer; }
.user-role:disabled { background: #f5f2f3; cursor: not-allowed; }
.pill.subtle-pill { border-color: var(--line); color: var(--muted); }
.pill.subtle-pill:hover { background: #f5f2f3; }
@media (max-width: 720px) {
  .adduser-fields { grid-template-columns: 1fr; }
  .user-row { grid-template-columns: auto 1fr; }
  .user-controls { grid-column: 1 / -1; justify-content: flex-start; }
}

/* Map popup with a "View details" action */
.map-popup b { color: var(--wine); }
.map-popup-meta { color: var(--muted); font-size: .85rem; }
.map-popup-btn { margin-top: .5rem; }

/* --- Admin content CMS (tabs + table + preview) --- */
.cms-tabs { display: inline-flex; gap: .25rem; margin: 0 0 1.1rem; padding: .25rem; background: #f1e9ec; border-radius: 10px; flex-wrap: wrap; }
.cms-tab { border: none; background: transparent; color: var(--wine); font: inherit; font-weight: 600; padding: .4rem .9rem; border-radius: 8px; cursor: pointer; }
.cms-tab:hover { background: rgba(255,255,255,.6); }
.cms-tab.active { background: #fff; box-shadow: 0 1px 4px rgba(123,30,59,.15); }
.cms-split { display: grid; grid-template-columns: 1.3fr 1fr; gap: 1.2rem; align-items: start; }
.cms-table-wrap { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--card); }
.cms-filter { width: 100%; border: none; border-bottom: 1px solid var(--line); padding: .6rem .8rem; font: inherit; }
.cms-filter:focus { outline: 2px solid var(--wine-2); outline-offset: -2px; }
.cms-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.cms-table th { text-align: left; padding: .5rem .8rem; color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .03em; border-bottom: 1px solid var(--line); }
.cms-table td { padding: .55rem .8rem; border-bottom: 1px solid #f2ebed; }
.cms-table tbody tr { cursor: pointer; }
.cms-table tbody tr:hover { background: #faf3f5; }
.cms-table tbody tr.sel { background: #f3e2e8; }
.cms-table tbody tr:focus-visible { outline: 2px solid var(--wine-2); outline-offset: -2px; }
.cms-preview { position: sticky; top: 1rem; border: 1px solid var(--line); border-radius: 12px; background: var(--card); padding: 1rem; }
.cms-preview > h4 { margin: 0 0 .7rem; color: var(--wine); font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; }
.cms-preview-body b { font-size: 1.05rem; }
.cms-hint { color: var(--muted); font-size: .9rem; }
.cms-pv-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .5rem; }
.cms-pv-link { font-size: .85rem; word-break: break-all; }
.cms-pv-actions { display: flex; gap: .5rem; margin: .6rem 0; }
.cms-sub { margin: .9rem 0 .5rem; color: var(--wine); font-size: .9rem; }
.cms-editor { padding: 1.2rem; display: flex; flex-direction: column; gap: .7rem; }
.cms-editor h3 { margin: 0 0 .3rem; color: var(--wine); font-size: 1.05rem; }
.cms-editor textarea { padding: .55rem .65rem; border: 1px solid var(--line); border-radius: 8px; font: inherit; resize: vertical; }
.cms-editor input:focus, .cms-editor textarea:focus { outline: 2px solid var(--wine-2); outline-offset: 1px; }
.cms-editor-foot { display: flex; align-items: center; gap: .8rem; margin-top: .3rem; }
.cms-saved { color: var(--ok); font-weight: 700; font-size: .85rem; }
.cms-preview-body .wine-hero { height: 180px; }
.cms-preview-body .event-detail-hero { height: 110px; }
.cms-preview-body .event-emoji-lg { font-size: 3rem; }
@media (max-width: 820px) { .cms-split { grid-template-columns: 1fr; } .cms-preview { position: static; } }

.cms-winery-form { display: flex; flex-direction: column; gap: .5rem; margin-bottom: .5rem; }
.cms-winery-form input, .cms-winery-form textarea { padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 8px; font: inherit; resize: vertical; width: 100%; }
.cms-winery-form input:focus, .cms-winery-form textarea:focus { outline: 2px solid var(--wine-2); outline-offset: 1px; }
a.winery-shop { text-decoration: none; display: inline-flex; align-items: center; }

.cms-import { display: flex; align-items: center; gap: .6rem; margin: .3rem 0 .2rem; flex-wrap: wrap; }
.cms-import-msg { font-size: .82rem; color: var(--muted); }

.cms-toolbar { display: flex; align-items: center; gap: .8rem; margin: 0 0 1rem; flex-wrap: wrap; }

.cms-c7 { margin: .5rem 0; border: 1px solid var(--line); border-radius: 8px; padding: .5rem .7rem; }
.cms-c7 summary { cursor: pointer; font-weight: 600; color: var(--wine); font-size: .88rem; }
.cms-c7 .cms-winery-form { margin-top: .6rem; }

/* Wine detail: large image + clickable winery row */
.detail-dialog .wine-hero { height: 300px; }
.wine-winery.detail-winery { border: none; background: none; padding: 0; cursor: pointer; margin: .1rem 0 .4rem; }
.wine-winery.detail-winery:hover .wine-winery-name { text-decoration: underline; }
.wine-winery.detail-winery .winery-logo { width: 32px; height: 32px; }
.wine-winery.detail-winery .wine-winery-name { font-size: .95rem; }

/* Homepage banner text (below the banner) + read-more */
.home-hero { margin-bottom: .8rem; }
.home-hero-text { margin: 0 0 1.6rem; }
.home-hero-body { margin: 0; font-size: 1rem; line-height: 1.6; color: var(--ink); white-space: pre-wrap; }
.hero-read-more { margin-top: .4rem; background: none; border: none; color: var(--wine); font: inherit; font-weight: 700; cursor: pointer; padding: 0; }
.hero-read-more:hover { text-decoration: underline; }

/* CMS: media upload + library */
.media-pick { display: flex; align-items: center; gap: .6rem; margin: .2rem 0 .4rem; flex-wrap: wrap; }
.media-upload-btn { cursor: pointer; }
.media-lib { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: .5rem; margin-top: .3rem; }
.media-thumb { position: relative; margin: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; aspect-ratio: 1; background: #faf3f5; }
.media-thumb img { width: 100%; height: 100%; object-fit: cover; cursor: pointer; display: block; }
.media-del { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border: none; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff; font-size: .7rem; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.media-del:hover { background: var(--wine); }

/* --- "What's New" blog --- */
.post-card { padding: 0; overflow: hidden; }
.post-banner { height: 150px; background-size: cover; background-position: center; }
.post-banner-plain { display: grid; place-items: center; background: linear-gradient(135deg, var(--wine), var(--wine-2)); font-size: 2.4rem; }
.post-card-body { padding: .9rem 1rem 1.1rem; }
.post-meta { color: var(--muted); font-size: .8rem; margin: .1rem 0 .5rem; }
.post-excerpt { color: var(--ink); font-size: .9rem; line-height: 1.5; margin: 0; }

/* Latest post on the home page (below the banner text) */
.latest-post { display: grid; grid-template-columns: 220px 1fr; gap: 1rem; align-items: stretch; background: var(--card);
  border: 1px solid var(--line); border-radius: 14px; overflow: hidden; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.latest-post:hover { border-color: var(--wine-2); box-shadow: 0 2px 12px rgba(123,30,59,.12); }
.latest-post-banner { background-size: cover; background-position: center; min-height: 150px; }
.latest-post-text { padding: 1rem 1.1rem; }
.latest-post-text h4 { margin: 0 0 .2rem; font-size: 1.15rem; color: var(--wine); }
.post-more { display: inline-block; margin-top: .5rem; color: var(--wine); font-weight: 700; font-size: .9rem; }
@media (max-width: 600px) { .latest-post { grid-template-columns: 1fr; } }

/* Post cards are real links (crawlable + open-in-new-tab), SPA-intercepted on plain click. */
.post-link { display: block; color: inherit; text-decoration: none; height: 100%; }
.post-card { transition: border-color .15s, box-shadow .15s; }
.post-card:hover { border-color: var(--wine-2); box-shadow: 0 3px 14px rgba(123,30,59,.12); }
.post-card .card-title { padding: 0; margin: 0 0 .1rem; }

/* Featured (newest) post spans the grid full-width with a side-by-side layout. */
.post-featured { grid-column: 1 / -1; padding: 0; }
.featured-link { display: grid; grid-template-columns: 1.15fr 1fr; }
.post-featured-banner { min-height: 260px; background-size: cover; background-position: center; }
.post-featured-body { padding: 1.6rem 1.8rem; display: flex; flex-direction: column; justify-content: center; }
.post-badge { align-self: flex-start; font-size: .7rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  color: #fff; background: var(--wine); padding: .2rem .6rem; border-radius: 999px; margin-bottom: .6rem; }
.post-featured-title { margin: 0 0 .3rem; font-size: 1.7rem; line-height: 1.2; color: var(--wine); }
@media (max-width: 700px) { .featured-link { grid-template-columns: 1fr; } .post-featured-banner { min-height: 180px; } }

/* Article (reader) page */
.card-grid.article-view { display: block; }
.article-li { list-style: none; }
.post-article { max-width: 760px; margin: 0 auto; }
.back-link { display: inline-block; color: var(--wine-2); font-weight: 600; text-decoration: none; margin: .2rem 0 1rem; }
.back-link:hover { text-decoration: underline; }
.post-article-banner { width: 100%; aspect-ratio: 16 / 9; background-size: cover; background-position: center;
  border-radius: 16px; margin-bottom: 1.4rem; }
.post-article-title { font-size: clamp(1.8rem, 4vw, 2.6rem); line-height: 1.15; color: var(--wine); margin: 0 0 .5rem; }
.post-article-meta { font-size: .9rem; margin-bottom: 1rem; }
.post-article .md-content { font-size: 1.12rem; line-height: 1.75; }
.post-article .md-content p { margin: 1rem 0; }
.post-article .md-content img { max-width: 100%; border-radius: 10px; }

/* Share row */
.share-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: 1rem 0; padding: .6rem 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.share-btn { font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; text-decoration: none;
  border: 1px solid #ddc9d0; border-radius: 999px; padding: .35rem .8rem; color: var(--wine); background: #fff; }
.share-btn:hover { background: #faf3f5; border-color: var(--wine-2); }
.share-copy { background: var(--wine); color: #fff; border-color: var(--wine); }

/* Prev/next + more posts */
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 2rem 0 1rem; }
.post-nav-link { display: flex; flex-direction: column; gap: .2rem; padding: .8rem 1rem; border: 1px solid var(--line);
  border-radius: 12px; text-decoration: none; color: var(--ink); background: var(--card); transition: border-color .15s; }
.post-nav-link:hover { border-color: var(--wine-2); }
.post-nav-link.next { text-align: right; }
.post-nav-dir { font-size: .78rem; color: var(--muted); font-weight: 600; }
.post-nav-title { color: var(--wine); font-weight: 600; font-size: .95rem; }
.post-more-section { margin-top: 2rem; }
.post-more-section h3 { color: var(--wine); margin: 0 0 .8rem; }
.post-more-grid { margin: 0; }
@media (max-width: 600px) { .post-nav { grid-template-columns: 1fr; } .post-nav-link.next { text-align: left; } }

/* Post detail modal */
.post-dialog { max-width: 720px; }
.post-detail-banner { height: 240px; background-size: cover; background-position: center; border-radius: 12px; margin-bottom: .9rem; }

/* Rendered Markdown content */
.md-content { line-height: 1.65; color: var(--ink); }
.md-content h3 { color: var(--wine); font-size: 1.2rem; margin: 1.1rem 0 .4rem; }
.md-content h4 { color: var(--wine); font-size: 1.02rem; margin: 1rem 0 .3rem; }
.md-content p { margin: .6rem 0; }
.md-content a { color: var(--wine-2); }
.md-content ul { margin: .5rem 0; padding-left: 1.3rem; }
.md-content li { margin: .2rem 0; }
.md-content blockquote { margin: .7rem 0; padding: .3rem .9rem; border-left: 3px solid var(--wine-2); color: var(--muted); }
.md-img { max-width: 100%; height: auto; border-radius: 10px; margin: .6rem 0; display: block; }

/* CMS blog list + editor */
.blog-admin-list { list-style: none; margin: 0; padding: .3rem; display: flex; flex-direction: column; gap: .3rem; }
.blog-admin-row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .55rem .7rem;
  border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.blog-admin-row:hover { background: #faf3f5; }
.blog-admin-row.sel { background: #f3e2e8; border-color: var(--wine-2); }
.bp-check { display: flex; align-items: center; gap: .5rem; font-size: .9rem; margin: .2rem 0; }
.bp-check input { width: 18px; height: 18px; }
#bp-preview-banner .post-detail-banner { height: 160px; }

/* Taste profile editor */
.taste-dialog { max-width: 460px; }
.taste-form h3 { margin: 0 0 .3rem; color: var(--wine); }
.taste-intro { margin: 0 0 1rem; color: var(--muted); font-size: .9rem; }
.taste-form fieldset { border: 1px solid #e6d7dc; border-radius: 10px; padding: .6rem .8rem 0.8rem; margin: 0 0 1rem; }
.taste-form legend { font-weight: 700; color: var(--ink); font-size: .9rem; padding: 0 .35rem; }
.taste-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.taste-chip { display: inline-flex; align-items: center; gap: .3rem; font-size: .85rem;
  border: 1px solid #ddc9d0; border-radius: 999px; padding: .25rem .6rem; cursor: pointer; user-select: none; }
.taste-chip:hover { background: #faf3f5; }
.taste-budget { display: block; font-size: .9rem; font-weight: 600; margin: 0 0 1rem; }
.taste-budget input { display: block; margin-top: .3rem; width: 100%; padding: .5rem; border: 1px solid #ccc; border-radius: 8px; }
.taste-actions { display: flex; justify-content: space-between; gap: .6rem; }
.taste-actions .account-btn { color: var(--wine); border-color: var(--wine-2); }
.taste-actions #taste-submit { background: var(--wine); color: #fff; }

/* Admin analytics panel */
.analytics-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.analytics-head h3 { margin: .2rem 0; color: var(--wine); }
.analytics-range { font-size: .85rem; font-weight: 600; color: var(--muted); }
.analytics-range select { margin-left: .4rem; padding: .3rem .5rem; border: 1px solid #ccc; border-radius: 8px; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; margin: 1rem 0; }
.kpi-tile { display: flex; flex-direction: column; gap: .15rem; padding: .8rem .9rem; border: 1px solid #ecdfe3;
  border-radius: 12px; background: linear-gradient(160deg, #fff, #faf3f5); }
.kpi-value { font-size: 1.6rem; font-weight: 800; color: var(--wine); line-height: 1.1; }
.kpi-label { font-size: .82rem; font-weight: 600; color: var(--ink); }
.kpi-hint { font-size: .7rem; color: var(--muted); }
.analytics-h { margin: 1.2rem 0 .4rem; color: var(--ink); }
.sparkline { display: flex; align-items: flex-end; gap: 3px; height: 90px; padding: .4rem; border: 1px solid #eee;
  border-radius: 10px; background: #fff; overflow-x: auto; }
.spark-bar { flex: 1 0 6px; min-width: 6px; background: linear-gradient(180deg, #b8324f, #7b1e3b); border-radius: 3px 3px 0 0; align-self: flex-end; }
.analytics-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.analytics-table th, .analytics-table td { text-align: left; padding: .4rem .6rem; border-bottom: 1px solid #f0e6ea; }
.analytics-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Inline text-button used for the Privacy notice links */
.link-btn { background: none; border: 0; padding: 0; color: var(--wine-2); font: inherit; cursor: pointer; text-decoration: underline; }
.link-btn:hover { color: var(--wine); }
.footer-links { margin: .3rem 0 0; }
.privacy-dialog { max-width: 560px; }
.privacy-body h3 { margin: 0 0 .2rem; color: var(--wine); }
.privacy-updated { margin: 0 0 1rem; font-size: .8rem; color: var(--muted); }
.privacy-body h4 { margin: .9rem 0 .2rem; font-size: .95rem; color: var(--ink); }
.privacy-body p { margin: 0 0 .3rem; font-size: .9rem; line-height: 1.5; }
.privacy-actions { margin-top: 1.2rem; text-align: right; }
.privacy-actions .account-btn { color: var(--wine); border-color: var(--wine-2); }
