.rail-label {
  margin: 32px 0 10px 8px;
}

.rail-surveys-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 28px 0 8px;
}

.rail-surveys-head .rail-label {
  margin: 0;
  color: #8d9d91;
}

.rail-surveys-head .rail-label small {
  margin-left: 5px;
  color: #b8c2b8;
}

.rail-new-survey {
  padding: 6px 8px;
  border: 1px solid #52675a;
  color: var(--green);
  font-size: 11px;
  white-space: nowrap;
}

.rail-new-survey:hover {
  background: #30453d;
  color: #fff;
}

.rail-surveys {
  display: grid;
  gap: 3px;
  max-height: min(38vh, 350px);
  margin: 0 -8px;
  padding: 0 4px;
  overflow-x: hidden;
  overflow-y: auto;
}

.rail-survey {
  display: flex;
  min-width: 0;
  min-height: 43px;
  align-items: center;
  gap: 9px;
  padding: 6px 9px;
  color: #d7e0d8;
}

.rail-survey:hover,
.rail-survey.active {
  background: #30453d;
}

.rail-survey.active {
  box-shadow: inset 2px 0 var(--green);
}

.rail-survey-status {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: #87958b;
}

.rail-survey-status.live {
  background: var(--green);
}

.rail-survey-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.rail-survey-copy strong {
  overflow: hidden;
  color: #eff2e8;
  font-size: 11px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rail-survey-copy small {
  color: #9eada1;
  font: 9px var(--mono);
}

.rail-survey-empty {
  padding: 9px;
  color: #aebbb1;
  font-size: 11px;
}

.rail-bottom {
  margin-top: auto;
}

.page {
  display: flex;
  flex-direction: column;
}

.page > .content {
  flex: 1 0 auto;
}

.copyright-footer {
  width: 100%;
  border-top: 1px solid var(--line);
  padding: 16px clamp(20px, 5vw, 64px) 18px;
  color: #707a72;
  font-size: 10px;
  line-height: 1.6;
}

.copyright-footer small {
  display: block;
  max-width: 1120px;
  margin: 0 auto;
}

.link-generator textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid #dce1da;
  background: #f7f8f3;
  padding: 9px 10px;
  color: var(--ink);
  font-size: 11px;
  line-height: 1.5;
  outline: none;
}

.link-generator textarea:focus {
  border-color: #849d7a;
  box-shadow: 0 0 0 2px #9cb98a25;
}

.link-name-hint {
  display: block;
  margin-top: -8px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.link-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: -11px 0 14px;
}

.link-action-hint {
  color: var(--muted);
  font-size: 11px;
}

.token-row {
  grid-template-columns: 38px minmax(0, 1fr) 96px;
  gap: 14px;
  padding: 9px 12px;
}

.token-content {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.token-name {
  font-size: 12px;
}

.token-row code.token-url {
  overflow-wrap: anywhere;
  color: #707a72;
  font-size: 10px;
}

.button-copy {
  min-height: 36px;
  border: 1px solid #9fca4e;
  background: var(--green);
  padding: 0 15px;
  color: var(--deep);
  font-size: 12px;
  font-weight: 700;
}

.button-copy:hover,
.button-copy.copied {
  border-color: var(--deep);
  background: var(--deep);
  color: #fff;
}

.copy-all-links {
  min-height: 43px;
}

.copy-all-links span {
  font-size: 15px;
}

.chart-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: -5px 0 15px;
  color: var(--muted);
  font-size: 10px;
}

.chart-toolbar select {
  min-height: 32px;
  border: 1px solid var(--line);
  background: #f7f8f4;
  padding: 0 9px;
  color: var(--ink);
  font-size: 11px;
}

.pie-layout {
  display: grid;
  grid-template-columns: minmax(110px, 160px) minmax(0, 1fr);
  align-items: center;
  gap: 18px;
}

.pie-graphic {
  display: grid;
  width: min(100%, 160px);
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
}

.pie-hole {
  display: grid;
  width: 55%;
  aspect-ratio: 1;
  align-content: center;
  justify-items: center;
  border-radius: 50%;
  background: #fbfcf9;
}

.pie-hole strong {
  font: 600 23px var(--serif);
}

.pie-hole small {
  color: var(--muted);
  font-size: 9px;
}

.pie-legend {
  display: grid;
  gap: 9px;
  min-width: 0;
}

.pie-legend-row {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  font-size: 10px;
}

.pie-legend-row i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.pie-legend-row span {
  overflow-wrap: anywhere;
}

.pie-legend-row strong {
  font: 10px var(--mono);
}

.line-graph {
  display: block;
  width: 100%;
  min-height: 150px;
  overflow: visible;
}

.line-grid {
  stroke: #e4e7e0;
  stroke-width: 1;
}

.line-tick,
.line-label {
  fill: #777f79;
  font-family: var(--mono);
  font-size: 10px;
}

.line-series {
  fill: none;
  stroke: #668c43;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.line-point {
  fill: #e2754f;
  stroke: #fbfcf9;
  stroke-width: 2;
}

.api-key-create {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.api-key-create label {
  flex: 1;
  display: grid;
  gap: 7px;
  margin: 15px 0 0;
  color: #56615a;
  font-size: 11px;
  font-weight: 600;
}

.api-key-create input {
  min-height: 42px;
  border: 1px solid #dce1da;
  background: #fbfcf9;
  padding: 10px 12px;
}

.api-key-list {
  margin-top: 14px;
  border-top: 1px solid var(--line);
}

.api-key-row {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  border-bottom: 1px solid var(--line);
}

.api-key-details {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.api-key-details strong {
  font-size: 12px;
}

.api-key-details span {
  color: var(--muted);
  font-size: 10px;
}

.button-danger-small {
  min-height: 32px;
  border: 1px solid #e7c9bf;
  background: #fbf2ee;
  padding: 0 11px;
  color: #9f4c34;
  font-size: 10px;
}

.button-danger-small:hover {
  border-color: #ce765a;
  background: #f7e5dd;
}

.login-body .content {
  max-width: none;
  padding: 0;
}

.respondent-body .copyright-footer {
  padding-right: 20px;
  padding-left: 20px;
}

@media (max-width: 760px) {
  .rail {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 9px;
    align-items: center;
    padding: 12px 16px;
  }

  .rail .workspace-name {
    grid-column: 1;
    grid-row: 1;
  }

  .rail-nav {
    grid-column: 1;
    grid-row: 2;
    display: flex;
    gap: 3px;
    margin: 0;
    overflow-x: auto;
  }

  .rail-nav a {
    flex: none;
  }

  .rail-surveys-head {
    grid-column: 1;
    grid-row: 3;
    margin: 1px 0 0;
  }

  .rail-surveys-head .rail-label {
    display: block;
  }

  .rail-surveys {
    grid-column: 1;
    grid-row: 4;
    display: flex;
    max-height: none;
    margin: 0;
    padding: 0 0 3px;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .rail-survey {
    min-width: 170px;
    border: 1px solid #40534a;
  }

  .rail-bottom {
    display: none;
  }

  .with-rail {
    margin-left: 0;
  }

  .token-row {
    grid-template-columns: 27px minmax(0, 1fr) 76px;
    gap: 8px;
    padding: 9px 7px;
  }

  .button-copy {
    padding: 0 9px;
    font-size: 11px;
  }

  .pie-layout {
    grid-template-columns: 105px minmax(0, 1fr);
    gap: 12px;
  }

  .api-key-create {
    align-items: stretch;
    flex-direction: column;
  }

  .link-actions {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }
}

@media (max-width: 430px) {
  .rail {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .rail .workspace-name {
    grid-row: 1;
  }

  .rail-nav {
    grid-row: 2;
  }

  .rail-surveys-head {
    grid-row: 3;
  }

  .rail-surveys {
    grid-row: 4;
  }

  .rail-survey {
    min-width: 145px;
  }

  .token-row {
    grid-template-columns: 22px minmax(0, 1fr) 69px;
    gap: 6px;
  }

  .token-row code.token-url {
    font-size: 9px;
  }

  .button-copy {
    padding: 0 7px;
    font-size: 10px;
  }

  .pie-layout {
    grid-template-columns: 105px minmax(0, 1fr);
    gap: 12px;
  }

  .api-key-create {
    align-items: stretch;
    flex-direction: column;
  }
}

/* Results are the primary analysis workspace: keep each chart large and distinct. */
.chart-list {
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
}

.chart-panel {
  min-height: 260px;
  border: 1px solid #cbd3ca;
  background: #fff;
  padding: 28px 30px;
  box-shadow: 0 2px 8px #18211d0a;
}

.chart-heading {
  gap: 15px;
  margin-bottom: 22px;
}

.chart-heading h3 {
  font-size: 20px;
}

.chart-meta {
  font-size: 12px;
}

.chart-toolbar {
  justify-content: flex-start;
  gap: 14px;
  margin: 0 0 18px;
  font-size: 12px;
}

.chart-toolbar select {
  min-width: 150px;
  min-height: 40px;
  padding: 0 12px;
  font-size: 13px;
}

.chart-visual {
  min-height: 165px;
}

.bar-chart {
  gap: 17px;
}

.bar-line {
  grid-template-columns: minmax(130px, 1fr) minmax(120px, 5fr) 44px;
  gap: 14px;
}

.bar-label {
  font-size: 13px;
}

.bar-track {
  height: 13px;
}

.bar-line strong {
  font-size: 12px;
}

.pie-layout {
  grid-template-columns: minmax(190px, 250px) minmax(0, 1fr);
  gap: 30px;
}

.pie-graphic {
  width: min(100%, 250px);
}

.pie-hole strong {
  font-size: 30px;
}

.pie-hole small,
.pie-legend-row {
  font-size: 12px;
}

.pie-legend {
  gap: 12px;
}

.pie-legend-row {
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 10px;
}

.pie-legend-row i {
  width: 10px;
  height: 10px;
}

.pie-legend-row strong {
  font-size: 11px;
}

.line-graph {
  min-height: 280px;
}

.export-panel {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  margin: 0 0 38px;
  border: 1px solid #cbd3ca;
  background: #fff;
  padding: 22px 24px;
  box-shadow: 0 2px 8px #18211d0a;
}

.export-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  background: #eaf1e1;
  color: var(--green-dark);
  font-size: 27px;
}

.export-copy h2 {
  margin: 5px 0;
  font: 600 20px var(--serif);
}

.export-copy p {
  max-width: 650px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.export-button {
  min-height: 46px;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .chart-panel {
    min-height: 0;
    padding: 21px 18px;
  }

  .bar-line {
    grid-template-columns: minmax(80px, 1.1fr) minmax(60px, 3fr) 32px;
    gap: 9px;
  }

  .pie-layout {
    grid-template-columns: minmax(130px, 190px) minmax(0, 1fr);
    gap: 18px;
  }

  .pie-graphic {
    width: min(100%, 190px);
  }

  .line-graph {
    min-height: 230px;
  }

  .export-panel {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 12px;
    padding: 18px;
  }

  .export-icon {
    width: 40px;
    height: 40px;
  }

  .export-button {
    grid-column: 1 / -1;
    width: 100%;
  }
}

@media (max-width: 430px) {
  .chart-panel {
    padding: 18px 14px;
  }

  .chart-heading h3 {
    font-size: 18px;
  }

  .bar-line {
    grid-template-columns: minmax(70px, 1fr) minmax(55px, 1.4fr) 28px;
    gap: 7px;
  }

  .bar-label {
    font-size: 11px;
  }

  .pie-layout {
    grid-template-columns: 115px minmax(0, 1fr);
    gap: 12px;
  }

  .pie-legend-row {
    grid-template-columns: 8px minmax(0, 1fr);
  }

  .pie-legend-row strong {
    grid-column: 2;
  }

  .export-panel {
    grid-template-columns: 1fr;
  }

  .export-icon {
    display: none;
  }
}

/* Demo-mode watermark (enabled with DEMO_MODE=true in .env) */
.demo-watermark{position:fixed;inset:0;z-index:2147483647;pointer-events:none;user-select:none;display:flex;align-items:center;justify-content:center;overflow:hidden}
.demo-watermark span{transform:rotate(-30deg);font:900 clamp(96px,22vw,320px)/1 'Trebuchet MS',Arial,sans-serif;letter-spacing:.08em;color:rgba(200,30,30,.16);white-space:nowrap}
