:root {
  --ink: #17231b;
  --muted: #667269;
  --paper: #f5f2e9;
  --panel: #fffdf8;
  --green: #2f6f4e;
  --green-dark: #1f5038;
  --gold: #c98a2e;
  --line: #ddd9cc;
  --red: #a64235;
  --shadow: 0 18px 45px rgba(24, 39, 29, .08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: linear-gradient(160deg, #f7f4eb, #eef2e9); }
a { color: var(--green-dark); }
button, .button, .primary { font: inherit; }
button, .button { border: 1px solid var(--line); border-radius: .65rem; background: #fff; color: var(--ink); padding: .7rem 1rem; cursor: pointer; text-decoration: none; }
.primary { display: inline-block; border: 0; border-radius: .7rem; background: var(--green); color: #fff; padding: .8rem 1.15rem; text-decoration: none; font-weight: 700; }
.primary:hover { background: var(--green-dark); }
.large { padding: 1rem 1.35rem; font-size: 1.05rem; }
.topbar { min-height: 74px; display: flex; align-items: center; gap: 1.3rem; padding: .8rem clamp(1rem, 4vw, 3rem); background: rgba(255,253,248,.94); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; backdrop-filter: blur(14px); }
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; margin-right: auto; }
.brand-copy { display: flex; flex-direction: column; }
.brand strong { color: var(--ink); font-size: 1.15rem; }
.brand-logo-shell { width: 48px; height: 48px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: #17231b; overflow: hidden; }
.brand-logo-shell img { width: 44px; height: 44px; object-fit: contain; }
.eyebrow { margin: 0 0 .3rem; color: var(--green); font-size: .74rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.topbar nav { display: flex; flex-wrap: wrap; gap: .25rem; }
.topbar nav a { padding: .5rem .65rem; text-decoration: none; border-radius: .5rem; font-size: .9rem; }
.topbar nav a:hover { background: #e8eee7; }
.logout { margin: 0; }
.link-button { border: 0; background: transparent; color: var(--muted); padding: .5rem; }
.page-shell { width: min(1220px, calc(100% - 2rem)); margin: 0 auto; padding: 2rem 0 4rem; }
footer { padding: 2rem; color: var(--muted); text-align: center; font-size: .85rem; }
h1, h2 { letter-spacing: -.025em; }
h1 { margin: .2rem 0 .5rem; font-size: clamp(2rem, 4vw, 3.5rem); line-height: 1.05; }
h2 { margin: .15rem 0 .6rem; }
p { line-height: 1.55; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 2rem; margin: .5rem 0 1.5rem; }
.page-heading h1 { font-size: clamp(2rem, 4vw, 3rem); }
.page-heading p:not(.eyebrow) { margin: 0; color: var(--muted); }
.panel, .public-card, .auth-card { background: var(--panel); border: 1px solid rgba(125,130,117,.2); border-radius: 1rem; box-shadow: var(--shadow); padding: clamp(1rem, 3vw, 1.6rem); }
.public-page .topbar { position: static; }
.public-page .page-shell { max-width: 760px; }
.public-card { margin-top: 2rem; }
.centered { text-align: center; padding: clamp(2rem, 6vw, 4.5rem); }
.location-grid, .qr-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; margin-top: 2rem; }
.location-card { min-height: 150px; display: flex; flex-direction: column; justify-content: center; gap: .35rem; padding: 1.5rem; border: 1px solid var(--line); border-radius: .9rem; text-decoration: none; background: #fff; }
.location-card span { color: var(--gold); font-weight: 900; letter-spacing: .12em; }
.location-card strong { font-size: 1.25rem; }
.survey-heading { display: flex; align-items: start; justify-content: space-between; gap: 1rem; }
.survey-heading p:not(.eyebrow) { margin: .4rem 0 0; color: var(--muted); }
.survey-location-logo { display: block; width: min(250px, 42vw); max-height: 188px; margin: -.2rem auto 1.2rem; object-fit: contain; border-radius: .7rem; }
.survey-form fieldset { border: 0; margin: 1.7rem 0; padding: 0; }
legend { font-size: 1.12rem; font-weight: 800; margin-bottom: .8rem; }
label { display: flex; flex-direction: column; gap: .35rem; color: var(--ink); font-weight: 650; }
label > span, legend span { color: var(--muted); font-size: .8rem; font-weight: 500; }
input, select, textarea { width: 100%; border: 1px solid #c8c9c0; border-radius: .6rem; background: #fff; color: var(--ink); padding: .78rem .8rem; font: inherit; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(47,111,78,.18); border-color: var(--green); }
.choice-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; }
.rating-grid { grid-template-columns: repeat(4, 1fr); }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span { display: flex; align-items: center; justify-content: center; min-height: 64px; padding: .7rem; border: 1px solid var(--line); border-radius: .7rem; background: #fff; color: var(--ink); text-align: center; font-weight: 700; cursor: pointer; }
.choice input:checked + span { background: var(--green); color: #fff; border-color: var(--green); box-shadow: 0 0 0 3px rgba(47,111,78,.15); }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.form-grid.three { grid-template-columns: repeat(3, 1fr); }
.check { flex-direction: row; align-items: start; gap: .7rem; margin: .8rem 0; font-weight: 500; }
.check input, .inline-check input { width: auto; margin-top: .2rem; }
.check span { color: var(--ink); font-size: .95rem; }
.privacy, .footnote { color: var(--muted); font-size: .83rem; }
.survey-discovery { display: grid; gap: .25rem; margin: 1.4rem 0; padding: 1rem 1.1rem; border-left: 4px solid var(--gold); border-radius: 0 .7rem .7rem 0; background: #f6eddd; color: var(--ink); }
.survey-discovery span { color: var(--muted); line-height: 1.45; }
.submit-bar { display: flex; justify-content: end; }
.honeypot { position: absolute; left: -10000px; }
.success-mark { width: 72px; height: 72px; margin: 0 auto 1.3rem; border-radius: 50%; display: grid; place-items: center; background: #e2efe4; color: var(--green); font-size: 2rem; font-weight: 900; }
.review-invite { margin-top: 2rem; padding-top: 2rem; border-top: 1px solid var(--line); }
.auth-card { width: min(420px, 100%); margin: 8vh auto; display: grid; gap: 1rem; }
.auth-logo { width: 132px; height: 132px; display: grid; place-items: center; margin: -5.3rem auto .25rem; border-radius: 50%; background: #17231b; box-shadow: 0 12px 30px rgba(23,35,27,.2); }
.auth-logo img { width: 122px; height: 122px; object-fit: contain; }
.thanks-location-logo { width: min(260px, 75%); max-height: 195px; object-fit: contain; margin: 0 auto 1.25rem; border-radius: .7rem; }
.flash { margin-bottom: 1rem; border-radius: .7rem; padding: .85rem 1rem; background: #e8eee7; }
.flash.error { background: #f8e3df; color: #7b2f25; }
.form-panel { display: grid; gap: 1.2rem; }
.form-panel fieldset { border: 1px solid var(--line); border-radius: .7rem; padding: 1rem; margin: 0; }
.inline-check { flex-direction: row; display: inline-flex; margin: .35rem .8rem .35rem 0; font-weight: 500; }
.button-row { display: flex; gap: .7rem; }
.filters { display: flex; flex-wrap: wrap; align-items: end; gap: .8rem; margin-bottom: 1.2rem; }
.sticky-filters { position: sticky; top: 84px; z-index: 8; box-shadow: 0 12px 30px rgba(24,39,29,.12); }
.filters label { min-width: 145px; flex: 1; }
.filters .search-field { min-width: 280px; flex: 2; }
.custom-dates { display: none; gap: .5rem; flex: 2; }
.custom-dates.visible { display: flex; }
.metric-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: .9rem; margin: 1.2rem 0; }
.metric-card { min-height: 145px; padding: 1.1rem; background: var(--panel); border: 1px solid var(--line); border-radius: .85rem; }
.metric-card .label { color: var(--muted); font-size: .84rem; }
.metric-card .value { min-height: 2.4rem; font-size: 2rem; line-height: 1.2; font-weight: 850; margin: .35rem 0; }
.metric-card .change { min-height: 1.25rem; font-size: .85rem; line-height: 1.45; font-weight: 700; }
.positive { color: var(--green); } .negative { color: var(--red); } .neutral { color: var(--muted); }
.chart-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.chart-wide { grid-column: 1 / -1; }
.panel-heading { display: flex; align-items: start; justify-content: space-between; gap: 1rem; }
.panel-heading span { color: var(--muted); font-size: .78rem; }
.chart-wrap { height: 310px; margin-top: 1rem; }
.origin-summary { display: grid; gap: 1.35rem; margin-top: 1rem; }
.origin-group { display: grid; gap: .7rem; }
.origin-group + .origin-group { padding-top: 1rem; border-top: 1px solid var(--line); }
.origin-group-heading { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; }
.origin-group-heading h3 { margin: 0; font-size: .92rem; }
.origin-group-heading span { color: var(--muted); font-size: .78rem; }
.origin-list { display: grid; gap: .75rem; }
.origin-row { display: grid; grid-template-columns: minmax(115px, 1fr) minmax(100px, 2fr) minmax(85px, auto); gap: .8rem; align-items: center; }
.origin-label, .origin-count { display: flex; flex-direction: column; }
.origin-label span, .origin-comparison { color: var(--muted); font-size: .72rem; }
.origin-bar { height: 9px; overflow: hidden; border-radius: 999px; background: #e7e9e2; }
.origin-bar span { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.origin-count { align-items: end; text-align: right; }
.origin-count > strong { font-size: 1.1rem; }
.origin-empty { margin: .5rem 0; color: var(--muted); }
.activity-summary { display: grid; gap: .7rem; margin-top: 1rem; }
.activity-row { display: grid; grid-template-columns: 1fr auto auto; gap: 1rem; padding: .8rem 0; border-bottom: 1px solid var(--line); }
.signal-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .8rem; margin-top: 1rem; }
.signal { padding: 1rem; border-radius: .7rem; background: #f3f2ea; }
.signal strong { display: block; font-size: 1.7rem; }
.freshness { color: var(--muted); font-size: .8rem; }
.feedback-list { display: grid; gap: .8rem; }
.feedback-card { display: block; padding: 1.2rem; background: var(--panel); border: 1px solid var(--line); border-radius: .8rem; color: var(--ink); text-decoration: none; }
.feedback-card:hover { border-color: var(--green); box-shadow: var(--shadow); }
.feedback-card h2 { font-size: 1.08rem; margin-top: .65rem; }
.feedback-card p { color: var(--muted); margin-bottom: .4rem; }
.feedback-meta, .tag-row { display: flex; flex-wrap: wrap; gap: .55rem; color: var(--muted); font-size: .8rem; }
.location-pill, .rating, .tag { padding: .22rem .48rem; border-radius: 999px; background: #e9eee7; font-weight: 750; }
.rating.great, .rating.good { color: var(--green-dark); }
.rating.fair { color: #8a5d1e; background: #f5ead8; }
.rating.poor, .tag.alert { color: #842d23; background: #f6dfdb; }
.detail-grid { display: grid; grid-template-columns: 1.4fr .8fr; gap: 1rem; }
blockquote { margin: 1rem 0 2rem; font-size: clamp(1.2rem, 2.5vw, 1.7rem); line-height: 1.5; }
dl { display: grid; grid-template-columns: repeat(2, 1fr); gap: .8rem; }
dl div { border-top: 1px solid var(--line); padding-top: .65rem; }
dt { color: var(--muted); font-size: .8rem; } dd { margin: .25rem 0 0; }
.internal-note { border-radius: .7rem; background: #f3f2ea; padding: 1rem; }
.internal-note strong { display: block; margin-bottom: .4rem; }
.empty-state { padding: 3rem; text-align: center; color: var(--muted); background: var(--panel); border-radius: 1rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .75rem; text-align: left; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .07em; }
.qr-card { text-align: center; display: grid; justify-items: center; gap: .8rem; }
.qr-card .qr-location-logo { width: min(330px, 100%); max-height: 248px; object-fit: contain; border-radius: .6rem; }
.qr-card .qr-code-preview { width: min(270px, 90%); border-radius: .6rem; }
.qr-card code { overflow-wrap: anywhere; font-size: .8rem; }
@media (max-width: 980px) {
  .topbar { align-items: start; flex-wrap: wrap; }
  .topbar nav { order: 3; width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .metric-grid { grid-template-columns: repeat(3, 1fr); }
  .sticky-filters { top: 126px; }
}
@media (max-width: 720px) {
  .page-shell { width: min(100% - 1rem, 1220px); padding-top: 1rem; }
  .location-grid, .qr-grid, .chart-grid, .detail-grid, .form-grid, .form-grid.three { grid-template-columns: 1fr; }
  .choice-grid, .rating-grid { grid-template-columns: repeat(2, 1fr); gap: .55rem; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .page-heading { align-items: start; flex-direction: column; }
  .chart-wide { grid-column: auto; }
  .public-page .page-shell { width: 100%; padding: 0 0 5rem; }
  .public-page .topbar { min-height: 58px; padding: .6rem 1rem; }
  .public-page .brand .eyebrow { display: none; }
  .public-page .brand-logo-shell { width: 40px; height: 40px; }
  .public-page .brand-logo-shell img { width: 37px; height: 37px; }
  .public-card { margin: 0; border-width: 0; border-radius: 0; box-shadow: none; padding: 1rem; }
  .survey-heading { padding: .5rem 0 1rem; }
  .survey-location-logo { width: min(210px, 66vw); max-height: 158px; margin-bottom: .7rem; }
  .survey-heading h1 { font-size: 2rem; }
  .survey-heading > a { white-space: nowrap; font-size: .82rem; }
  .survey-form fieldset { margin: 1rem 0; padding: 1rem; border: 1px solid var(--line); border-radius: .85rem; background: rgba(255,255,255,.62); }
  .survey-form > label { margin: 1rem 0; }
  .choice span { min-height: 58px; padding: .65rem .4rem; }
  input, select, textarea { min-height: 48px; font-size: 16px; }
  textarea { min-height: 126px; }
  .submit-bar { position: sticky; bottom: 0; z-index: 5; margin: 1.25rem -1rem -1rem; padding: .75rem 1rem calc(.75rem + env(safe-area-inset-bottom)); background: rgba(245,242,233,.96); border-top: 1px solid var(--line); backdrop-filter: blur(12px); }
  .submit-bar .primary { width: 100%; min-height: 52px; }
  .topbar { position: static; }
  .sticky-filters {
    top: 0;
    flex-wrap: nowrap;
    align-items: end;
    width: calc(100% + 1rem);
    margin-left: -.5rem;
    padding: .7rem;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
  }
  .sticky-filters label,
  .sticky-filters .search-field,
  .sticky-filters .custom-dates {
    flex: 0 0 180px;
    min-width: 180px;
    scroll-snap-align: start;
  }
  .sticky-filters .search-field { flex-basis: 245px; }
  .sticky-filters .custom-dates.visible { display: flex; flex-basis: 370px; }
  .sticky-filters button { flex: 0 0 auto; min-height: 48px; }
  .origin-row { grid-template-columns: minmax(105px, 1fr) minmax(70px, 1.2fr) auto; gap: .55rem; }
  .origin-comparison { display: none; }
}
