:root {
  --bg: #f5f7f6;
  --panel: #ffffff;
  --panel-soft: #f8faf9;
  --line: #dfe7e2;
  --line-strong: #c9d6cf;
  --text: #10251c;
  --muted: #64736c;
  --brand: #00b956;
  --brand-dark: #008c42;
  --brand-soft: #e9f8ef;
  --warning-soft: #fff7e6;
  --danger: #b42318;
  --shadow: 0 12px 30px rgba(16, 37, 28, .07);
  --radius: 18px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at top left, #edf8f1 0, #f5f7f6 340px, #f5f7f6 100%);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Arial, sans-serif;
}

a { color: #087a3c; text-decoration: none; }
a:hover { text-decoration: underline; }

.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 22px 20px 52px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 14px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 4px 9px;
  border: 1px solid #bfe8cf;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.brand h1 {
  margin: 0 0 4px;
  font-size: 26px;
  line-height: 1.16;
  letter-spacing: -.02em;
}

.brand .sub {
  color: var(--muted);
  font-size: 14px;
}

.issue-line {
  margin-top: 5px;
  color: #28483a;
  font-size: 14px;
  font-weight: 800;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  align-items: center;
  max-width: 560px;
}

.archive-select {
  width: 190px;
  min-height: 38px;
  padding-top: 8px;
  padding-bottom: 8px;
}

.button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  padding: 9px 13px;
  border-radius: 12px;
  font-weight: 750;
  cursor: pointer;
  transition: .16s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.button:hover {
  border-color: var(--line-strong);
  box-shadow: 0 8px 20px rgba(16, 37, 28, .08);
  transform: translateY(-1px);
  text-decoration: none;
}

.button:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.button.primary:hover { background: var(--brand-dark); }
.button.ghost { background: transparent; box-shadow: none; color: var(--muted); }
.button.ghost:hover { background: #fff; color: var(--text); }
.button.toggle.on { background: var(--brand-soft); border-color: #bfe8cf; color: #087a3c; }
.button.toggle.off { background: #fff2f1; color: var(--danger); }
.button.wide { width: 100%; margin-top: 12px; }

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 11px;
  border-radius: 999px;
  background: #eef2f0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.status-badge.running { background: #fff7e6; color: #8a5a00; }
.status-badge.ok { background: var(--brand-soft); color: var(--brand-dark); }
.status-badge.error { background: #fff2f1; color: var(--danger); }

.filters { margin-bottom: 14px; }

.meta-strip { display: none !important; }

.filter-panel {
  background: rgba(255, 255, 255, .92);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px;
  box-shadow: var(--shadow);
}

.filter-main-row {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(160px, 220px) auto auto;
  gap: 8px;
  align-items: center;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 8px;
}

.advanced-filters {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.advanced-filters[hidden] {
  display: none !important;
}

.filter-toggle {
  height: 40px;
  white-space: nowrap;
}

.filter-toggle::after {
  content: "▾";
  margin-left: 8px;
  font-size: 11px;
}

.filter-toggle[aria-expanded="true"]::after { content: "▴"; }
.filter-toggle.active { border-color: #bfe8cf; background: var(--brand-soft); color: var(--brand-dark); }
.new-filter.active { border-color: var(--brand); background: var(--brand); color: #fff; }

.input, .select {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  padding: 0 12px;
  font: inherit;
  outline: none;
}

.input:focus, .select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0, 185, 86, .12);
}

.quick-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.tag {
  border: 1px solid #d8e3dd;
  background: #fff;
  color: #28483a;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.tag:hover { border-color: #b9d8c6; background: var(--brand-soft); }
.tag.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.tag.small { padding: 4px 8px; font-size: 11px; cursor: pointer; }

.results-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 11px;
}

.results-count { color: var(--muted); font-size: 13px; font-weight: 750; }
.results-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.results-actions .button { padding: 8px 11px; font-size: 13px; }
#clearFilters:not([hidden]) { background: var(--brand-soft); border-color: #bfe8cf; color: var(--brand-dark); }

.cards { display: grid; gap: 12px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 4px solid #c6d4cc;
  border-radius: var(--radius);
  box-shadow: 0 8px 22px rgba(16, 37, 28, .055);
  overflow: hidden;
}

.card.is-new {
  border-left-color: var(--brand);
  border-color: #cfe7d9;
}

.card.feedback-positive {
  border-left-color: var(--brand);
}

.card.feedback-negative {
  border-left-color: #e7b2aa;
  background: #fffdfd;
}

.card.feedback-negative .head-main h3 {
  color: #33463d;
}

.card details { padding: 0; }
.card summary { list-style: none; cursor: pointer; }
.card summary::-webkit-details-marker { display: none; }

.card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: flex-start;
  padding: 16px 18px;
}

.kind {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  border-radius: 999px;
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 850;
}

.kind.direct { background: var(--brand-soft); color: var(--brand-dark); }
.kind.orienting { background: #eef2f4; color: #52616b; }

.kind-text {
  font-weight: 850;
  color: #52616b;
}

.kind-text.direct { color: var(--brand-dark); }

.head-main h3 {
  margin: 0 0 5px;
  font-size: 18px;
  line-height: 1.28;
  letter-spacing: -.01em;
}

.new-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin: 0 8px 2px 0;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.new-inline {
  display: inline-block;
  margin-right: 8px;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.subline {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.head-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.open-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding-top: 5px;
}

.card[open] .open-label,
.card details[open] .open-label { color: var(--brand-dark); }

.card-body {
  border-top: 1px solid var(--line);
  padding: 16px 18px 18px;
  background: linear-gradient(180deg, #fbfdfc 0, #fff 90px);
}

.section-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.section {
  border: 1px solid #e2ebe6;
  border-radius: 14px;
  background: #fff;
  padding: 12px 13px;
}

.section:nth-child(3) {
  background: var(--brand-soft);
  border-color: #c7ecd5;
}

.section .label,
.refs .label {
  color: var(--brand-dark);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 6px;
}

.section .text { color: #21392f; }

.feedback-block {
  display: grid;
  gap: 9px;
  margin-top: 12px;
}

.feedback-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.feedback-btn {
  border: 1px solid #d8e3dd;
  background: #fff;
  color: #28483a;
  border-radius: 999px;
  padding: 7px 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.feedback-btn:hover {
  border-color: #b9d8c6;
  background: var(--brand-soft);
}

.feedback-btn.active.good {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.feedback-btn.active.bad {
  background: #fff2f1;
  border-color: #f0b8b2;
  color: var(--danger);
}

.feedback-btn.clear {
  color: var(--muted);
  background: transparent;
}

.feedback-btn.clear:hover {
  background: #eef2f0;
  border-color: var(--line-strong);
  color: var(--text);
}

.feedback-reasons {
  margin-left: auto;
  width: min(560px, 100%);
  border: 1px solid #f0d6d2;
  background: #fffafa;
  border-radius: 14px;
  padding: 10px;
}

.feedback-reasons[hidden] {
  display: none !important;
}

.reason-caption {
  color: var(--danger);
  font-size: 12px;
  font-weight: 850;
  margin-bottom: 8px;
}

.reason-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: flex-end;
}

.reason-btn {
  border: 1px solid #edd1cd;
  background: #fff;
  color: #72302a;
  border-radius: 999px;
  padding: 6px 9px;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.reason-btn:hover,
.reason-btn.active {
  background: #fff2f1;
  border-color: #eaa6a0;
  color: var(--danger);
}

.refs {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.refs ol { margin: 6px 0 0; padding-left: 20px; }
.refs li { margin: 4px 0; color: var(--muted); }

.empty {
  background: var(--panel);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 28px;
  color: var(--muted);
  text-align: center;
  font-weight: 750;
}

.footer-note {
  margin-top: 18px;
  color: var(--muted);
  font-size: 13px;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-logo {
  display: inline-flex;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 900;
  margin-bottom: 12px;
}

.login-card h1 { margin: 0 0 6px; font-size: 24px; }
.login-card p { margin: 0 0 16px; color: var(--muted); }
.login-error { margin-top: 10px; color: var(--danger); font-weight: 800; }

.survey-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 14px;
  align-items: start;
}

.survey-panel,
.survey-note,
.results-table-wrap,
.summary-tile {
  background: rgba(255, 255, 255, .94);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.survey-panel { padding: 18px; }

.survey-side {
  display: grid;
  gap: 12px;
}

.survey-note { padding: 15px; }

.survey-note-title,
.field-label,
.section-title {
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.survey-note-text {
  color: var(--muted);
  margin-top: 7px;
}

.survey-form {
  display: grid;
  gap: 10px;
}

.field-label-spaced { margin-top: 8px; }

.survey-hint {
  color: var(--muted);
  font-size: 13px;
  margin-top: -4px;
}

.survey-input,
.survey-textarea {
  width: 100%;
}

.survey-textarea {
  min-height: 120px;
  resize: vertical;
}

.survey-check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.survey-check {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  min-height: 54px;
  padding: 11px 12px;
  border: 1px solid #d8e3dd;
  border-radius: 14px;
  background: #fff;
  color: #21392f;
  font-weight: 750;
  cursor: pointer;
}

.survey-check:hover {
  border-color: #b9d8c6;
  background: var(--brand-soft);
}

.survey-check input {
  width: 17px;
  height: 17px;
  margin-top: 3px;
  accent-color: var(--brand);
}

.survey-submit {
  width: fit-content;
  margin-top: 4px;
}

.survey-success,
.survey-error {
  border-radius: 14px;
  padding: 11px 12px;
  margin-bottom: 12px;
  font-weight: 800;
}

.survey-success {
  background: var(--brand-soft);
  border: 1px solid #bfe8cf;
  color: var(--brand-dark);
}

.survey-error {
  background: #fff2f1;
  border: 1px solid #f0b8b2;
  color: var(--danger);
}

.survey-examples {
  margin-top: 18px;
}

.section-title {
  margin-bottom: 10px;
}

.survey-example-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.survey-example-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px;
  box-shadow: var(--shadow);
}

.survey-example-meta {
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 850;
  margin-bottom: 7px;
}

.survey-example-card h3 {
  margin: 0 0 8px;
  font-size: 17px;
  line-height: 1.28;
}

.survey-example-card p {
  color: #28483a;
  margin: 0 0 12px;
}

.tag.inert {
  cursor: default;
  pointer-events: none;
}

.results-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 220px));
  gap: 12px;
  margin-bottom: 14px;
}

.summary-tile {
  padding: 14px;
}

.summary-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.summary-value {
  color: var(--text);
  font-size: 30px;
  font-weight: 900;
  line-height: 1.1;
  margin-top: 4px;
}

.results-table-wrap {
  overflow-x: auto;
}

.responses-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

.responses-table th,
.responses-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.responses-table th {
  color: var(--brand-dark);
  background: var(--panel-soft);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.responses-table tr:last-child td { border-bottom: 0; }
.responses-table td:nth-child(1) { white-space: nowrap; color: var(--muted); }
.responses-table td:nth-child(2) { font-weight: 850; }

@media (max-width: 980px) {
  .topbar { flex-direction: column; }
  .actions { justify-content: flex-start; max-width: none; }
  .filter-main-row, .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #filterSearch { grid-column: 1 / -1; }
  .section-grid { grid-template-columns: 1fr; }
  .survey-layout { grid-template-columns: 1fr; }
  .survey-example-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .page { padding: 16px 12px 36px; }
  .brand h1 { font-size: 22px; }
  .actions, .results-row { flex-direction: column; align-items: stretch; }
  .actions .button, .actions .status-badge, .actions .archive-select { width: 100%; }
  .filter-grid { grid-template-columns: 1fr; }
  .filter-main-row { grid-template-columns: 1fr; }
  .card-head { grid-template-columns: 1fr; gap: 8px; }
  .open-label { display: none; }
  .survey-check-grid,
  .survey-example-grid,
  .results-summary {
    grid-template-columns: 1fr;
  }
  .survey-submit { width: 100%; }
}
