:root {
  --green: #087d45;
  --green-dark: #075934;
  --yellow: #f7d521;
  --red: #e4272c;
  --blue: #0b79a5;
  --ink: #17201b;
  --muted: #68756f;
  --line: #dce5df;
  --surface: #ffffff;
  --bg: #f5f8f6;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

button,
input,
select,
textarea {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px clamp(16px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.brand img {
  width: 54px;
  height: 70px;
  object-fit: contain;
}

.brand p,
.kicker {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.15;
}

.tabs {
  display: flex;
  gap: 8px;
}

.tab,
.small,
.secondary,
.danger,
.primary {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 700;
}

.small {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
}

.tab {
  color: var(--green-dark);
  background: #fff;
}

.tab.is-active,
.primary {
  color: #fff;
  border-color: var(--green);
  background: var(--green);
}

.secondary {
  color: var(--green-dark);
  background: #fff;
}

.danger {
  color: #fff;
  border-color: var(--red);
  background: var(--red);
}

main {
  width: min(1160px, calc(100% - 32px));
  margin: 28px auto 56px;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.hero {
  display: grid;
  grid-template-columns: 1fr minmax(150px, 240px);
  align-items: center;
  gap: 28px;
  padding: clamp(22px, 4vw, 42px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(8, 125, 69, 0.94), rgba(7, 89, 52, 0.88)),
    linear-gradient(90deg, var(--green), var(--yellow));
  color: #fff;
}

.hero h2,
.section-head h2 {
  margin: 0;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.05;
  letter-spacing: 0;
}

.hero p {
  max-width: 680px;
  font-size: 17px;
  line-height: 1.6;
}

.hero .kicker {
  color: var(--yellow);
}

.hero-logo {
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  filter: drop-shadow(0 16px 28px rgba(0, 0, 0, 0.25));
}

.panel {
  margin-top: 18px;
  padding: clamp(18px, 3vw, 28px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.muted,
.empty {
  color: var(--muted);
  line-height: 1.5;
}

.is-hidden {
  display: none !important;
}

.login-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  gap: 28px;
  align-items: center;
}

.qr-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 22px;
  align-items: center;
}

.qr-panel h3 {
  margin: 0 0 8px;
  font-size: 24px;
}

.qr-link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 14px;
}

.warning-text {
  margin: 10px 0 0;
  color: #8a5d00;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
}

.qr-code {
  display: grid;
  width: 188px;
  height: 188px;
  padding: 10px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.qr-code img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.login-panel h2 {
  margin: 0;
  font-size: 32px;
}

.login-form,
.inline-form,
.password-form,
.report-controls {
  display: grid;
  gap: 14px;
}

.password-form {
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  align-items: end;
}

.small-note {
  margin: 12px 0 0;
  font-size: 13px;
}

.inline-form {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  margin-bottom: 16px;
}

.report-controls {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

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

.form-section,
.instruction {
  margin-bottom: 16px;
}

.instruction {
  margin-top: 20px;
  padding: 14px 16px;
  border-left: 4px solid var(--yellow);
  border-radius: 8px;
  background: #fbf8df;
}

.instruction p:last-child {
  margin: 0;
  color: var(--ink);
  line-height: 1.5;
}

label {
  display: grid;
  gap: 8px;
  color: var(--green-dark);
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #c9d6ce;
  border-radius: 8px;
  padding: 12px 13px;
  color: var(--ink);
  background: #fff;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(247, 213, 33, 0.36);
  border-color: var(--green);
}

.questions {
  display: grid;
  gap: 14px;
  margin: 20px 0;
}

.question {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

.question-title {
  margin: 0;
  font-weight: 800;
}

.question-title span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}

.question-section {
  margin: 8px 0 0;
  color: var(--green-dark);
  font-size: 18px;
}

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

.rating input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.rating span {
  display: grid;
  min-height: 42px;
  place-items: center;
  font-weight: 800;
}

.rating-choice {
  position: relative;
  display: grid;
  gap: 4px;
  min-height: 76px;
  padding: 8px;
  place-items: center;
  border: 1px solid #c9d6ce;
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  text-align: center;
}

.rating-choice small {
  min-height: 32px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
}

.rating-choice:has(input:checked) {
  color: var(--ink);
  border-color: var(--yellow);
  background: var(--yellow);
}

.rating-choice:has(input:checked) small {
  color: var(--ink);
}

.full {
  margin-top: 8px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.actions.compact {
  align-items: center;
  margin-top: 0;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.stats article,
.status-grid article {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.stats span,
.status-grid span {
  display: block;
  color: var(--muted);
  font-weight: 700;
}

.stats strong,
.status-grid strong {
  display: block;
  margin-top: 10px;
  font-size: 32px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.status-grid strong {
  color: var(--green-dark);
  font-size: 22px;
  line-height: 1.25;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 18px;
}

.bars {
  display: grid;
  gap: 14px;
}

.bar-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  font-weight: 700;
}

.bar-label em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 600;
}

.track {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8efea;
}

.fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--yellow));
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

.compact-table {
  min-width: 420px;
}

.report-panel {
  background: #fff;
}

.report-summary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
}

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

th {
  color: var(--green-dark);
  background: #f0f6f2;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: none;
  max-width: min(360px, calc(100% - 36px));
  padding: 14px 16px;
  border-radius: 8px;
  color: #fff;
  background: var(--green-dark);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.2);
}

.toast.is-visible {
  display: block;
}

@media (max-width: 760px) {
  .topbar,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .tabs {
    width: 100%;
  }

  .tab {
    flex: 1;
  }

  .hero,
  .form-grid,
  .login-panel,
  .qr-panel,
  .qr-link-row,
  .inline-form,
  .password-form,
  .report-controls,
  .admin-grid,
  .status-grid,
  .stats {
    grid-template-columns: 1fr;
  }

  .hero-logo {
    max-width: 180px;
    justify-self: center;
  }

  .qr-code {
    justify-self: center;
  }

  .rating {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media print {
  body {
    background: #fff;
  }

  .topbar,
  .toast,
  .no-print,
  #surveyView,
  #adminLoginPanel,
  #adminPanel > :not(#reportArea) {
    display: none !important;
  }

  main {
    width: 100%;
    margin: 0;
  }

  .view,
  .view.is-active,
  #adminPanel {
    display: block !important;
  }

  .panel,
  .stats article {
    border: 0;
    box-shadow: none;
  }

  table {
    min-width: 0;
    font-size: 12px;
  }
}
