:root {
  --ink: #1b2430;
  --muted: #5b6775;
  --line: #d5dbe3;
  --paper: #f6f3ee;
  --card: #ffffff;
  --accent: #1f4e5f;
  --accent-dark: #163944;
  --danger: #8a2b2b;
  --ok: #1f5d3a;
  --focus: #c9a227;
}

* {
  box-sizing: border-box;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
}

main {
  width: min(720px, calc(100% - 32px));
  margin: 48px auto;
}

.admin-page .admin-main {
  width: min(960px, calc(100% - 32px));
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 8px 24px rgba(27, 36, 48, 0.04);
}

h1 {
  margin: 0 0 8px;
  font-size: 1.6rem;
  letter-spacing: -0.02em;
}

.brand-header {
  display: grid;
  justify-items: center;
  gap: 14px;
  margin: -4px 0 24px;
  padding: 4px 0 18px;
  border-bottom: 1px solid var(--line);
  text-align: center;
  background: #fff;
}

.brand-lockup {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  width: min(100%, 560px);
  overflow: visible;
}

.brand-imss-logo {
  width: 140px;
  height: auto;
  display: block;
  flex-shrink: 0;
}

.brand-caice-text {
  color: #025f5c;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 800;
  font-size: clamp(2.6rem, 8vw, 3.8rem);
  letter-spacing: 0.06em;
  line-height: 1;
}

.brand-caice-name {
  margin: 0;
  color: var(--accent-dark);
  font-weight: 700;
  line-height: 1.35;
  max-width: 28rem;
}

.intro-kicker {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.welcome-letter {
  margin: 20px 0 24px;
}

.welcome-letter p {
  margin: 0 0 14px;
  line-height: 1.6;
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
}

.welcome-letter p:last-child {
  margin-bottom: 0;
}

.welcome-letter strong {
  font-weight: 700;
}

.consent-prompt {
  margin: 0 0 14px;
  font-weight: 700;
  color: var(--accent-dark);
}

.consent-actions {
  display: grid;
  gap: 10px;
}

.section-kicker {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 0.92rem;
  font-weight: 700;
}

@media (max-width: 560px) {
  .brand-lockup {
    gap: 14px;
  }

  .brand-imss-logo {
    width: 112px;
  }
}

.lead,
.note,
.error,
.ok {
  margin: 0 0 20px;
}

.survey-intro {
  margin-bottom: 24px;
}

.intro-opening {
  margin-bottom: 16px;
  padding: 18px 20px;
  background: #1b2430;
  color: #fff;
  border-radius: 12px;
  line-height: 1.55;
  font-size: 1rem;
}

.intro-block {
  background: #f0f4f7;
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 12px;
  padding: 18px 20px;
}

.intro-heading {
  margin: 0 0 12px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent-dark);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.intro-block p {
  margin: 0 0 12px;
  color: var(--ink);
  line-height: 1.55;
}

.intro-block p:last-child {
  margin-bottom: 0;
}

.lead {
  color: var(--muted);
}

.note {
  color: var(--muted);
  font-size: 0.95rem;
}

.error {
  color: var(--danger);
}

.ok {
  color: var(--ok);
}

#thanks button {
  margin-top: 4px;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
}

input[type="text"],
input[type="password"],
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  font: inherit;
  background: #fff;
}

input:focus,
textarea:focus,
button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

.welcome-note {
  margin: 0 0 20px;
  padding: 14px 16px;
  background: #eef5f7;
  border-radius: 12px;
  color: var(--accent-dark);
  font-weight: 600;
  line-height: 1.5;
}

.survey-progress {
  margin: 0 0 24px;
  padding: 16px 18px;
  background: #f8fafb;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.survey-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.survey-progress-head strong {
  color: var(--accent-dark);
  font-size: 1.05rem;
}

.survey-progress-head span {
  color: var(--muted);
  font-size: 0.92rem;
}

.survey-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  margin-top: 8px;
}

.survey-nav button[type="submit"] {
  margin-left: auto;
}

.option-list {
  display: grid;
  gap: 10px;
}

.option-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  background: #fff;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.option-card:hover {
  border-color: #b8c9d1;
  background: #fafcfd;
}

.option-card:has(input:checked) {
  border-color: var(--accent);
  background: #eef5f7;
  box-shadow: 0 0 0 1px rgba(31, 78, 95, 0.08);
}

.option-card input {
  margin-top: 3px;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

.option-card-text {
  line-height: 1.45;
}

.selection-counter {
  margin: 0 0 12px;
  font-weight: 600;
  color: var(--accent-dark);
  font-size: 0.92rem;
}

.selection-counter.is-complete {
  color: #1f6b4a;
}

.multichoice-notice {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #c9a227;
  border-left: 5px solid #c9a227;
  background: #fff8e1;
  color: #5c4a00;
  font-size: 0.95rem;
  line-height: 1.45;
}

.multichoice-notice strong {
  font-weight: 700;
}

.section-title {
  margin: 0 0 20px;
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  border-left: 5px solid var(--focus);
  border-radius: 12px;
  padding: 14px 18px;
  line-height: 1.4;
  box-shadow: 0 4px 14px rgba(31, 78, 95, 0.18);
}

.section-title:first-child {
  margin-top: 0;
}

.survey-step.hidden {
  display: none;
}

.question-block {
  margin-bottom: 24px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.question-block:last-child {
  border-bottom: 0;
  margin-bottom: 0;
}

.question-text label {
  font-weight: 700;
  line-height: 1.45;
}

legend {
  font-weight: 700;
  margin-bottom: 10px;
  line-height: 1.45;
  color: var(--ink);
}

.hint {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

.other-input {
  margin: 4px 0 12px 28px;
  max-width: calc(100% - 28px);
}

.observations-label {
  display: block;
  margin: 16px 0 8px;
  font-weight: 600;
}

.observations-input {
  width: 100%;
  margin: 0;
}

.option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 8px 0;
}

button {
  appearance: none;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  padding: 12px 18px;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

button.secondary {
  background: #fff;
  color: var(--accent);
  border: 1px solid var(--line);
}

button.secondary:hover {
  background: #f8fafb;
}

button.danger {
  background: #fff;
  color: #9b1c1c;
  border: 1px solid #f3c4c4;
}

button.danger:hover {
  background: #fdf2f2;
}

.hidden,
[hidden] {
  display: none !important;
}

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

.stat {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}

.stat strong {
  display: block;
  font-size: 1.8rem;
}

.response-list {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

.response-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
}

.response-card summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  font-size: 1.05rem;
  font-weight: 700;
  user-select: none;
}

.response-card summary::-webkit-details-marker {
  display: none;
}

.response-card summary::after {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.response-card[open] summary::after {
  transform: rotate(-135deg);
}

.response-card[open] summary {
  border-bottom: 1px solid var(--line);
}

.response-card dl {
  margin: 0;
  padding: 14px 16px 16px;
  display: grid;
  gap: 10px;
}

.response-card dt {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 2px;
}

.response-card dd {
  margin: 0;
}

.admin-form {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.progress-block {
  margin-bottom: 24px;
}

.progress-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.progress-head strong {
  font-size: 1.4rem;
}

.progress-track {
  height: 12px;
  border-radius: 999px;
  background: #e8edf2;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), #2d6f84);
  transition: width 0.3s ease;
}

.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.list-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin: 28px 0 12px;
}

.list-toolbar h2 {
  margin: 0;
  font-size: 1.15rem;
}

.pager {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.active-tickets-block {
  margin: 28px 0;
}

.active-tickets-block h2 {
  margin: 0 0 8px;
  font-size: 1.15rem;
}

.active-tickets-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.active-ticket {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
}

.active-ticket strong {
  font-size: 1rem;
  font-family: "IBM Plex Mono", "SF Mono", "Courier New", monospace;
  letter-spacing: 0.06em;
}

.active-ticket .note {
  margin: 0;
  text-align: right;
}

.active-ticket .release-code-btn {
  padding: 6px 12px;
  font-size: 0.9rem;
}

.blocked-codes-block {
  margin: 28px 0;
}

.blocked-codes-block h2 {
  margin: 0 0 8px;
  font-size: 1.15rem;
}

.blocked-codes-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.blocked-code {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  background: color-mix(in srgb, var(--line) 25%, #fff);
}

.blocked-code strong {
  font-family: "IBM Plex Mono", "SF Mono", "Courier New", monospace;
  letter-spacing: 0.06em;
}

.blocked-code .note {
  margin: 0;
}

.analytics-block {
  margin: 28px 0;
}

.analytics-root {
  display: grid;
  gap: 16px;
}

.overview-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 16px;
  display: grid;
  gap: 18px;
  background: #fff;
}

.overview-head h3,
.overview-panel h4,
.highlight-card h4,
.analytics-detail-title {
  margin: 0 0 6px;
}

.overview-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.overview-kpi {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  display: grid;
  gap: 4px;
}

.overview-kpi span {
  color: var(--muted);
  font-size: 0.85rem;
}

.overview-kpi strong {
  font-size: 1.6rem;
  color: var(--accent-dark);
}

.overview-panel {
  display: grid;
  gap: 10px;
}

.sentiment-stack {
  display: flex;
  width: 100%;
  height: 16px;
  border-radius: 999px;
  overflow: hidden;
  background: color-mix(in srgb, var(--line) 70%, #fff);
}

.sentiment-fill {
  height: 100%;
  min-width: 0;
}

.sentiment-fill.favorable {
  background: #2f7d4a;
}

.sentiment-fill.neutral {
  background: #c4a035;
}

.sentiment-fill.unfavorable {
  background: #b4453a;
}

.sentiment-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  font-size: 0.85rem;
  color: var(--muted);
}

.sentiment-legend .dot {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

.sentiment-legend .dot.favorable {
  background: #2f7d4a;
}

.sentiment-legend .dot.neutral {
  background: #c4a035;
}

.sentiment-legend .dot.unfavorable {
  background: #b4453a;
}

.pulse-list {
  display: grid;
  gap: 14px;
}

.pulse-row {
  display: grid;
  gap: 8px;
}

.pulse-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.pulse-label .note {
  margin: 0;
}

.highlight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.highlight-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}

.bar-chart.compact {
  gap: 8px;
}

.bar-chart.compact .bar-label {
  font-size: 0.8rem;
}

.analytics-detail {
  display: grid;
  gap: 12px;
}

.analytics-section,
.analytics-question {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.analytics-section > summary,
.analytics-question > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  user-select: none;
}

.analytics-section > summary {
  font-size: 1.05rem;
  font-weight: 700;
}

.analytics-question > summary {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.35;
}

.analytics-section > summary::-webkit-details-marker,
.analytics-question > summary::-webkit-details-marker {
  display: none;
}

.analytics-section > summary::after,
.analytics-question > summary::after {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  margin-top: 0.35rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.analytics-section[open] > summary::after,
.analytics-question[open] > summary::after {
  transform: rotate(-135deg);
}

.analytics-questions {
  display: grid;
  gap: 10px;
  padding: 0 12px 12px;
}

.analytics-body {
  padding: 0 16px 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.bar-chart {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(80px, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.bar-label {
  font-size: 0.88rem;
  line-height: 1.3;
}

.bar-track {
  height: 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line) 70%, #fff);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent, #1f4b7a);
  min-width: 0;
  transition: width 0.25s ease;
}

.bar-meta {
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
  text-align: right;
  min-width: 4.5rem;
}

.comment-list {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 8px;
}

.comment-list li {
  line-height: 1.4;
}

@media (max-width: 720px) {
  .bar-row {
    grid-template-columns: 1fr auto;
  }

  .bar-track {
    grid-column: 1 / -1;
    order: 3;
  }
}
