/* Skyway Survey Dashboard — design tokens */
:root {
  /* Warm paper palette */
  --paper: #F5EFE3;          /* cream/parchment */
  --paper-2: #EDE5D3;        /* slightly deeper */
  --paper-3: #E3D9C2;        /* divider tone */
  --ink: #1F2433;            /* deep navy ink */
  --ink-2: #3A4055;          /* secondary ink */
  --ink-3: #6A6F80;          /* tertiary */
  --ink-4: #9A9CA5;          /* mute */

  --brick: #B0492C;          /* primary accent — brick/rust */
  --brick-soft: #E8C8B6;     /* soft brick */
  --forest: #355E3B;         /* secondary accent — forest */
  --forest-soft: #C9D6BD;    /* soft forest */
  --gold: #B68A2E;           /* tertiary — civic gold */
  --gold-soft: #E8D9A8;
  --sky: #3E5A7A;            /* skyway blue */
  --sky-soft: #BFD0DE;

  --pos: #4F7B4D;
  --pos-soft: #D6E4D2;
  --neg: #B0492C;
  --neg-soft: #ECC8B7;
  --neu: #8B7B5E;
  --neu-soft: #DFD3B6;

  --r: 8px;
  --r-lg: 14px;

  --shadow-sm: 0 1px 0 rgba(31, 36, 51, 0.06);
  --shadow-md: 0 6px 18px -8px rgba(31, 36, 51, 0.18);

  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Helvetica Neue", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01" on, "cv11" on;
}

.serif { font-family: var(--serif); font-weight: 500; letter-spacing: -0.01em; }
.mono { font-family: var(--mono); font-size: 11px; letter-spacing: 0.02em; }

button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

/* Subtle paper grain */
.paper-grain {
  background-image:
    radial-gradient(rgba(31,36,51,0.025) 1px, transparent 1px),
    radial-gradient(rgba(31,36,51,0.018) 1px, transparent 1px);
  background-size: 22px 22px, 31px 31px;
  background-position: 0 0, 11px 15px;
}

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--paper-3); border-radius: 999px; border: 2px solid var(--paper); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-4); }

/* Reusable pill */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.01em;
  background: var(--paper-2);
  color: var(--ink-2);
  border: 1px solid var(--paper-3);
  white-space: nowrap;
}
.pill.pos { background: var(--pos-soft); color: #2D4A2C; border-color: #BFD2BB; }
.pill.neg { background: var(--neg-soft); color: #6F2A14; border-color: #DBAA92; }
.pill.neu { background: var(--neu-soft); color: #58492C; border-color: #C8B98F; }
.pill.brick { background: var(--brick-soft); color: #6F2A14; border-color: #DBAA92; }
.pill.forest { background: var(--forest-soft); color: #2D4A2C; border-color: #BFD2BB; }
.pill.sky { background: var(--sky-soft); color: #1F3A56; border-color: #A4BACE; }
.pill.gold { background: var(--gold-soft); color: #5C4319; border-color: #D2BF8A; }
.pill.outline { background: transparent; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--r);
  border: 1px solid var(--paper-3);
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  transition: background 120ms;
}
.btn:hover { background: var(--paper-2); }
.btn.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn.primary:hover { background: var(--ink-2); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--paper-2); }
.btn.brick { background: var(--brick); color: white; border-color: var(--brick); }
.btn:disabled, .btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: auto;
}
.btn:disabled:hover, .btn[disabled]:hover { background: inherit; }

/* Layout */
.app {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100vh;
  width: 100%;
  overflow: hidden;
}

/* === Top bar (mobile-first) === */
.topbar {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "brand export"
    "tabs  tabs"
    "search search";
  align-items: center;
  gap: 8px 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--paper-3);
  background: var(--paper);
  position: relative;
  z-index: 5;
}
.brand {
  grid-area: brand;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  min-width: 0;
}
.brand > div:last-child { display: flex; flex-direction: column; min-width: 0; }
.brand > div:last-child > div:first-child {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand-mark {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  background: var(--ink); color: var(--paper);
  border-radius: 6px;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}
.brand-sub {
  color: var(--ink-3);
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 400;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.tabs {
  grid-area: tabs;
  display: flex;
  gap: 2px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin: 0 -14px;
  padding: 0 14px;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-3);
  background: transparent;
  border: none;
  border-radius: 6px;
  position: relative;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
}
.tab:hover { color: var(--ink); background: var(--paper-2); }
.tab.active { color: var(--ink); background: var(--paper-2); }
.tab .count { color: var(--ink-4); font-weight: 400; margin-left: 4px; font-size: 11px; }

.topbar .right {
  grid-area: export;
  display: flex;
  align-items: center;
  gap: 6px;
  justify-self: end;
}

/* Search */
.search {
  grid-area: search;
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px;
  background: var(--paper-2);
  border: 1px solid var(--paper-3);
  border-radius: var(--r);
  width: 100%;
}
.search input {
  background: transparent; border: none; outline: none;
  flex: 1; color: var(--ink);
  font-size: 13px;
  min-width: 0;
}
.search input::placeholder { color: var(--ink-4); }

/* Topbar — desktop layout */
@media (min-width: 880px) {
  .topbar {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 10px 22px;
    grid-template-areas: none;
  }
  .brand { font-size: 17px; }
  .brand-mark { width: 28px; height: 28px; font-size: 15px; }
  .brand-sub { font-size: 11px; }
  .tabs {
    overflow: visible;
    margin: 0 0 0 8px;
    padding: 0;
  }
  .tab { padding: 8px 14px; }
  .topbar .right { margin-left: auto; }
  .search { width: 280px; }
}

/* Page container */
.page { overflow: hidden; height: 100%; }

/* === Overview page (mobile-first) === */
.overview {
  height: 100%;
  overflow: auto;
  padding: 18px 16px 60px;
  max-width: 1480px;
  margin: 0 auto;
}
.overview-head {
  display: flex; flex-direction: column;
  gap: 12px; margin-bottom: 18px;
}
.overview-head h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 26px;
  margin: 0 0 4px 0;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.overview-head .lede {
  color: var(--ink-3);
  font-size: 14px;
  max-width: 580px;
  line-height: 1.55;
}
.kicker {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--brick);
  margin-bottom: 6px;
}

.kpi-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}
.kpi {
  background: var(--paper);
  border: 1px solid var(--paper-3);
  border-radius: var(--r-lg);
  padding: 14px 14px;
  position: relative;
  min-width: 0;
}
.kpi-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-3); font-weight: 600; }
.kpi-value { font-family: var(--serif); font-size: 28px; font-weight: 500; line-height: 1.1; margin-top: 6px; letter-spacing: -0.02em; }
.kpi-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
.grid-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.card {
  background: var(--paper);
  border: 1px solid var(--paper-3);
  border-radius: var(--r-lg);
  padding: 16px 16px;
  min-width: 0;
  overflow: hidden;
}

/* Overview page — desktop scale-up */
@media (min-width: 880px) {
  .overview { padding: 24px 28px 60px; }
  .overview-head {
    flex-direction: row;
    align-items: flex-end; justify-content: space-between;
    gap: 24px; margin-bottom: 22px;
  }
  .overview-head h1 { font-size: 36px; }
  .kpi-row {
    grid-template-columns: repeat(4, 1fr);
    gap: 14px; margin-bottom: 22px;
  }
  .kpi { padding: 16px 18px; }
  .kpi-value { font-size: 38px; }
  .kpi-sub { font-size: 12px; }
  .grid-2 { grid-template-columns: 1.4fr 1fr; gap: 14px; margin-bottom: 14px; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 14px; }
  .card { padding: 18px 20px; }
}
.card h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 17px;
  margin: 0 0 4px 0;
  letter-spacing: -0.01em;
}
.card .h-sub { font-size: 12px; color: var(--ink-3); margin-bottom: 14px; }

/* Bar chart */
.barchart { display: flex; flex-direction: column; gap: 8px; }
.bar-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(60px, 1.4fr) 36px;
  gap: 8px;
  align-items: center;
  font-size: 12.5px;
}
@media (min-width: 880px) {
  .bar-row { grid-template-columns: 160px 1fr 40px; gap: 10px; }
}
.bar-row .label { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row .track { height: 18px; background: var(--paper-2); border-radius: 4px; overflow: hidden; position: relative; }
.bar-row .fill { height: 100%; background: linear-gradient(90deg, var(--brick), #C26243); border-radius: 4px; transition: width 600ms cubic-bezier(.2,.8,.2,1); }
.bar-row .fill.forest { background: linear-gradient(90deg, var(--forest), #466F4C); }
.bar-row .fill.sky { background: linear-gradient(90deg, var(--sky), #5478A0); }
.bar-row .fill.gold { background: linear-gradient(90deg, var(--gold), #C9A347); }
.bar-row .num { font-variant-numeric: tabular-nums; font-size: 12px; color: var(--ink-3); text-align: right; }

/* Rating dist */
.rating-row {
  display: flex; align-items: end; gap: 12px;
  height: 160px; padding: 12px 4px 0;
}
.rating-bar {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px;
  height: 100%;
}
.rating-bar .barwrap { flex: 1; width: 100%; display: flex; align-items: end; }
.rating-bar .b {
  width: 100%;
  background: var(--brick); border-radius: 4px 4px 0 0;
  transition: height 600ms cubic-bezier(.2,.8,.2,1);
  position: relative;
}
.rating-bar .b .v {
  position: absolute; top: -20px; left: 50%; transform: translateX(-50%);
  font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums;
}
.rating-bar .lab { font-size: 12px; color: var(--ink-2); font-weight: 500; }
.rating-bar .star { font-size: 12px; color: var(--ink-4); }
.rating-bar.r1 .b { background: #B0492C; }
.rating-bar.r2 .b { background: #C26243; }
.rating-bar.r3 .b { background: #B68A2E; }
.rating-bar.r4 .b { background: #6F8C48; }
.rating-bar.r5 .b { background: #355E3B; }

/* Theme tag cloud */
.theme-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
@media (min-width: 600px) {
  .theme-grid { grid-template-columns: repeat(2, 1fr); }
}
.theme-tile {
  display: flex; flex-direction: column;
  padding: 12px 14px;
  border: 1px solid var(--paper-3);
  border-radius: var(--r);
  background: var(--paper);
  transition: all 120ms;
  cursor: pointer;
  text-align: left;
  position: relative;
  overflow: hidden;
}
.theme-tile:hover { background: var(--paper-2); border-color: var(--ink-4); }
.theme-tile .label { font-weight: 500; font-size: 13px; color: var(--ink); }
.theme-tile .meta { font-size: 11px; color: var(--ink-3); margin-top: 2px; font-variant-numeric: tabular-nums; }
.theme-tile .spark {
  position: absolute; right: 12px; top: 12px;
  font-family: var(--serif); font-size: 22px; color: var(--brick); font-weight: 500;
}
.theme-tile.alliance_closure { border-left: 3px solid var(--brick); }
.theme-tile.safety { border-left: 3px solid #B0492C; }
.theme-tile.cleanliness { border-left: 3px solid var(--gold); }
.theme-tile.hours { border-left: 3px solid var(--sky); }
.theme-tile.wayfinding { border-left: 3px solid #6B7BA5; }
.theme-tile.retail { border-left: 3px solid #9A6B3A; }
.theme-tile.events { border-left: 3px solid #A1538A; }
.theme-tile.weather { border-left: 3px solid #5B8FA8; }
.theme-tile.accessibility { border-left: 3px solid var(--forest); }
.theme-tile.community { border-left: 3px solid #6B8E55; }

/* === Responses page (mobile-first, drawer-style) === */
.responses {
  display: block;
  height: 100%;
  position: relative;
  overflow: hidden;
}
.filter-rail {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: min(86vw, 320px);
  background: var(--paper);
  border-right: 1px solid var(--paper-3);
  overflow-y: auto;
  padding: 18px 16px;
  z-index: 30;
  transform: translateX(-100%);
  transition: transform 220ms cubic-bezier(.2,.8,.2,1);
  box-shadow: 0 0 0 transparent;
}
.filter-rail.open {
  transform: translateX(0);
  box-shadow: 8px 0 28px rgba(35, 30, 24, 0.14);
}
.filter-backdrop {
  position: absolute; inset: 0;
  background: rgba(35, 30, 24, 0.32);
  z-index: 25;
  animation: fadeIn 180ms ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.filters-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  background: var(--paper);
  border: 1px solid var(--paper-3);
  border-radius: var(--r);
  color: var(--ink);
  cursor: pointer;
}
.filters-toggle:hover { background: var(--paper-2); }
.filters-toggle .chip {
  display: inline-block;
  padding: 1px 7px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 999px;
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

@media (min-width: 880px) {
  .responses {
    display: grid;
    grid-template-columns: 280px 1fr 1fr;
  }
  .filter-rail {
    position: static;
    width: auto;
    transform: none;
    box-shadow: none;
    transition: none;
    z-index: 1;
  }
  .filter-backdrop { display: none; }
  .filters-toggle { display: none; }
}
.filter-group { margin-bottom: 18px; }
.filter-group h4 {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--ink-3); font-weight: 600;
  margin: 0 0 8px 0;
}
.filter-opts { display: flex; flex-direction: column; gap: 1px; }
.filter-opt {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink-2);
  transition: background 120ms;
  user-select: none;
}
.filter-opt:hover { background: var(--paper-2); }
.filter-opt.on { background: var(--ink); color: var(--paper); }
.filter-opt.on .count { color: rgba(245, 239, 227, 0.6); }
.filter-opt .count { font-size: 11px; color: var(--ink-4); font-variant-numeric: tabular-nums; }

.list-pane {
  background: var(--paper-2);
  overflow-y: auto;
  height: 100%;
}
@media (min-width: 880px) {
  .list-pane { border-right: 1px solid var(--paper-3); }
}
.list-head {
  position: sticky; top: 0;
  background: var(--paper-2);
  border-bottom: 1px solid var(--paper-3);
  padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
  z-index: 1;
}
.list-head .label { font-size: 12px; color: var(--ink-3); }
.list-head .label strong { color: var(--ink); font-variant-numeric: tabular-nums; }

.resp-card {
  padding: 12px 16px;
  border-bottom: 1px solid var(--paper-3);
  cursor: pointer;
  transition: background 120ms;
}
.resp-card:hover { background: var(--paper); }
.resp-card.active {
  background: var(--paper);
  box-shadow: inset 3px 0 0 var(--brick);
}
.resp-card .row1 {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 6px;
}
.resp-card .id { font-family: var(--mono); font-size: 10.5px; color: var(--ink-4); }
.resp-card .stars { color: var(--gold); letter-spacing: 1px; font-size: 11px; }
.resp-card .stars .empty { color: var(--paper-3); }
.resp-card .audience { font-size: 11px; color: var(--ink-3); margin-left: auto; }
.resp-card .preview {
  font-family: var(--serif);
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 6px;
}
.resp-card .meta { display: flex; gap: 4px; flex-wrap: wrap; }

/* Detail pane (mobile-first overlay) */
.detail-pane {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  overflow-y: auto;
  background: var(--paper);
  z-index: 20;
  transform: translateX(100%);
  transition: transform 220ms cubic-bezier(.2,.8,.2,1);
}
.detail-pane.open { transform: translateX(0); }
.detail-empty {
  height: 100%; display: grid; place-items: center;
  color: var(--ink-4); font-size: 14px;
}

.detail-back {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--paper);
  border-bottom: 1px solid var(--paper-3);
  padding: 10px 16px;
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--ink-2);
  font-family: var(--sans); font-weight: 500;
  cursor: pointer;
  border-radius: 0;
  width: 100%;
  border-left: 0; border-right: 0; border-top: 0;
}
.detail-back:hover { background: var(--paper-2); }

.detail {
  padding: 18px 16px 60px;
  max-width: 720px;
  margin: 0 auto;
}

@media (min-width: 880px) {
  .detail-pane {
    position: static;
    transform: none !important;
    transition: none;
    z-index: 1;
  }
  .detail-back { display: none; }
  .detail { padding: 24px 28px 60px; }
}
.detail-head { margin-bottom: 18px; }
.detail-id { font-family: var(--mono); font-size: 11px; color: var(--ink-4); margin-bottom: 4px; }
.detail-quote {
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 14px;
}
@media (min-width: 880px) {
  .detail-quote { font-size: 22px; }
}
.detail-meta-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }

.ai-summary {
  background: linear-gradient(135deg, #F8F1DE, #EFE3C8);
  border: 1px solid #DCC9A0;
  border-radius: var(--r-lg);
  padding: 14px 16px;
  margin-bottom: 20px;
  position: relative;
}
.ai-summary .ai-tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--gold); font-weight: 700;
  margin-bottom: 6px;
}
.ai-summary p { margin: 0 0 8px; font-size: 13.5px; color: var(--ink-2); line-height: 1.5; }
.ai-summary .ai-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 8px; }

.qa-block { margin-bottom: 16px; }
.qa-block .q {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--ink-3); font-weight: 600;
  margin-bottom: 4px;
}
.qa-block .a {
  font-size: 14px; color: var(--ink);
  line-height: 1.55;
}
.qa-block .a.serif { font-family: var(--serif); font-size: 15px; }
.qa-block .a-empty { color: var(--ink-4); font-style: italic; }
.tag-list { display: flex; flex-wrap: wrap; gap: 5px; }

.profile-strip {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--paper-3);
  border-radius: var(--r);
  overflow: hidden;
  margin-bottom: 22px;
}
@media (min-width: 600px) {
  .profile-strip { grid-template-columns: repeat(4, 1fr); }
}
.profile-strip .cell {
  background: var(--paper-2);
  padding: 10px 12px;
}
.profile-strip .ck { font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-3); font-weight: 600; }
.profile-strip .cv { font-size: 13px; color: var(--ink); margin-top: 2px; font-weight: 500; }

.detail-actions {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding-top: 14px; border-top: 1px solid var(--paper-3);
}

/* Stars */
.stars-big { display: inline-flex; gap: 2px; color: var(--gold); font-size: 14px; letter-spacing: 1px; }
.stars-big .empty { color: var(--paper-3); }

/* === Themes page === */
.themes-page {
  height: 100%; overflow: auto;
  padding: 18px 16px 60px;
  max-width: 1480px; margin: 0 auto;
}
.cluster-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 18px;
}
@media (min-width: 880px) {
  .themes-page { padding: 24px 28px 60px; }
  .cluster-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; margin-top: 22px; }
}
.cluster {
  background: var(--paper);
  border: 1px solid var(--paper-3);
  border-radius: var(--r-lg);
  padding: 18px 20px;
}
.cluster-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 12px; }
.cluster-num {
  font-family: var(--serif);
  font-size: 32px; font-weight: 500;
  line-height: 1;
  color: var(--brick);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.cluster h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 19px;
  margin: 0 0 4px 0;
  letter-spacing: -0.01em;
}
.cluster .desc { font-size: 13px; color: var(--ink-3); line-height: 1.5; }
.cluster .quotes {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--paper-3);
}
.cluster .quote {
  font-family: var(--serif); font-style: italic;
  font-size: 13.5px; line-height: 1.45;
  color: var(--ink-2);
  padding: 6px 0 6px 14px;
  border-left: 2px solid var(--paper-3);
  margin-bottom: 6px;
}
.cluster .quote .who { font-style: normal; font-family: var(--mono); font-size: 10.5px; color: var(--ink-4); margin-left: 4px; }

/* === Insights page === */
.insights {
  height: 100%; overflow: auto;
  padding: 18px 16px 60px;
  max-width: 1480px; margin: 0 auto;
}
.heatmap-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 14px -16px 0;
  padding: 0 16px;
}
.heatmap {
  display: grid;
  grid-template-columns: 120px repeat(4, minmax(64px, 1fr));
  gap: 2px;
  margin-top: 14px;
  min-width: 360px;
}
.heatmap .hcell {
  padding: 8px 8px;
  font-size: 11px;
  text-align: center;
  border-radius: 4px;
  font-variant-numeric: tabular-nums;
}
.heatmap .hcell.h { font-weight: 600; color: var(--ink-3); text-align: left; padding-left: 0; }
.heatmap .hcell.col-h { font-weight: 600; color: var(--ink-3); background: transparent; }

.quote-reel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 880px) {
  .insights { padding: 24px 28px 60px; }
  .heatmap-scroll { margin: 14px 0 0; padding: 0; }
  .heatmap { grid-template-columns: 160px repeat(4, 1fr); min-width: 0; }
  .heatmap .hcell { padding: 8px 10px; font-size: 12px; }
  .quote-reel { grid-template-columns: repeat(2, 1fr); gap: 14px; }
}
.big-quote {
  background: var(--paper);
  border: 1px solid var(--paper-3);
  border-radius: var(--r-lg);
  padding: 22px 24px;
  position: relative;
}
.big-quote::before {
  content: "“";
  font-family: var(--serif);
  font-size: 80px;
  color: var(--brick-soft);
  position: absolute;
  top: -10px; left: 14px;
  line-height: 1;
}
.big-quote blockquote {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.45;
  margin: 0 0 12px 0;
  color: var(--ink);
  letter-spacing: -0.005em;
  position: relative;
  z-index: 1;
}
.big-quote .attr {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  display: flex; gap: 8px; align-items: center;
}

.outliers { margin-top: 22px; }
.outlier-card {
  display: flex; gap: 14px;
  background: var(--paper);
  border: 1px solid var(--paper-3);
  border-radius: var(--r);
  padding: 14px 16px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 120ms;
}
.outlier-card:hover { border-color: var(--brick); }
.outlier-flag {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--brick);
  font-weight: 700;
  white-space: nowrap;
  padding-top: 2px;
}
.outlier-text { flex: 1; font-family: var(--serif); font-size: 14px; line-height: 1.45; color: var(--ink-2); }
.outlier-id { font-family: var(--mono); font-size: 11px; color: var(--ink-4); white-space: nowrap; }

/* Page header (shared, mobile-first) */
.page-head {
  margin-bottom: 16px;
  display: flex; flex-direction: column;
  gap: 12px;
}
.page-head h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 24px;
  margin: 0;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.page-head .lede { color: var(--ink-3); font-size: 13.5px; max-width: 480px; line-height: 1.5; }
@media (min-width: 880px) {
  .page-head {
    flex-direction: row;
    align-items: flex-end; justify-content: space-between;
    gap: 24px; margin-bottom: 18px;
  }
  .page-head h1 { font-size: 32px; }
  .page-head .lede { font-size: 14px; }
}

/* utilities */
.row { display: flex; align-items: center; gap: 8px; }
.spread { display: flex; justify-content: space-between; align-items: center; }
.muted { color: var(--ink-3); }
.divider { height: 1px; background: var(--paper-3); margin: 14px 0; }

/* === Charts page (mobile-first, drawer-style) === */
.charts-layout {
  display: block;
  position: relative;
  height: 100%;
  overflow: hidden;
}
.charts-content {
  overflow-y: auto;
  padding: 16px 14px 60px;
  background: var(--paper);
  height: 100%;
}
@media (min-width: 880px) {
  .charts-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
  }
  .charts-content { padding: 28px 32px 60px; }
}

/* Vertical columns (rating distribution etc.) */
.vcols {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  padding: 14px 4px 0;
  height: 200px;
}
.vcol {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}
.vcol-track {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.vcol-bar {
  width: 100%;
  max-width: 56px;
  border-radius: 4px 4px 0 0;
  position: relative;
  min-height: 2px;
  transition: height 600ms cubic-bezier(.2,.8,.2,1);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 4px;
}
.vcol-v {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--paper);
  font-weight: 500;
}
.vcol-lab {
  margin-top: 6px;
  font-family: var(--serif);
  font-size: 13px;
  color: var(--ink-2);
}
.vcol-sub {
  font-size: 10px;
  color: var(--ink-4);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Donut (mobile-first: legend below) */
.donut-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 8px 0 4px;
}
.donut-wrap svg { flex-shrink: 0; }
.donut-legend {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
@media (min-width: 540px) {
  .donut-wrap { flex-direction: row; align-items: center; gap: 22px; }
  .donut-legend { flex: 1; width: auto; }
}
.donut-leg {
  display: grid;
  grid-template-columns: 14px 1fr auto auto;
  gap: 10px;
  align-items: center;
  font-size: 12.5px;
  color: var(--ink-2);
}
.donut-leg .dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.donut-leg .lab {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.donut-leg .num {
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
  font-size: 12px;
}
.donut-leg .pct {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-4);
  min-width: 32px;
  text-align: right;
}

/* === Responses summary strip (above list, mobile-first) === */
.summary-strip {
  position: sticky; top: 0;
  z-index: 2;
  background: var(--paper);
  border-bottom: 1px solid var(--paper-3);
  padding: 10px 14px 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
  align-items: end;
}
.ss-cell.wide { grid-column: 1 / -1; }
@media (min-width: 720px) {
  .summary-strip {
    grid-template-columns: auto auto 1fr 1.2fr;
    gap: 18px;
    padding: 12px 14px 14px;
  }
  .ss-cell.wide { grid-column: auto; }
}
.ss-cell { min-width: 0; }
.ss-cell.wide { min-width: 0; }
.ss-k {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-4);
  font-weight: 600;
  margin-bottom: 4px;
}
.ss-v {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1;
}
.ss-of {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--ink-4);
  font-weight: 400;
  margin-left: 4px;
}
.ss-mini {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 36px;
}
.ss-mini-col {
  flex: 1;
  display: flex; flex-direction: column; align-items: center;
  height: 100%;
}
.ss-mini-track {
  flex: 1;
  width: 100%;
  display: flex; align-items: flex-end;
}
.ss-mini-bar {
  width: 100%;
  background: linear-gradient(180deg, #C26243, var(--brick));
  border-radius: 2px 2px 0 0;
  min-height: 2px;
  transition: height 400ms cubic-bezier(.2,.8,.2,1);
}
.ss-mini-lab {
  font-size: 9px;
  color: var(--ink-4);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.ss-sent {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 2px;
}
.ss-sent-row {
  display: grid;
  grid-template-columns: 14px 1fr 28px;
  gap: 6px;
  align-items: center;
}
.ss-sent-lab {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  text-align: center;
}
.ss-sent-track {
  height: 8px;
  background: var(--paper-2);
  border-radius: 3px;
  overflow: hidden;
}
.ss-sent-fill {
  display: block;
  height: 100%;
  border-radius: 3px;
  transition: width 400ms cubic-bezier(.2,.8,.2,1);
}
.ss-sent-fill.pos { background: #7B9F6E; }
.ss-sent-fill.neu { background: #C9A347; }
.ss-sent-fill.neg { background: #B0492C; }
.ss-sent-num {
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--ink-3);
  text-align: right;
}

/* Sort dropdown menu */
.sort-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--paper);
  border: 1px solid var(--paper-3);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(35, 30, 24, 0.12);
  min-width: 180px;
  padding: 4px;
  z-index: 20;
  display: flex;
  flex-direction: column;
}
.sort-menu-item {
  text-align: left;
  background: none;
  border: 0;
  padding: 7px 10px;
  font-size: 12.5px;
  color: var(--ink-2);
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--sans);
}
.sort-menu-item:hover { background: var(--paper-2); }
.sort-menu-item.on { background: var(--ink); color: var(--paper); }

/* Mid-width tweak: tighter sidebar at small desktops */
@media (min-width: 880px) and (max-width: 1100px) {
  .charts-layout { grid-template-columns: 240px 1fr; }
  .charts-content { padding: 22px 22px 60px; }
}
