:root {
  --page: #f6f8fb;
  --panel: #ffffff;
  --panel-soft: #fbfdff;
  --sidebar: #111827;
  --sidebar-2: #0b1220;
  --text: #142233;
  --text-soft: #506177;
  --text-faint: #738196;
  --line: #d8e0ea;
  --line-soft: #e8edf4;
  --brand: #0097a7;
  --brand-2: #00b3bd;
  --blue: #2563eb;
  --green: #0f8a5f;
  --amber: #b7791f;
  --red: #b42318;
  --shadow: 0 14px 36px rgba(15, 23, 42, 0.08);
  --shadow-sm: 0 6px 18px rgba(15, 23, 42, 0.06);
  --radius: 8px;
  --radius-sm: 6px;
  --control-h: 38px;
}

* { box-sizing: border-box; }

html {
  background: var(--page);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Sora, "IBM Plex Sans", "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(0, 151, 167, 0.035), transparent 220px),
    linear-gradient(90deg, rgba(37, 99, 235, 0.025), transparent 520px),
    var(--page);
  font-size: 14px;
  letter-spacing: 0;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(20, 34, 51, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 34, 51, 0.035) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.42), transparent 72%);
}

.ambient { display: none; }
.hidden { display: none !important; }
.muted { color: var(--text-soft); }

p { margin: 0; }

h1, h2, h3, h4 {
  margin: 0 0 8px;
  font-family: Sora, "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
  color: var(--text);
}

h1 { font-size: 28px; line-height: 1.15; font-weight: 700; }
h2 { font-size: 20px; line-height: 1.25; font-weight: 700; }
h3 { font-size: 16px; line-height: 1.35; font-weight: 700; }
h4 {
  margin-top: 14px;
  font-size: 13px;
  line-height: 1.35;
  font-weight: 700;
  color: var(--text-soft);
}

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

button {
  user-select: none;
}

label {
  display: grid;
  gap: 7px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 600;
}

input, select, textarea {
  min-height: var(--control-h);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  background: var(--panel);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

input::placeholder, textarea::placeholder {
  color: #97a3b6;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: rgba(0, 151, 167, 0.8);
  box-shadow: 0 0 0 3px rgba(0, 151, 167, 0.14);
}

.card {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-sm);
}

.cta,
.ghost-btn,
.menu-btn,
.chip-btn,
.series-chip,
.data-table .row-action,
.link-btn {
  min-height: 34px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.cta {
  border: 1px solid rgba(0, 151, 167, 0.72);
  padding: 8px 14px;
  color: #ffffff;
  background: linear-gradient(180deg, var(--brand-2), var(--brand));
  font-weight: 700;
  box-shadow: 0 9px 18px rgba(0, 151, 167, 0.18);
}

.cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 22px rgba(0, 151, 167, 0.24);
}

.cta-alt {
  border-color: rgba(37, 99, 235, 0.55);
  background: linear-gradient(180deg, #3b82f6, #2563eb);
  box-shadow: 0 9px 18px rgba(37, 99, 235, 0.16);
}

.ghost-btn {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  padding: 8px 12px;
  font-weight: 600;
}

.ghost-btn:hover {
  border-color: rgba(0, 151, 167, 0.55);
  color: #007481;
  background: #f4fcfd;
}

.ghost-btn.inline {
  margin-top: 0;
  min-height: 32px;
  padding: 7px 11px;
}

.feedback {
  min-height: 20px;
  margin-top: 8px;
  color: var(--green);
  font-size: 12px;
}

.app-feedback:empty {
  display: none;
}

.auth-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 440px) minmax(320px, 440px);
  gap: 18px;
  align-items: center;
  justify-content: center;
  padding: 28px;
}

.auth-card {
  padding: 28px;
}

.auth-card h1,
.auth-card h2 {
  margin-bottom: 6px;
}

.auth-card > p {
  margin-bottom: 18px;
  color: var(--text-soft);
}

.form-grid {
  display: grid;
  gap: 12px;
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border: 0;
  border-radius: 0;
  background:
    linear-gradient(180deg, rgba(0, 151, 167, 0.1), transparent 210px),
    linear-gradient(180deg, var(--sidebar), var(--sidebar-2));
  box-shadow: none;
  color: #ecf6fb;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  padding: 2px 4px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.brand::before {
  content: "";
  display: block;
  width: 34px;
  height: 34px;
  margin-bottom: 12px;
  border-radius: 8px;
  border: 1px solid rgba(0, 179, 189, 0.7);
  background:
    radial-gradient(circle at 50% 34%, rgba(0, 179, 189, 0.92) 0 4px, transparent 5px),
    radial-gradient(circle at 38% 62%, rgba(255, 255, 255, 0.82) 0 3px, transparent 4px),
    radial-gradient(circle at 62% 67%, rgba(255, 255, 255, 0.82) 0 3px, transparent 4px),
    linear-gradient(180deg, rgba(0, 179, 189, 0.22), rgba(0, 179, 189, 0.08));
  box-shadow: 0 0 20px rgba(0, 179, 189, 0.18);
}

.kicker {
  margin: 0;
  color: #8ea3b8;
  font-size: 10px;
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: 0;
  font-weight: 700;
}

.brand h1 {
  margin: 4px 0 0;
  color: #ffffff;
  font-size: 25px;
  line-height: 1.1;
}

.current-user {
  margin: 0;
  padding: 9px 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  color: #b9c7d8;
  background: rgba(255, 255, 255, 0.035);
  font-size: 12px;
}

.menu {
  display: grid;
  gap: 6px;
}

.menu-btn {
  position: relative;
  border: 1px solid transparent;
  background: transparent;
  color: #cbd5e1;
  text-align: left;
  padding: 10px 12px 10px 34px;
  font-weight: 700;
}

.menu-btn::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 50%;
  width: 8px;
  height: 8px;
  border: 1px solid currentColor;
  border-radius: 2px;
  transform: translateY(-50%) rotate(45deg);
  opacity: 0.72;
}

.menu-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
}

.menu-btn.active {
  border-color: rgba(0, 179, 189, 0.35);
  color: #ffffff;
  background: linear-gradient(90deg, rgba(0, 151, 167, 0.86), rgba(0, 151, 167, 0.52));
  box-shadow: inset 3px 0 0 #7ffaff, 0 10px 24px rgba(0, 0, 0, 0.18);
}

.sidebar > .ghost-btn {
  margin-top: auto;
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #e5edf7;
}

.sidebar > .ghost-btn:hover {
  border-color: rgba(0, 179, 189, 0.55);
  background: rgba(0, 151, 167, 0.12);
}

.main {
  min-width: 0;
  display: grid;
  gap: 16px;
  align-content: start;
  padding: 18px;
}

.topbar {
  padding: 16px 18px;
}

.topbar-main {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(360px, 560px);
  gap: 20px;
  align-items: start;
}

.topbar .kicker {
  color: var(--text-faint);
}

.topbar h2 {
  margin-top: 3px;
}

.topbar p {
  color: var(--text-soft);
  line-height: 1.55;
}

.command-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  width: 100%;
}

.command-bar input {
  flex: 1;
  min-width: 220px;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}

.quick-btn {
  min-height: 30px;
  padding: 6px 10px;
  color: var(--text-soft);
  background: var(--panel-soft);
}

.view {
  display: none;
}

.view.active {
  display: block;
  animation: fadeup 0.18s ease;
}

.block {
  padding: 16px;
  margin-bottom: 14px;
}

.block > h3 {
  margin-bottom: 12px;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.inline-form input,
.inline-form select {
  min-width: 178px;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: var(--control-h);
  color: var(--text-soft);
  font-weight: 600;
}

.inline-check input {
  min-width: 0;
  min-height: 0;
  width: auto;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.kpi {
  position: relative;
  min-height: 104px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.98);
  padding: 15px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.kpi::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(180deg, var(--brand), var(--blue));
}

.kpi p {
  color: var(--text-faint);
  font-size: 12px;
  font-weight: 700;
}

.kpi strong {
  display: block;
  margin-top: 12px;
  color: #0f172a;
  font-size: 30px;
  line-height: 1;
  font-weight: 700;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.summary-card {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--panel-soft);
  padding: 11px 12px;
}

.summary-card p {
  margin-bottom: 4px;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 700;
}

.summary-card strong {
  display: block;
  color: var(--text);
  font-size: 20px;
  line-height: 1.1;
}

.summary-card span {
  color: var(--text-soft);
  font-size: 11px;
}

.chart-shell {
  position: relative;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(248, 250, 252, 0.96), #ffffff),
    var(--panel);
  box-shadow: var(--shadow-sm);
  padding: 12px;
  margin-bottom: 12px;
}

.chart-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background-image:
    linear-gradient(rgba(20, 34, 51, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 34, 51, 0.028) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.22), transparent 82%);
}

.chart-controls {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.chart-canvas {
  position: relative;
  z-index: 1;
  width: 100%;
  height: min(42vh, 410px);
  border-radius: var(--radius-sm);
}

.series-chip,
.chip-btn {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text-soft);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
}

.series-chip:hover,
.chip-btn:hover {
  border-color: rgba(0, 151, 167, 0.55);
  color: #007481;
  background: #f4fcfd;
}

.series-chip.active {
  border-color: rgba(0, 151, 167, 0.7);
  background: #e7fbfd;
  color: #006b75;
}

.chart-hover-tip {
  position: absolute;
  z-index: 5;
  max-width: 260px;
  pointer-events: none;
  border: 1px solid rgba(0, 151, 167, 0.24);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
  padding: 8px 10px;
}

.chart-detail {
  margin-top: 8px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--panel-soft);
  color: var(--text-soft);
  padding: 10px;
  font-size: 13px;
  line-height: 1.55;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  margin-bottom: 10px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line-soft);
  padding: 9px 10px;
  text-align: left;
  white-space: nowrap;
  vertical-align: top;
  color: var(--text);
  font-size: 13px;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f4f7fb;
  color: var(--text-soft);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0;
  font-weight: 800;
}

.data-table tbody tr:hover {
  background: #f8fcfd;
}

.data-table .row-action {
  min-height: 28px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text-soft);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
}

.data-table .row-action:hover {
  border-color: rgba(0, 151, 167, 0.52);
  color: #007481;
  background: #f4fcfd;
}

.data-table .row-action.delete {
  color: var(--red);
  border-color: #f1c5c1;
}

.assessment-item-table td {
  white-space: normal;
}

.link-btn {
  min-height: 0;
  border: 0;
  background: none;
  color: var(--blue);
  padding: 0;
  font-weight: 800;
  text-decoration: none;
}

.link-btn:hover {
  color: #1744a4;
  text-decoration: underline;
}

.dynamic-box {
  border: 1px dashed rgba(0, 151, 167, 0.36);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 12px;
  background: #f7fcfd;
}

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

.dynamic-item {
  display: grid;
  gap: 5px;
  font-size: 12px;
}

.dynamic-item small {
  color: var(--text-faint);
}

.export-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.top-space {
  margin-top: 10px;
}

.board-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(3px);
}

.modal-card {
  position: relative;
  width: min(980px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.28);
  padding: 16px;
}

.modal-content,
.modal-form-grid {
  display: grid;
  gap: 10px;
}

.modal-field {
  display: grid;
  gap: 6px;
}

.modal-field > span {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
}

.modal-field > input,
.modal-field > select,
.modal-field > textarea {
  width: 100%;
}

.modal-field > textarea {
  min-height: 92px;
  resize: vertical;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.preview-block {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--panel-soft);
  padding: 10px;
}

@keyframes fadeup {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

@media (max-width: 1280px) {
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    min-height: 0;
    border-radius: 0;
  }

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

  .brand::before {
    margin-bottom: 0;
    flex: 0 0 auto;
  }

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

  .menu-btn {
    text-align: center;
    padding: 9px 10px;
  }

  .menu-btn::before {
    display: none;
  }

  .topbar-main {
    grid-template-columns: 1fr;
  }

  .dynamic-item-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  body {
    font-size: 13px;
  }

  .app-shell,
  .main,
  .topbar,
  .topbar-main,
  .view,
  .card,
  .block,
  .kpi-grid,
  .summary-strip {
    min-width: 0;
    max-width: 100%;
  }

  .auth-shell {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .main {
    padding: 12px;
    gap: 12px;
  }

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

  .kpi-grid,
  .summary-strip {
    grid-template-columns: 1fr;
  }

  .inline-form input,
  .inline-form select,
  .inline-form button {
    width: 100%;
  }

  .command-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .command-bar input {
    min-width: 0;
  }

  .board-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .chart-canvas {
    height: min(36vh, 300px);
  }
}
/* Discrete scores remain numeric answers, with explicit unselected states. */
.score-choice-group { display:flex; flex-wrap:wrap; gap:8px; margin:10px 0; }
.score-choice { background:#fff; color:#1d354a; border:1px solid #acbbc8; border-radius:8px; padding:10px 14px; text-align:left; line-height:1.5; max-width:100%; }
.score-choice[aria-pressed="true"] { background:#124d69; color:#fff; border-color:#124d69; box-shadow:0 0 0 2px #b4dbe7; }
.score-choice:focus-visible { outline:3px solid #eea52b; outline-offset:2px; }
.score-choice:disabled { opacity:.45; cursor:not-allowed; }
.score-clear { font-size:12px; padding:4px 8px; }
.score-check { display:flex; align-items:center; gap:6px; padding:8px; border:1px solid #cbd5df; border-radius:6px; }
.score-check input { width:auto; }
.structured-results { display:flex; flex-wrap:wrap; gap:8px; margin:12px 0; }
.result-chip { background:#eaf4f7; color:#173f51; padding:10px 14px; border-radius:8px; font-weight:600; }
.scale-instructions { padding:12px; background:#f2f5f7; margin-bottom:14px; border-radius:8px; }
.scale-instructions p,.item-help { white-space:pre-wrap; line-height:1.7; }
.item-help { color:#42576a; font-size:14px; }
.item-group { color:#476981; }
