:root {
  --ink: #16283a;
  --muted: #64717c;
  --paper: #fffdf8;
  --cream: #f4ecde;
  --red: #c74232;
  --red-dark: #a72f23;
  --green: #27725a;
  --amber: #c17a1b;
  --line: #d9dedf;
  --shadow: 0 12px 34px rgba(22, 40, 58, .09);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
.page-container { width: min(calc(100% - 40px), 1000px); margin-inline: auto; }

.site-header { height: 72px; border-bottom: 1px solid rgba(255,255,255,.15); background: var(--ink); color: white; }
.site-header-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; }
.site-header nav { display: flex; align-items: center; gap: 10px; }
.brand { color: white; text-decoration: none; font-weight: 800; font-size: 1.3rem; display: flex; align-items: center; gap: 10px; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--red); font-size: .75rem; letter-spacing: -.04em; }
.nav-link { color: #d9e1e8; text-decoration: none; font-weight: 800; font-size: .84rem; }
.nav-link:hover { color: white; }
.nav-button { color: white; background: transparent; border: 1px solid rgba(255,255,255,.5); border-radius: 999px; padding: 9px 16px; }
.nav-button:hover { background: white; color: var(--ink); }

.hero { padding: 44px 0 66px; background: var(--ink); color: white; position: relative; overflow: hidden; }
.hero::before { content: ""; position: absolute; width: 520px; height: 520px; right: -110px; top: -250px; border-radius: 50%; border: 82px solid rgba(255,255,255,.035); }
.hero::after { content: ""; position: absolute; inset: 0; opacity: .28; background-image: radial-gradient(rgba(255,255,255,.13) 1px, transparent 1px); background-size: 23px 23px; mask-image: linear-gradient(90deg, transparent 35%, #000); }
.hero-layout { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(250px, .55fr); gap: 72px; align-items: center; }
.hero-content { min-width: 0; }
.eyebrow { margin: 0 0 9px; color: var(--red); font-size: .72rem; font-weight: 800; letter-spacing: .16em; }
.hero .eyebrow { color: #f19a8f; }
h1 { max-width: 620px; margin: 0; font-family: Georgia, serif; font-size: clamp(2.2rem, 4vw, 3.55rem); line-height: 1; letter-spacing: -.04em; }
.hero h1 { white-space: nowrap; }
.hero-copy { max-width: 560px; margin: 18px 0 30px; color: #d9e1e8; font-size: clamp(.95rem, 1.5vw, 1.1rem); line-height: 1.5; }
.location-search { position: relative; z-index: 1; max-width: 690px; }
.hero h1 + .location-search { margin-top: 24px; }
.location-search > label, .toolbar label, .control-label { display: block; margin: 0 0 8px; font-size: .75rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.search-row { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; }
input, select { width: 100%; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--ink); padding: 12px 14px; }
input:focus, select:focus, button:focus-visible, a:focus-visible { outline: 3px solid #ef9b90; outline-offset: 2px; }
.primary-button, .secondary-button, .icon-button { border: 0; border-radius: 8px; padding: 12px 20px; font-weight: 800; }
.primary-button { color: white; background: var(--red); }
.primary-button:hover { background: var(--red-dark); }
.secondary-button { color: var(--ink); background: #edf0f2; }
.icon-button { min-width: 48px; background: white; color: var(--ink); font-size: 1.25rem; }
.form-hint { margin: 9px 0 0; color: var(--muted); font-size: .78rem; line-height: 1.45; }
.hero .form-hint { color: #aebdca; }
.hero-visual { position: relative; min-height: 224px; }
.hero-price-card { position: absolute; border: 1px solid rgba(255,255,255,.18); color: var(--ink); background: #fffdf8; box-shadow: 0 24px 64px rgba(0,0,0,.28); }
.hero-price-card span, .hero-price-card small { display: block; }
.hero-price-card span { color: var(--red); font-size: .7rem; font-weight: 900; letter-spacing: .11em; text-transform: uppercase; }
.hero-price-card strong { display: block; margin: 7px 0 2px; font-family: Georgia, serif; font-size: 2.45rem; line-height: .9; letter-spacing: -.05em; }
.hero-price-card small { color: var(--muted); font-size: .75rem; }
.hero-price-card-primary { z-index: 2; right: 6px; bottom: 2px; width: 200px; padding: 17px; border-radius: 8px 8px 28px 8px; transform: rotate(-2deg); }
.hero-price-card-secondary { z-index: 1; top: -6px; left: -4px; width: 176px; padding: 15px; border-radius: 8px; opacity: .78; transform: rotate(5deg); }
.hero-price-card-secondary span { white-space: nowrap; font-size: .62rem; }
.hero-price-card-secondary strong { font-size: 2.15rem; }
.hero-store-line { display: flex; align-items: center; gap: 6px; margin-top: 13px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: .61rem; font-weight: 800; }
.hero-store-line b { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.hero-fresh-badge { position: absolute; z-index: 3; right: 0; top: 30px; display: flex; align-items: center; gap: 4px; width: 58px; height: 58px; padding: 7px; border: 3px solid var(--ink); border-radius: 50%; color: white; background: var(--red); transform: rotate(8deg); }
.hero-fresh-badge b { font-family: Georgia, serif; font-size: 1.25rem; }.hero-fresh-badge span { font-size: .42rem; font-weight: 900; line-height: 1.05; text-transform: uppercase; }

.results-section { padding: 34px 0 72px; }
.results-controls { display: grid; grid-template-columns: minmax(0, 1fr) 210px; gap: 14px; align-items: stretch; margin-top: -82px; position: relative; z-index: 2; }
.category-picker { padding: 20px; border-radius: 12px; background: white; box-shadow: var(--shadow); }
.category-picker .control-label { color: var(--muted); }
.category-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.category-tab { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-height: 66px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: white; text-align: left; }
.category-tab span { color: var(--muted); font-size: .7rem; }
.category-tab:hover { border-color: var(--red); }
.category-tab.active { border-color: var(--red); color: white; background: var(--red); }
.category-tab.active span { color: #ffe5e1; }
.toolbar { display: flex; flex-direction: column; justify-content: center; align-items: stretch; padding: 20px; border-radius: 12px; background: white; box-shadow: var(--shadow); }
.toolbar label { color: var(--muted); }
.toolbar select { font-weight: 700; }
.results-summary { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin: 48px 0 20px; }
h2 { margin: 0; font-family: Georgia, serif; font-size: clamp(1.8rem, 4vw, 2.8rem); line-height: 1.05; }
.legend { display: flex; gap: 16px; color: var(--muted); font-size: .78rem; }
.dot { display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 50%; }
.dot.fresh { background: var(--green); }
.dot.aging { background: var(--amber); }
.content-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr); gap: 24px; align-items: start; }
.store-list { display: grid; gap: 12px; }
.store-card { padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: white; box-shadow: 0 4px 16px rgba(22,40,58,.035); }
.store-card:hover { border-color: #aab5bb; transform: translateY(-1px); }
.store-card-top { display: flex; justify-content: space-between; align-items: start; gap: 20px; }
.store-chain { margin: 0 0 4px; color: var(--red); font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.store-name { margin: 0; font-size: 1.15rem; }
.store-address { margin: 5px 0 0; color: var(--muted); font-size: .82rem; }
.price-block { text-align: right; white-space: nowrap; }
.price-block strong { display: block; font-family: Georgia, serif; font-size: 2rem; line-height: 1; }
.price-block span { color: var(--muted); font-size: .72rem; }
.price-meta { display: flex; flex-wrap: wrap; gap: 6px; padding: 14px 0; }
.price-meta span { padding: 5px 8px; border-radius: 5px; background: var(--cream); font-size: .72rem; }
.store-card-bottom { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); padding-top: 12px; font-size: .78rem; }
.freshness { font-weight: 700; }
.freshness.fresh { color: var(--green); }
.freshness.aging { color: var(--amber); }
.card-links { display: flex; gap: 14px; }
.directions, .source-link { color: var(--ink); font-weight: 800; text-decoration: none; }
.directions:hover, .source-link:hover { color: var(--red); }
.price-meta span.package-badge { padding: 3px 6px; font-size: .64rem; color: var(--muted); }
.more-locations { margin-bottom: 12px; border-top: 1px solid var(--line); padding-top: 10px; font-size: .8rem; }
.more-locations summary { cursor: pointer; font-weight: 800; color: var(--ink); list-style: none; }
.more-locations summary::-webkit-details-marker { display: none; }
.more-locations summary::before { content: "▸"; display: inline-block; margin-right: 6px; color: var(--red); transition: transform .15s; }
.more-locations[open] summary::before { transform: rotate(90deg); }
.more-locations summary:hover { color: var(--red); }
.more-location-list { display: grid; gap: 6px; margin: 10px 0 0; padding: 0; list-style: none; }
.more-location-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 8px; background: var(--paper); }
.more-location-list li div:first-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.more-location-list li span { color: var(--muted); font-size: .76rem; }
.more-location-side { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; white-space: nowrap; }
.more-location-side a { color: var(--ink); font-size: .74rem; font-weight: 800; text-decoration: none; }
.more-location-side a:hover { color: var(--red); }
.empty-state { padding: 34px; text-align: center; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); background: white; }
.loading-state { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 120px; padding: 34px; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); background: white; }
.spinner { width: 20px; height: 20px; border: 3px solid var(--line); border-top-color: var(--red); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.map-panel { position: sticky; top: 20px; padding: 12px; border-radius: 14px; background: white; box-shadow: var(--shadow); }
.map-topography { height: 470px; position: relative; overflow: hidden; border-radius: 9px; background: #e8efe9; }
.map-panel > p { margin: 10px 4px 2px; color: var(--muted); font-size: .72rem; }
.price-map-marker { display: grid; place-items: center; min-width: 54px; height: 32px; padding: 0 8px; color: white; background: var(--red); border: 3px solid white; border-radius: 999px; box-shadow: 0 4px 12px rgba(0,0,0,.24); font-size: .72rem; font-weight: 900; }
.leaflet-container { font: inherit; }
.leaflet-popup-content { margin: 14px 16px; line-height: 1.35; }
.leaflet-popup-content strong, .leaflet-popup-content span { display: block; }.leaflet-popup-content span { margin-top: 3px; color: var(--muted); font-size: .75rem; }
.map-unavailable { display: grid; place-items: center; height: 100%; padding: 28px; color: var(--muted); text-align: center; }

.trust-section { padding: 64px 0; background: var(--cream); }
.trust-section-inner { display: grid; grid-template-columns: 1fr 2fr; gap: 50px; }
.trust-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.trust-grid article { padding: 18px; border-left: 3px solid var(--red); background: rgba(255,255,255,.55); }
.trust-grid strong, .trust-grid span { display: block; }
.trust-grid span { margin-top: 7px; color: var(--muted); font-size: .82rem; line-height: 1.4; }
footer { padding: 24px 0; background: var(--ink); color: #aebdca; font-size: .75rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 20px; }

.admin-page { background: #f7f8f6; }
.admin-shell { padding: 34px clamp(20px, 6vw, 86px) 72px; }
.admin-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 460px); gap: 30px; align-items: end; padding: 34px 0 30px; border-bottom: 1px solid var(--line); }
.admin-hero h1 { color: var(--ink); font-size: clamp(2.5rem, 6vw, 4.8rem); }
.admin-hero .hero-copy { margin-bottom: 0; color: var(--muted); }
.admin-session-card { align-self: end; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.admin-session-card span, .admin-session-card strong { display: block; }
.admin-session-card span { color: var(--muted); font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.admin-session-card strong { margin-top: 6px; }
.admin-search label, .admin-create-form label, #admin-login-form label { display: block; margin: 0 0 6px; color: var(--muted); font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.admin-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 22px 0; }
.admin-metrics article { padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.admin-metrics span { display: block; font-family: Georgia, serif; font-size: 2.5rem; line-height: 1; }
.admin-metrics strong { display: block; margin-top: 8px; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }
.admin-tools { padding: 22px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.admin-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 520px); gap: 20px; align-items: end; }
.admin-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0; border-bottom: 1px solid var(--line); }
.admin-tab { margin-bottom: -1px; padding: 12px 14px; border: 1px solid transparent; border-radius: 8px 8px 0 0; background: transparent; color: var(--muted); font-weight: 800; }
.admin-tab.active { border-color: var(--line); border-bottom-color: white; color: var(--red); background: white; }
.admin-panel { display: none; }
.admin-panel.active { display: block; }
.admin-create-form { display: grid; grid-template-columns: repeat(5, minmax(140px, 1fr)) auto; gap: 12px; align-items: end; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfb; }
.admin-create-form .check { align-self: center; margin-top: 21px; }
.check.compact { font-weight: 700; text-transform: none; letter-spacing: 0; }
.admin-table-wrap { margin-top: 16px; overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
.admin-table { width: 100%; border-collapse: collapse; min-width: 860px; background: white; }
.admin-table th, .admin-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; font-size: .86rem; }
.admin-table th { color: var(--muted); background: #f4f6f4; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table td strong, .admin-table td span { display: block; }
.admin-table td span { margin-top: 3px; color: var(--muted); font-size: .75rem; }
.status-pill { display: inline-block; min-width: 72px; padding: 5px 8px; border-radius: 999px; text-align: center; color: var(--ink); background: #edf0f2; font-weight: 800; font-size: .72rem; text-transform: uppercase; }
.status-pill.active { color: white; background: var(--green); }
.status-pill.invited, .status-pill.inactive { background: #f2dfbf; color: #724605; }
.status-pill.disabled, .status-pill.blocked { color: white; background: #7b3840; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; min-width: 210px; }
.table-action { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: white; font-size: .72rem; font-weight: 800; text-transform: uppercase; }
.table-action:hover:not(:disabled) { border-color: var(--red); color: var(--red); }
.table-action:disabled { opacity: .45; cursor: default; }
.empty-cell { color: var(--muted); text-align: center; }
.admin-message { min-height: 18px; }
.admin-message.error { color: var(--red-dark); font-weight: 800; }
.admin-login-shell { display: grid; place-items: center; min-height: calc(100vh - 72px); padding: 32px 20px; }
.admin-login-panel { width: min(440px, 100%); padding: 28px; border: 1px solid var(--line); border-radius: 8px; background: white; box-shadow: var(--shadow); }
.admin-login-panel h1 { margin-bottom: 22px; color: var(--ink); font-size: clamp(2.4rem, 7vw, 4rem); }
#admin-login-form { display: grid; gap: 14px; }
#admin-login-form .primary-button { width: 100%; margin-top: 4px; }
.form-hint.error { color: var(--red-dark); font-weight: 800; }

dialog { width: min(680px, calc(100% - 24px)); max-height: 90vh; overflow: auto; padding: 0; border: 0; border-radius: 14px; box-shadow: 0 30px 90px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(14,28,40,.72); }
#entry-form { padding: 26px; }
.dialog-header { display: flex; justify-content: space-between; gap: 20px; }
.close-button { border: 0; background: transparent; color: var(--muted); font-size: 2rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 22px 0; }
.form-grid label { color: var(--muted); font-size: .74rem; font-weight: 800; }
.form-grid input, .form-grid select { margin-top: 6px; }
.form-grid .wide { grid-column: 1 / -1; }
.check { display: flex; align-items: start; gap: 9px; color: var(--muted); font-size: .8rem; line-height: 1.4; }
.check input { width: auto; margin-top: 2px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; }

@media (max-width: 800px) {
  .hero-layout, .content-grid, .trust-section-inner { grid-template-columns: 1fr; }
  .hero h1 { white-space: normal; }
  .hero-visual { display: none; }
  .map-panel { position: static; order: -1; }
  .map-topography { height: 260px; }
  .trust-grid { grid-template-columns: 1fr; }
  .admin-hero, .admin-toolbar { grid-template-columns: 1fr; }
  .admin-create-form { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 650px) {
  .results-controls { grid-template-columns: 1fr; margin-top: -58px; }
  .toolbar { padding: 16px 20px; }
}
@media (max-width: 560px) {
  .site-header { height: 62px; }.nav-button { padding: 8px 11px; font-size: .78rem; }
  .brand { font-size: 1rem; }
  .nav-link { font-size: .76rem; }
  .hero { padding-top: 44px; padding-bottom: 90px; }
  .search-row { grid-template-columns: 1fr auto; }.search-row .icon-button { grid-column: 1 / -1; }
  .category-tabs { grid-template-columns: 1fr; }
  .results-summary { align-items: start; flex-direction: column; }
  .store-card-top { align-items: end; }.store-address { max-width: 180px; }
  .form-grid { grid-template-columns: 1fr; }.form-grid .wide { grid-column: auto; }
  .admin-shell { padding-top: 20px; }
  .admin-metrics, .admin-create-form { grid-template-columns: 1fr; }
  .admin-tools { padding: 14px; }
  .footer-inner { flex-direction: column; }
}
