/* Chism Bros. Painting survey — blue-first theme taken from the CBP logo.
   Brand: blue #0079c1 (primary/interactive), orange #f89828 and green
   #6db33f as accents, black/gray for text. Red is used only for errors. */
:root {
  --cb-blue: #0079c1;
  --cb-blue-dark: #00609a;
  --cb-blue-deep: #004c7a;
  --cb-orange: #f89828;
  --cb-green: #6db33f;
  --cb-red: #c0392b;
  --cb-black: #1a1a1a;
  --cb-gray: #6f6f6e;
  --bg: #f1f6f9;
  --card: #ffffff;
  --line: #dfe6ea;
  --shadow: 0 1px 2px rgba(0, 60, 90, .06), 0 4px 14px rgba(0, 60, 90, .07);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Libre Franklin', 'Franklin Gothic Medium', Arial, sans-serif;
  background: var(--bg);
  color: var(--cb-black);
  -webkit-font-smoothing: antialiased;
}

/* ------------------------------------------------ header + progress */

.topbar { position: sticky; top: 0; z-index: 10; }

.site-header {
  background: linear-gradient(135deg, var(--cb-blue), var(--cb-blue-dark));
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.logo-chip {
  background: #fff;
  border-radius: 10px;
  padding: 5px 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .18);
  line-height: 0;
}
.logo-chip img { height: 38px; width: auto; display: inline-block; }
.brand { font-weight: 800; font-size: 17px; letter-spacing: .02em; color: #fff; }
.brand span { color: var(--cb-orange); }
.progress-strip {
  background: #fff;
  padding: 10px 16px 9px;
  box-shadow: 0 3px 10px rgba(0, 60, 90, .1);
}
.progress-strip .bar {
  height: 10px;
  border-radius: 999px;
  background: #e4ecf1;
  overflow: hidden;
}
.progress-strip .fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cb-green), #8cc63f);
  box-shadow: 0 0 6px rgba(109, 179, 63, .5);
  transition: width .5s ease;
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-top: 6px;
  font-size: 13px;
}
#progress-pct { font-weight: 800; color: var(--cb-blue-dark); }
#progress-msg { font-weight: 600; color: var(--cb-gray); text-align: right; }

/* ------------------------------------------------------------ layout */

.container { max-width: 680px; margin: 0 auto; padding: 24px 16px 70px; }
.loading { color: var(--cb-gray); text-align: center; padding: 40px 0; }

.stage-enter { animation: fadeUp .35s ease both; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

h1 { font-size: 26px; font-weight: 800; margin: 8px 0 6px; line-height: 1.2; }
h1::after {
  content: '';
  display: block;
  width: 52px;
  height: 4px;
  margin-top: 10px;
  background: var(--cb-orange);
  border-radius: 2px;
}
h2 { font-size: 20px; font-weight: 800; margin: 0 0 6px; }
.intro { color: var(--cb-gray); font-size: 15px; line-height: 1.55; margin: 14px 0 18px; }
.intro strong { color: var(--cb-black); }
.scale-note {
  background: var(--card);
  border-left: 4px solid var(--cb-blue);
  box-shadow: var(--shadow);
  padding: 12px 16px;
  border-radius: 10px;
  font-weight: 700;
  line-height: 1.5;
  margin: 16px 0 0;
}

.card {
  background: var(--card);
  border: 1px solid transparent;
  border-left: 4px solid transparent;
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 18px 16px 18px 15px;
  margin-bottom: 16px;
  transition: border-color .2s;
}
.card.answered { border-left-color: var(--cb-blue); }
.q-label { font-weight: 600; font-size: 16px; line-height: 1.45; margin-bottom: 12px; }
.q-num { color: var(--cb-orange); font-weight: 800; margin-right: 6px; }

/* 1–10 rating buttons: one row, left to right */
.scale { display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px; }
@media (max-width: 480px) { .scale { gap: 3px; } }
.scale button {
  font: inherit;
  font-weight: 600;
  font-size: 15px;
  padding: 12px 0;
  min-height: 48px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--cb-black);
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .08s;
}
.scale button:hover { border-color: var(--cb-blue); }
.scale button:active { transform: scale(.95); }
.scale button.selected {
  background: var(--cb-blue);
  border-color: var(--cb-blue);
  color: #fff;
  box-shadow: 0 3px 8px rgba(0, 121, 193, .4);
}
.scale-ends {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--cb-gray);
  margin-top: 8px;
}

textarea, .search-box input {
  width: 100%;
  font: inherit;
  font-size: 16px;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fff;
  transition: border-color .15s;
}
textarea { min-height: 110px; resize: vertical; }
textarea.compact { min-height: 58px; resize: none; overflow: hidden; }
textarea:focus, .search-box input:focus,
.scale button:focus-visible, .yn button:focus-visible {
  outline: 2px solid var(--cb-blue-dark);
  outline-offset: 1px;
}

/* employee search + counter (page 2) — stays pinned below the header
   while scrolling the roster. --topbar-h is measured by app.js. */
.search-box {
  position: sticky;
  top: var(--topbar-h, 104px);
  z-index: 5;
  background: var(--bg);
  padding: 8px 0 10px;
  margin-bottom: 6px;
}
.search-box input { padding-left: 40px; border-radius: 999px; }
.search-box::before {
  content: '';
  position: absolute;
  left: 15px; top: 50%;
  width: 15px; height: 15px;
  transform: translateY(-58%);
  background: no-repeat center / contain
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236f6f6e' stroke-width='3'%3E%3Ccircle cx='10' cy='10' r='7'/%3E%3Cpath d='m21 21-6-6'/%3E%3C/svg%3E");
}
.selected-count {
  display: inline-block;
  font-weight: 700;
  font-size: 13px;
  color: var(--cb-gray);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  margin: 8px 0 14px;
}
.selected-count.has-some { border-color: var(--cb-blue); color: var(--cb-blue-dark); }

/* employee checkbox cards: one per row, grouped under letter headers */
.emp-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
.letter-head {
  font-weight: 800;
  font-size: 14px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--cb-blue-dark);
  margin: 16px 2px 2px;
  padding-bottom: 4px;
  border-bottom: 2px solid rgba(0, 121, 193, .25);
}
.emp-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1.5px solid transparent;
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 12px 14px;
  min-height: 50px;
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  line-height: 1.3;
  user-select: none;
  transition: border-color .15s, background .15s, transform .08s;
}
.emp-card:hover { border-color: var(--line); }
.emp-card:active { transform: scale(.98); }
.emp-card input { width: 22px; height: 22px; accent-color: var(--cb-blue); flex-shrink: 0; margin: 0; }
.emp-card.checked { border-color: var(--cb-blue); background: #eef8fd; }

/* yes/no pills */
.yn { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.yn button {
  font: inherit;
  font-weight: 700;
  font-size: 16px;
  min-height: 52px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .08s;
}
.yn button:active { transform: scale(.97); }
.yn button.yes:hover { border-color: var(--cb-blue); }
.yn button.no:hover { border-color: var(--cb-black); }
.yn button.yes.selected { background: var(--cb-blue); border-color: var(--cb-blue); color: #fff; box-shadow: 0 3px 8px rgba(0, 121, 193, .4); }
.yn button.no.selected { background: var(--cb-black); border-color: var(--cb-black); color: #fff; box-shadow: 0 3px 8px rgba(26, 26, 26, .3); }

/* coworker name callout on pages 3 and 4 */
.cw-head { margin-bottom: 10px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.cw-highlight {
  display: inline-block;
  font-weight: 800;
  font-size: 17px;
  color: var(--cb-black);
  background: linear-gradient(transparent 45%, rgba(248, 152, 40, .4) 45%);
  padding: 1px 4px;
  border-radius: 4px;
}

.decision-tag {
  display: inline-block;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: .05em;
  border-radius: 6px;
  padding: 3px 10px;
  color: #fff;
}
.decision-tag.yes { background: var(--cb-blue); }
.decision-tag.no { background: var(--cb-black); }
.card .why-q { margin: 6px 0 10px; }

/* dictation (speech-to-text) button on text boxes */
.ta-wrap { position: relative; }
.ta-wrap textarea { padding-right: 54px; }
.mic-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: border-color .15s, background .15s;
}
.mic-btn svg { width: 18px; height: 18px; stroke: var(--cb-gray); fill: none; stroke-width: 2; }
.mic-btn:hover { border-color: var(--cb-blue); }
.mic-btn:hover svg { stroke: var(--cb-blue); }
.mic-btn.listening {
  background: var(--cb-orange);
  border-color: var(--cb-orange);
  animation: pulse 1.2s ease infinite;
}
.mic-btn.listening svg { stroke: #fff; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(248, 152, 40, .5); }
  50% { box-shadow: 0 0 0 9px rgba(248, 152, 40, 0); }
}

/* ----------------------------------------------------------- buttons */

.btn-primary {
  display: block;
  width: 100%;
  font: inherit;
  font-weight: 700;
  font-size: 17px;
  background: var(--cb-blue);
  color: #fff;
  border: 0;
  border-radius: 12px;
  padding: 16px;
  margin-top: 22px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 121, 193, .35);
  transition: background .15s, transform .08s, box-shadow .15s;
}
.btn-primary:hover:not(:disabled) { background: var(--cb-blue-dark); }
.btn-primary:active:not(:disabled) { transform: scale(.985); }
.btn-primary:disabled {
  background: #a6cbe6;
  box-shadow: none;
  cursor: not-allowed;
}
.btn-secondary {
  display: block;
  width: 100%;
  font: inherit;
  font-weight: 600;
  font-size: 16px;
  background: #fff;
  color: var(--cb-black);
  border: 1.5px solid var(--cb-gray);
  border-radius: 12px;
  padding: 14px;
  margin-top: 14px;
  cursor: pointer;
  transition: border-color .15s, transform .08s;
}
.btn-secondary:hover { border-color: var(--cb-black); }
.btn-note { text-align: center; color: var(--cb-gray); font-size: 13px; margin-top: 10px; }

/* bottom action bar (page 2): Continue is always within thumb's reach */
.sticky-actions {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: #fff;
  box-shadow: 0 -4px 16px rgba(0, 60, 90, .14);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  z-index: 9;
}
.sticky-inner {
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.sticky-inner .selected-count { margin: 0; flex-shrink: 0; }
.sticky-inner .btn-primary { margin-top: 0; flex: 1; padding: 14px; }
.container.has-sticky { padding-bottom: 120px; }

.error-msg {
  background: #fdf0f2;
  border: 1px solid var(--cb-red);
  color: var(--cb-red);
  border-radius: 10px;
  padding: 12px 14px;
  font-weight: 600;
  margin-top: 14px;
}

/* ------------------------------------------------- goal ring + done */

.goal-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--card);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 14px 16px;
  margin: 0 0 18px;
  text-align: left;
}
.goal-card .ring { width: 76px; height: 76px; flex-shrink: 0; }
.ring circle {
  fill: none;
  stroke-width: 7;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}
.ring .track { stroke: #e4ecf1; }
.ring .meter {
  stroke: var(--cb-blue);
  transition: stroke-dashoffset 1s ease;
}
.ring text {
  font: inherit;
  font-size: 17px;
  font-weight: 800;
  fill: var(--cb-black);
}
.goal-text { font-size: 14px; line-height: 1.5; color: var(--cb-gray); }
.goal-text strong { color: var(--cb-black); display: block; margin-bottom: 2px; }

.done-wrap { text-align: center; padding: 48px 0 24px; }
.done-wrap h1::after { margin-left: auto; margin-right: auto; }
.done-check {
  width: 76px; height: 76px;
  border-radius: 50%;
  background: var(--cb-blue);
  color: #fff;
  font-size: 40px;
  line-height: 76px;
  margin: 0 auto 18px;
  box-shadow: 0 6px 18px rgba(0, 121, 193, .4);
  animation: pop .4s ease both;
}
@keyframes pop {
  from { transform: scale(.4); opacity: 0; }
  60% { transform: scale(1.08); }
  to { transform: scale(1); opacity: 1; }
}

/* ---------------------------------------------- language switch (EN / ES) */

.lang-switch {
  display: inline-flex;
  background: rgba(255, 255, 255, .18);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
  flex-shrink: 0;
}
.lang-switch button {
  font: inherit;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: .03em;
  color: #fff;
  background: transparent;
  border: 0;
  border-radius: 999px;
  padding: 7px 12px;
  min-width: 44px;
  cursor: pointer;
}
.lang-switch button[aria-pressed="true"] { background: #fff; color: var(--cb-blue-dark); }
.lang-switch button:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }

/* Language picker card at the top of Page 1 */
.lang-card {
  background: var(--card);
  border-radius: 14px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--cb-green);
  padding: 14px 16px;
  margin: 16px 0 0;
}
.lang-card .lang-q { font-weight: 700; font-size: 15px; line-height: 1.45; margin-bottom: 10px; }
.lang-card .yn button.selected { background: var(--cb-blue); border-color: var(--cb-blue); color: #fff; }

/* Narrow phones: keep the wide CBP logo and the EN/ES switch on one line. */
@media (max-width: 420px) {
  .site-header { padding: 10px 12px; }
  .logo-chip { padding: 5px 9px; }
  .logo-chip img { height: 28px; }
  .lang-switch button { padding: 7px 10px; min-width: 40px; }
}
