/* ═══ Design tokens ═══ */
:root {
  --blue: #1a3a6b;
  --blue-l: #2c5aa0;
  --blue-bg: #f0f4fa;
  --green: #28a745;
  --green-bg: #e8f5e9;
  --green-border: #66bb6a;
  --yellow: #f9a825;
  --yellow-bg: #fff8e1;
  --yellow-border: #fdd835;
  --gray: #6c757d;
  --gray-l: #e9ecef;
  --gray-bg: #f8f9fa;
  --red: #dc3545;
  --red-bg: #ffebee;
  --red-border: #ef5350;
  --white: #fff;
  --text: #333;
  --text-light: #666;
  --shadow: 0 1px 4px rgba(0,0,0,.08);
  --shadow-lg: 0 4px 16px rgba(0,0,0,.12);
  --radius: 10px;
  --radius-sm: 6px;
  --max-w: 800px;
}

/* ═══ Reset ═══ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--blue-bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
}

/* ═══ Header ═══ */
.header {
  background: var(--blue);
  color: var(--white);
  padding: 16px 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-lg);
}
.header-inner { max-width: var(--max-w); margin: 0 auto; display: flex; align-items: center; justify-content: space-between; }
.header h1 { font-size: 22px; font-weight: 700; }
.home-btn {
  color: var(--white);
  font-size: 32px;
  text-decoration: none;
  opacity: .8;
  transition: opacity .15s;
  line-height: 1;
}
.home-btn:hover { opacity: 1; }

/* ═══ Layout ═══ */
.container { max-width: var(--max-w); margin: 0 auto; padding: 16px 12px; }
.screen { display: none; }
.screen.active { display: block; }

/* ═══ Card ═══ */
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card h2 { color: var(--blue); font-size: 24px; margin-bottom: 10px; }
.card h3 { color: var(--blue); font-size: 18px; margin: 16px 0 6px; }
.card p { color: var(--text-light); font-size: 17px; margin-bottom: 10px; }
.card ul { padding-left: 20px; font-size: 17px; color: var(--text-light); }
.card li { margin-bottom: 6px; }
.hint { color: var(--gray); font-size: 16px; }
.ps-list a { color: var(--blue-l); font-weight: 600; text-decoration: none; }
.ps-list a:hover { text-decoration: underline; }

/* ═══ Survey hint card ═══ */
.card-hint {
  background: var(--blue-bg);
  border: 2px solid #c8d8ed;
  padding: 16px 20px;
}
.card-hint p { color: var(--text); margin-bottom: 12px; }
.hint-legend { display: flex; flex-direction: column; gap: 6px; }
.hint-item { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--text); }
.hint-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.dot-green { background: var(--green); }
.dot-yellow { background: var(--yellow); }
.dot-red { background: var(--red); }

/* ═══ Search ═══ */
.search-box { position: relative; margin: 16px 0; }
.search-box input {
  width: 100%;
  padding: 16px 18px;
  font-size: 19px;
  border: 2px solid var(--gray-l);
  border-radius: var(--radius);
  outline: none;
  transition: border-color .2s;
}
.search-box input:focus { border-color: var(--blue-l); }

.search-results {
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  background: var(--white);
  border: 2px solid var(--blue-l);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  max-height: 300px;
  overflow-y: auto;
}
.search-results.hidden { display: none; }

.search-item {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--gray-l);
  transition: background .15s;
}
.search-item:hover { background: var(--blue-bg); }
.search-item:last-child { border-bottom: none; }
.search-item-name { font-weight: 600; font-size: 17px; }
.search-item-meta { font-size: 14px; color: var(--gray); margin-top: 2px; }

/* ═══ Selected employee ═══ */
.selected-employee {
  background: var(--green-bg);
  border: 2px solid var(--green-border);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 16px;
  text-align: center;
}
.selected-employee.hidden { display: none; }
.emp-name { font-size: 22px; font-weight: 700; color: var(--blue); }
.emp-meta { margin-top: 6px; }
.emp-position { font-size: 16px; color: var(--text-light); }
.emp-dept {
  display: inline-block;
  background: var(--blue);
  color: var(--white);
  font-size: 14px;
  padding: 3px 10px;
  border-radius: 12px;
  margin-left: 6px;
}

/* ═══ Buttons ═══ */
.btn {
  display: inline-block;
  padding: 12px 28px;
  font-size: 17px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
}
.btn-primary { background: var(--blue); color: var(--white); }
.btn-primary:hover { background: var(--blue-l); }
.btn-primary:disabled { background: var(--gray); cursor: not-allowed; }
.btn-secondary { background: var(--gray-l); color: var(--text); }
.btn-secondary:hover { background: #dee2e6; }
.btn-secondary:disabled { opacity: .5; cursor: not-allowed; }
.btn-lg { padding: 16px 32px; font-size: 19px; margin-top: 16px; width: 100%; }

/* ═══ Progress ═══ */
.progress-bar-container {
  position: sticky;
  top: 60px;
  z-index: 90;
  background: var(--white);
  padding: 10px 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,.06);
}
.progress-bar {
  height: 6px;
  background: var(--gray-l);
  border-radius: 3px;
  overflow: hidden;
  max-width: var(--max-w);
  margin: 0 auto;
}
.progress-fill {
  height: 100%;
  background: var(--green);
  border-radius: 3px;
  transition: width .3s ease;
  width: 0;
}
.progress-text {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: var(--gray);
  max-width: var(--max-w);
  margin: 4px auto 0;
}

/* ═══ Section tabs ═══ */
.survey-nav { margin-bottom: 12px; }
.section-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.section-tab {
  padding: 8px 14px;
  font-size: 14px;
  border: 2px solid var(--gray-l);
  border-radius: 16px;
  background: var(--white);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.section-tab:hover { border-color: var(--blue-l); }
.section-tab.active { background: var(--blue); color: var(--white); border-color: var(--blue); }
.section-tab.complete { border-color: var(--green); color: var(--green); }
.section-tab.complete.active { background: var(--green); color: var(--white); }

/* ═══ Action cards ═══ */
.survey-content { min-height: 200px; }

.section-header {
  background: var(--blue);
  color: var(--white);
  padding: 14px 18px;
  border-radius: var(--radius) var(--radius) 0 0;
  font-size: 18px;
  font-weight: 600;
}
.section-header .ps-ref {
  font-weight: 400;
  font-size: 14px;
  opacity: .7;
  margin-left: 8px;
}

.action-card {
  background: var(--white);
  border-left: 4px solid var(--gray-l);
  padding: 12px 16px;
  margin-bottom: 1px;
  transition: border-color .2s;
}
.action-card:last-child {
  border-radius: 0 0 var(--radius) var(--radius);
  margin-bottom: 16px;
}
.action-card.s-do { border-left-color: var(--green); background: #fafff9; }
.action-card.s-partial { border-left-color: var(--yellow); background: #fffef8; }
.action-card.s-no { border-left-color: var(--red-border); background: #fffafa; }

.action-text {
  font-size: 17px;
  line-height: 1.5;
  margin-bottom: 10px;
}
.action-ref {
  font-size: 13px;
  color: var(--gray);
  margin-bottom: 6px;
}

.action-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.status-btn {
  padding: 10px 20px;
  font-size: 16px;
  font-weight: 500;
  border: 2px solid var(--gray-l);
  border-radius: 20px;
  background: var(--white);
  cursor: pointer;
  transition: all .15s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.status-btn:active { transform: scale(.96); }

.status-btn.do-btn:hover, .status-btn.do-btn.active {
  border-color: var(--green);
  background: var(--green-bg);
  color: #1b5e20;
}
.status-btn.partial-btn:hover, .status-btn.partial-btn.active {
  border-color: var(--yellow-border);
  background: var(--yellow-bg);
  color: #f57f17;
}
.status-btn.no-btn:hover, .status-btn.no-btn.active {
  border-color: var(--red-border);
  background: var(--red-bg);
  color: #c62828;
}

/* ═══ Nav buttons ═══ */
.nav-buttons {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  gap: 12px;
}
.nav-info { font-size: 16px; color: var(--gray); }

/* ═══ Comments ═══ */
.field-label {
  display: block;
  font-weight: 600;
  color: var(--blue);
  font-size: 17px;
  margin: 20px 0 8px;
}
textarea {
  width: 100%;
  padding: 12px 16px;
  font-size: 17px;
  font-family: inherit;
  border: 2px solid var(--gray-l);
  border-radius: var(--radius-sm);
  resize: vertical;
  outline: none;
  transition: border-color .2s;
}
textarea:focus { border-color: var(--blue-l); }

/* ═══ Done ═══ */
.card-done { text-align: center; padding: 40px 24px; }
.done-icon {
  width: 64px; height: 64px;
  background: var(--green);
  color: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin: 0 auto 16px;
}
.done-stats {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin: 20px 0;
}
.done-stat { text-align: center; }
.done-stat b { display: block; font-size: 28px; }
.done-stat span { font-size: 12px; color: var(--gray); }

/* ═══ Toast ═══ */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--green);
  color: var(--white);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  transform: translateY(80px);
  opacity: 0;
  transition: all .3s;
  z-index: 200;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { background: var(--red); }

/* ═══ Responsive ═══ */
@media (max-width: 600px) {
  .header h1 { font-size: 19px; }
  .card { padding: 16px; }
  .container { padding: 12px 8px; }
  .status-btn { padding: 9px 14px; font-size: 15px; }
  .action-text { font-size: 16px; }
  .btn-lg { padding: 14px 24px; font-size: 17px; }
  .section-tabs { gap: 4px; }
  .section-tab { font-size: 13px; padding: 6px 10px; }
}

/* ═══ Loading ═══ */
.loading {
  display: flex;
  justify-content: center;
  padding: 40px;
  color: var(--gray);
}
.spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--gray-l);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  margin-right: 10px;
}
@keyframes spin { to { transform: rotate(360deg); } }
