:root {
  color-scheme: light;
  --ink: #1f3244;
  --muted: #667987;
  --line: #d4e2ec;
  --panel: #ffffff;
  --page: #eef5fa;
  --cyan: #4f9ccc;
  --amber: #c99634;
  --red: #c9564f;
  --blue: #3f78ad;
  --teal: #2f7fb8;
  --mint: #e4f1fb;
  --table-head: #e8f2f9;
  --shadow: 0 18px 42px rgba(24, 47, 68, 0.1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 1180px;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 0%, rgba(63, 120, 173, 0.14), transparent 30%),
    radial-gradient(circle at 92% 16%, rgba(63, 120, 173, 0.1), transparent 28%),
    linear-gradient(135deg, #edf5fb 0%, #f7fafc 48%, #e9f2f8 100%);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

button, input, select { font: inherit; }
button, select { cursor: pointer; }

.app-shell {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  min-height: 100vh;
}

body.is-sidebar-collapsed .app-shell { grid-template-columns: minmax(0, 1fr); }
body.is-sidebar-collapsed .sidebar,
body.is-sidebar-collapsed .sidebar-resizer { display: none; }

.sidebar-toggle {
  position: fixed;
  top: 50vh;
  left: 287px;
  z-index: 30;
  display: grid;
  width: 22px;
  height: 54px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(127, 168, 198, 0.34);
  border-radius: 0 10px 10px 0;
  background: rgba(255, 255, 255, 0.88);
  color: #3f78ad;
  box-shadow: 0 8px 18px rgba(24, 47, 68, 0.08);
  transform: translateY(-50%);
}

.sidebar-toggle::before {
  content: "";
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-right: 6px solid currentColor;
}

.sidebar-toggle:hover,
.sidebar-toggle:focus-visible { background: #eff7fc; border-color: #7faed5; }
body.is-sidebar-collapsed .sidebar-toggle { left: 0 !important; }
body.is-sidebar-collapsed .sidebar-toggle::before { border-right: 0; border-left: 6px solid currentColor; }

.sidebar {
  position: sticky;
  top: 0;
  width: 292px;
  min-width: 260px;
  max-width: 760px;
  height: 100vh;
  padding: 24px 20px;
  border-right: 1px solid rgba(205, 224, 237, 0.86);
  background: linear-gradient(180deg, rgba(247, 251, 254, 0.98) 0%, rgba(235, 244, 250, 0.98) 100%);
  color: #2f506a;
  overflow: auto;
}

.sidebar-resizer {
  position: fixed;
  top: 0;
  left: 287px;
  z-index: 1000;
  width: 10px;
  height: 100vh;
  cursor: col-resize;
}

.sidebar-resizer::after {
  content: "";
  position: absolute;
  top: 0;
  right: 4px;
  width: 2px;
  height: 100%;
  background: transparent;
  transition: background 0.12s ease;
}

.sidebar-resizer:hover::after,
body.is-resizing-sidebar .sidebar-resizer::after {
  background: rgba(63, 120, 173, 0.34);
}

body.is-resizing-sidebar {
  cursor: col-resize;
  user-select: none;
}

.platform-switcher {
  display: grid;
  gap: 10px;
  margin-top: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(127, 168, 198, 0.2);
}

.platform-switch-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 78px;
  padding: 12px;
  border: 1px solid rgba(127, 168, 198, 0.24);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  color: #2f506a;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(24, 47, 68, 0.05);
}

.platform-switch-card:hover,
.platform-switch-card.is-active {
  border-color: rgba(63, 120, 173, 0.46);
  background: #fff;
}

.platform-switch-card.platform-story {
  border-color: rgba(116, 91, 172, 0.28);
}

.platform-switch-card.platform-story:hover,
.platform-switch-card.platform-story.is-active {
  border-color: rgba(116, 91, 172, 0.5);
}

.platform-switch-card.platform-irritation {
  border-color: rgba(181, 130, 59, 0.28);
}

.platform-switch-card.platform-irritation:hover,
.platform-switch-card.platform-irritation.is-active {
  border-color: rgba(181, 130, 59, 0.5);
}

.platform-switch-card.platform-survey {
  border-color: rgba(63, 120, 173, 0.28);
}

.platform-switch-card.platform-survey:hover,
.platform-switch-card.platform-survey.is-active {
  border-color: rgba(63, 120, 173, 0.5);
}

.platform-switch-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: #e4f1fb;
  color: #2d5e88;
  font-size: 22px;
  font-weight: 900;
}

.platform-switch-card.platform-story .platform-switch-icon {
  background: #eee8fb;
  color: #6547ba;
}

.platform-switch-card.platform-irritation .platform-switch-icon {
  background: #f3e4c8;
  color: #704b19;
}

.platform-switch-card.platform-survey .platform-switch-icon {
  background: #e4f1fb;
  color: #2d5e88;
}

.platform-switch-card strong,
.platform-switch-card small {
  display: block;
}

.platform-switch-card strong {
  color: #1f3244;
  font-size: 16px;
  line-height: 1.2;
}

.platform-switch-card small {
  margin-top: 5px;
  color: #667987;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.25;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(127, 168, 198, 0.2);
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: #e5f2fa;
  color: #2d5e88;
  font-weight: 800;
}

.brand p, .eyebrow, .panel-heading p, .drill-card p {
  margin: 0;
  color: var(--muted);
}

.brand p {
  color: #687d8c;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.brand h1 {
  margin: 4px 0 0;
  font-size: 18px;
}

.filter-group {
  margin-top: 24px;
}

.brand + .platform-switcher + .filter-group {
  margin-top: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(127, 168, 198, 0.2);
}

.filter-title {
  display: block;
  margin-bottom: 10px;
  color: #2f506a;
  font-size: 13px;
  font-weight: 800;
}

.filter-title.with-info {
  display: flex;
  align-items: baseline;
  gap: 3px;
}

.mini-info-button {
  display: inline-grid;
  position: relative;
  top: -0.42em;
  width: 15px;
  height: 15px;
  place-items: center;
  border: 1px solid rgba(127, 168, 198, 0.52);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.72);
  color: rgba(47, 120, 173, 0.82);
  cursor: default;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 11px;
  font-style: italic;
  font-weight: 700;
  line-height: 1;
  padding: 0;
  vertical-align: middle;
  box-shadow: 0 3px 9px rgba(49, 98, 132, 0.08);
}

.mini-info-button:hover,
.mini-info-button:focus-visible {
  border-color: rgba(47, 120, 173, 0.4);
  background: rgba(235, 246, 253, 0.72);
  color: #2f6f9f;
  outline: none;
}

.inline-info {
  margin-left: 1px;
  transform: translateY(-1px);
}

.filter-subtitle {
  color: #687d8c;
  font-size: 12px;
  font-weight: 800;
}

.upload-card {
  display: grid;
  gap: 6px;
  padding: 16px;
  border: 1px dashed rgba(127, 168, 198, 0.34);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  cursor: pointer;
}

.upload-card strong {
  color: #244968;
  font-size: 14px;
}

.upload-card span, .upload-status {
  color: #687d8c;
  font-size: 12px;
}

.upload-status { margin: 10px 0 0; line-height: 1.55; }

.upload-status.is-loading {
  color: #2f7fb8;
}

.upload-status.is-success {
  color: #2f8f64;
}

.upload-status.is-error {
  color: #c9564f;
}

.board-query-status {
  margin: 8px 0 0;
  color: #687d8c;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.5;
}

.board-query-status.is-loading {
  color: #2f7fb8;
}

.board-query-status.is-success {
  color: #2f8f64;
}

.board-query-status.is-error {
  color: #c9564f;
}

.upload-card.is-dragging {
  border-color: #7faed5;
  background: rgba(213, 232, 244, 0.5);
}

.template-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 28px;
  margin-top: 10px;
  padding: 0 10px;
  border: 1px solid rgba(127, 168, 198, 0.26);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.48);
  color: #3f78ad;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.demo-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}

.demo-actions .template-link {
  width: 100%;
  margin-top: 0;
  text-align: center;
  white-space: normal;
  line-height: 1.25;
}

.demo-actions #downloadSurveyPreviewButton {
  grid-column: 1 / -1;
  min-height: 32px;
  white-space: nowrap;
}

.template-link:hover,
.template-link:focus-visible,
.template-link:visited {
  background: rgba(255, 255, 255, 0.72);
  color: #244968;
  text-decoration: none;
}

.board-query-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(127, 168, 198, 0.24);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.56);
}

.board-query-card label {
  display: grid;
  gap: 7px;
}

.board-query-card label span {
  color: #687d8c;
  font-size: 12px;
  font-weight: 800;
}

.field-hint {
  color: #687d8c;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.45;
  opacity: 0.82;
}

.date-range {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 10px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
}

.date-range em {
  display: block;
  color: #687d8c;
  font-style: normal;
  font-weight: 900;
  text-align: center;
}

.date-picker-field {
  position: relative;
  min-width: 0;
  cursor: pointer;
}

.date-picker-field::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 8px;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid #3f78ad;
  pointer-events: none;
  transform: translateY(-38%);
}

.custom-date-input,
.custom-select-trigger,
.board-text-input {
  width: 100%;
  min-width: 0;
  height: 34px;
  border: 1px solid rgba(127, 168, 198, 0.3);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  color: #1f3244;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
  font-size: 11px;
  font-weight: 700;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.custom-date-input {
  cursor: pointer;
  padding: 0 17px 0 8px;
  font-variant-numeric: tabular-nums;
}

.board-text-input {
  padding: 0 10px;
}

.custom-select {
  position: relative;
}

.custom-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 0 28px 0 9px;
  text-align: left;
}

.custom-select-trigger::after {
  content: "";
  position: absolute;
  right: 12px;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid #3f78ad;
  transform: translateY(1px);
}

.custom-select-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 120;
  display: grid;
  width: 100%;
  gap: 4px;
  padding: 6px;
  border: 1px solid rgba(127, 168, 198, 0.34);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 14px 30px rgba(24, 47, 68, 0.14);
}

.custom-select-menu[hidden] {
  display: none;
}

.custom-select-menu button {
  width: 100%;
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #1f3244;
  cursor: pointer;
  padding: 0 10px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
}

.custom-select-menu button:hover {
  background: #eaf5fc;
  color: #2f6f9f;
}

.custom-select-menu button.is-selected {
  background: rgba(127, 190, 230, 0.26);
  color: #1f5f8a;
}

.custom-date-input:hover,
.custom-select-trigger:hover,
.board-text-input:hover {
  border-color: rgba(63, 120, 173, 0.46);
  background: rgba(255, 255, 255, 0.94);
}

.custom-date-input:focus,
.custom-select-trigger:focus,
.custom-select.is-open .custom-select-trigger,
.board-text-input:focus {
  border-color: rgba(47, 127, 184, 0.68);
  box-shadow:
    0 0 0 3px rgba(127, 190, 230, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.74);
}

.board-query-button {
  position: relative;
  width: 100%;
  min-height: 36px;
  margin-top: 2px;
  border: 0;
  border-radius: 8px;
  background: #2f7fb8;
  color: #ffffff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.board-query-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.custom-date-popover {
  position: absolute;
  z-index: 5000;
  width: 272px;
  padding: 10px;
  border: 1px solid rgba(127, 168, 198, 0.36);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 16px 36px rgba(24, 47, 68, 0.16);
}

.custom-date-head {
  display: grid;
  grid-template-columns: 32px 1fr 32px;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.custom-date-head strong {
  color: #1f3244;
  font-size: 15px;
  font-weight: 900;
  text-align: center;
}

.custom-date-head button {
  position: relative;
  width: 32px;
  height: 30px;
  border: 1px solid rgba(127, 168, 198, 0.3);
  border-radius: 8px;
  background: #f6fbff;
  color: #3f78ad;
  cursor: pointer;
}

.custom-date-head button::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
}

.custom-date-head [data-date-prev]::before {
  transform: translate(-35%, -50%) rotate(45deg);
}

.custom-date-head [data-date-next]::before {
  transform: translate(-65%, -50%) rotate(225deg);
}

.custom-date-head button:hover {
  border-color: rgba(47, 127, 184, 0.5);
  background: #eaf5fc;
  color: #2f6f9f;
}

.custom-date-week,
.custom-date-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.custom-date-week {
  margin-bottom: 5px;
  padding-bottom: 5px;
  border-bottom: 1px solid rgba(209, 226, 238, 0.82);
}

.custom-date-week span {
  color: #687d8c;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.custom-date-day {
  display: grid;
  place-items: center;
  width: 100%;
  height: 30px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #1f3244;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
}

.custom-date-day:hover {
  background: #eaf5fc;
  color: #2f6f9f;
}

.custom-date-day.is-muted {
  color: #aab8c2;
}

.custom-date-day.is-today {
  border-color: rgba(47, 127, 184, 0.44);
}

.custom-date-day.is-selected {
  border-color: #2f7fb8;
  background: #2f7fb8;
  color: #ffffff;
  box-shadow: 0 6px 14px rgba(47, 127, 184, 0.22);
}

.dictionary-panel {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding: 10px;
  border: 1px solid rgba(127, 168, 198, 0.22);
  border-radius: 10px;
  background: rgba(235, 246, 253, 0.42);
}

.dictionary-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.dictionary-panel-head .filter-title {
  margin: 0;
}

.dictionary-panel-head small {
  color: #687d8c;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.25;
  text-align: right;
}

.dictionary-source-list {
  display: grid;
  gap: 5px;
}

.dictionary-source-list span {
  display: block;
  min-width: 0;
  color: #687d8c;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.35;
}

.dictionary-source-list b {
  color: #244968;
  font-weight: 900;
  word-break: break-all;
}

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

.overview-diagnostics {
  gap: 10px;
}

.dictionary-status button {
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(127, 168, 198, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  cursor: pointer;
  text-align: left;
}

.overview-diagnostics button {
  min-height: 86px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.76);
}

.dictionary-status button:disabled {
  cursor: default;
  opacity: 0.72;
}

.dictionary-status button:not(:disabled):hover {
  border-color: rgba(47, 127, 184, 0.4);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 8px 18px rgba(24, 47, 68, 0.08);
}

.dictionary-status strong,
.dictionary-status span {
  display: block;
}

.dictionary-status strong {
  color: #244968;
  font-size: 15px;
  line-height: 1.1;
}

.overview-diagnostics strong {
  font-size: 28px;
}

.dictionary-status span {
  margin-top: 4px;
  color: #687d8c;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
}

.overview-diagnostics span {
  font-size: 13px;
}

.dictionary-status .is-warn strong {
  color: #c9564f;
}

.dictionary-detail-backdrop {
  position: fixed;
  inset: 0;
  z-index: 6000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(20, 34, 48, 0.28);
  backdrop-filter: blur(4px);
}

.dictionary-detail-modal {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(980px, calc(100vw - 48px));
  max-height: min(720px, calc(100vh - 48px));
  border: 1px solid rgba(127, 168, 198, 0.28);
  border-radius: 12px;
  background: rgba(252, 254, 255, 0.98);
  box-shadow: 0 24px 70px rgba(24, 47, 68, 0.22);
  overflow: hidden;
}

.dictionary-detail-modal header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px 14px;
  border-bottom: 1px solid rgba(127, 168, 198, 0.2);
}

.dictionary-detail-modal h3 {
  margin: 0;
  color: #1f3244;
  font-size: 18px;
  font-weight: 900;
}

.dictionary-detail-modal p {
  margin: 5px 0 0;
  color: #687d8c;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.dictionary-detail-modal header button {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(127, 168, 198, 0.28);
  border-radius: 8px;
  background: #ffffff;
  color: #2f6f9f;
  cursor: pointer;
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
}

.dictionary-detail-table {
  min-height: 0;
  overflow: auto;
  padding: 0 12px 12px;
  background: #fff;
}

.dictionary-detail-table table {
  width: 100%;
  min-width: 780px;
  border-collapse: separate;
  border-spacing: 0;
  color: #1f3244;
  font-size: 12px;
}

.dictionary-detail-table th,
.dictionary-detail-table td {
  max-width: 260px;
  padding: 9px 10px;
  border-bottom: 1px solid rgba(127, 168, 198, 0.18);
  text-align: left;
  vertical-align: top;
}

.dictionary-detail-table th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #f2f9fd;
  background-clip: padding-box;
  color: #244968;
  font-size: 11px;
  font-weight: 900;
  box-shadow: 0 1px 0 rgba(127, 168, 198, 0.22), 0 8px 14px rgba(255, 255, 255, 0.96);
}

.dictionary-detail-table td {
  word-break: break-word;
  font-weight: 700;
  line-height: 1.45;
}

.dictionary-detail-empty {
  display: grid;
  min-height: 180px;
  place-items: center;
  color: #687d8c;
  font-size: 13px;
  font-weight: 800;
}

.metadata-section {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.metadata-section + .metadata-section {
  padding-top: 14px;
  border-top: 1px solid rgba(127, 168, 198, 0.22);
}

.metadata-section-head h4 {
  margin: 0;
  color: #244968;
  font-size: 18px;
  font-weight: 900;
}

.metadata-section-head p {
  margin: 5px 0 0;
  color: #687d8c;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
}

.metadata-source-grid,
.metadata-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.metadata-source-grid div,
.metadata-summary div,
.metadata-summary button {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(127, 168, 198, 0.22);
  border-radius: 8px;
  background: rgba(235, 246, 253, 0.48);
  text-align: left;
}

.metadata-summary button {
  cursor: pointer;
}

.metadata-summary button:hover,
.metadata-summary button.is-active {
  border-color: rgba(47, 127, 184, 0.46);
  background: #fff;
  box-shadow: inset 3px 0 0 var(--teal);
}

.metadata-summary .is-muted {
  background: rgba(255, 255, 255, 0.62);
}

.metadata-summary .is-warn strong {
  color: #c9564f;
}

.metadata-summary .is-ok strong {
  color: #2f7d55;
}

.metadata-source-grid strong,
.metadata-source-grid span,
.metadata-summary strong,
.metadata-summary span {
  display: block;
}

.metadata-source-grid strong,
.metadata-summary strong {
  color: #244968;
  font-size: 16px;
  font-weight: 900;
}

.metadata-source-grid span,
.metadata-summary span {
  margin-top: 5px;
  color: #687d8c;
  font-size: 12px;
  font-weight: 800;
  word-break: break-all;
}

.metadata-audit-panel {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid rgba(127, 168, 198, 0.24);
  border-radius: 10px;
  background: rgba(248, 252, 255, 0.82);
}

.metadata-audit-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.metadata-audit-heading h4,
.metadata-audit-heading p {
  margin: 0;
}

.metadata-audit-heading h4 {
  color: #244968;
  font-size: 15px;
  font-weight: 900;
}

.metadata-audit-heading p {
  margin-top: 4px;
  color: #687d8c;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
}

.metadata-audit-heading > span {
  flex: 0 0 auto;
  padding: 5px 8px;
  border-radius: 999px;
  background: #e8f3fa;
  color: #3b6e92;
  font-size: 11px;
  font-weight: 900;
}

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

.metadata-audit-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 10px;
  min-width: 0;
  min-height: 104px;
  padding: 12px;
  border: 1px solid rgba(127, 168, 198, 0.24);
  border-radius: 8px;
  background: #fff;
  color: #244968;
  cursor: pointer;
  text-align: left;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.metadata-audit-card:hover,
.metadata-audit-card.is-active {
  border-color: rgba(47, 127, 184, 0.52);
  box-shadow: 0 8px 22px rgba(40, 91, 126, 0.09), inset 3px 0 0 var(--teal);
  transform: translateY(-1px);
}

.metadata-audit-card-label {
  align-self: center;
  min-width: 0;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.35;
}

.metadata-audit-card strong {
  color: #2f7d55;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  line-height: 1;
}

.metadata-audit-card.is-warn strong {
  color: #c9564f;
}

.metadata-audit-card small {
  grid-column: 1 / -1;
  color: #718594;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.45;
}

.metadata-issue-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: -2px 0 12px;
  padding: 10px 12px;
  border: 1px solid rgba(201, 86, 79, 0.2);
  border-radius: 8px;
  background: rgba(255, 246, 244, 0.82);
  color: #8f514e;
  font-size: 12px;
  font-weight: 900;
}

.metadata-issue-banner button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(201, 86, 79, 0.24);
  border-radius: 8px;
  background: #fff;
  color: #9f4b45;
  cursor: pointer;
  font: inherit;
}

.metadata-table-wrap {
  overflow: auto;
  height: min(620px, 68vh);
  min-height: 520px;
  border: 1px solid rgba(127, 168, 198, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.metadata-table {
  width: 100%;
  min-width: 780px;
  border-collapse: separate;
  border-spacing: 0;
  color: #1f3244;
  font-size: 13px;
}

.metadata-table th,
.metadata-table td {
  max-width: 360px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(127, 168, 198, 0.16);
  text-align: left;
  vertical-align: top;
}

.metadata-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #eef7fc;
  color: #244968;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.metadata-table td {
  font-weight: 700;
  line-height: 1.45;
  word-break: break-word;
}

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

.question-select-proxy {
  position: relative;
  min-width: 0;
}

.control-grid select#crossX,
.control-grid select#crossY,
.control-grid select#crossMode {
  position: absolute;
  left: -9999px;
  width: 1px;
  min-width: 0;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.question-select-trigger {
  display: flex;
  width: 100%;
  min-height: 38px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
  text-align: left;
  font-weight: 800;
}

.question-select-trigger span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.question-select-trigger::after {
  content: "";
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-right: 2px solid #2f6f9f;
  border-bottom: 2px solid #2f6f9f;
  transform: translateY(-2px) rotate(45deg);
}

.question-select-proxy.is-open .question-select-trigger {
  border-color: rgba(47, 127, 184, 0.52);
  box-shadow: 0 0 0 3px rgba(127, 190, 230, 0.18);
}

.question-select-proxy.is-open .question-select-trigger::after {
  transform: translateY(2px) rotate(225deg);
}

.question-select-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 80;
  display: grid;
  max-height: 320px;
  overflow: auto;
  gap: 5px;
  padding: 6px;
  border: 1px solid rgba(127, 168, 198, 0.3);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 16px 34px rgba(24, 47, 68, 0.16);
}

.question-select-menu[hidden] {
  display: none;
}

.question-select-menu button {
  min-height: 34px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  padding: 0 10px;
  text-align: left;
  font-size: 13px;
  font-weight: 800;
}

.question-select-menu button:hover,
.question-select-menu button.is-selected {
  background: #e8f4fb;
  color: #2f6f9f;
}

.metadata-mode-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.metadata-mode-tabs button,
.metadata-breadcrumb button {
  min-height: 34px;
  border: 1px solid rgba(127, 168, 198, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  color: #355a78;
  cursor: pointer;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 900;
}

.metadata-mode-tabs button.is-active {
  border-color: rgba(47, 127, 184, 0.42);
  background: rgba(47, 127, 184, 0.12);
  color: #244968;
}

#metadataSearchInput {
  width: min(360px, 42%);
  min-width: 220px;
  height: 36px;
  border: 1px solid rgba(127, 168, 198, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  color: #1f3244;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 800;
  outline: none;
}

#metadataSearchInput:focus {
  border-color: rgba(47, 127, 184, 0.52);
  box-shadow: 0 0 0 3px rgba(127, 190, 230, 0.18);
}

.metadata-breadcrumb {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
  color: #687d8c;
  font-size: 12px;
  font-weight: 900;
}

.metadata-table tr[data-metadata-row] {
  cursor: pointer;
}

.metadata-table tr[data-metadata-row]:hover td {
  background: rgba(235, 246, 253, 0.54);
}

.metadata-empty {
  min-height: 220px;
}

.metadata-empty strong,
.metadata-empty span {
  display: block;
}

.nav-button, .chip-list button {
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: #355a78;
}

.nav-button:hover, .chip-list button:hover {
  background: rgba(255, 255, 255, 0.86);
}

.page-nav {
  display: grid;
  gap: 7px;
  margin-top: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(127, 168, 198, 0.2);
}

.nav-button, .chip-list button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 10px 0 12px;
  text-align: left;
  font-size: 12px;
}

.nav-button {
  min-height: 38px;
  border-color: rgba(127, 168, 198, 0.2);
  color: #2f506a;
  font-size: 13px;
  font-weight: 800;
}

.nav-button:hover {
  border-color: rgba(127, 168, 198, 0.36);
  color: #244968;
}

.nav-button.is-active, .chip-list button.is-active {
  background: rgba(213, 232, 244, 0.5);
  color: #244968;
}

.nav-button.is-active {
  border-color: rgba(127, 168, 198, 0.34);
  background: rgba(213, 232, 244, 0.62);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.52);
}

.nav-button.is-active::before, .chip-list button.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 999px;
  background: #3f78ad;
}

.filter-block {
  display: grid;
  gap: 8px;
}

.filter-block + .filter-block {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(127, 168, 198, 0.16);
}

.sidebar select {
  width: 100%;
  min-height: 36px;
  border: 1px solid rgba(127, 168, 198, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: #2f506a;
  padding: 0 32px 0 10px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  text-overflow: ellipsis;
}

.chip-list {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
  overflow-x: hidden;
}

.global-filter-group {
  padding: 10px 0 0;
  border: 0;
  border-top: 1px solid rgba(127, 168, 198, 0.2);
  border-radius: 0;
  background: transparent;
}

.global-filter-group .filter-title {
  margin-bottom: 10px;
  color: #244968;
  font-size: 13px;
}

.global-filter-group .filter-subtitle {
  font-size: 12px;
  color: #667987;
}

.global-filter-group .filter-scroll {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 4px 10px 4px 0;
  background: rgba(239, 247, 252, 0.82);
  scrollbar-width: thin;
}

.global-filter-group .question-filter-scroll { max-height: 320px; }

.global-filter-group .chip-list button {
  position: relative;
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 38px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  overflow: hidden;
  padding: 0 14px 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.64);
  color: #2f506a;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
}

.global-filter-group .chip-list button.filter-child {
  width: calc(100% - 24px);
  min-height: 34px;
  margin: 0 8px 0 16px;
  background: rgba(255, 255, 255, 0.54);
}

.global-filter-group .chip-list button.filter-all { font-size: 13px; font-weight: 800; }
.global-filter-group .chip-list button.is-active { background: rgba(213, 232, 244, 0.74); }
.global-filter-group .chip-list button.is-active::after {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9ac8e6;
}
.global-filter-group .chip-list button.filter-all.is-active::after { display: none; }
.global-filter-group .chip-list button span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#globalSurveyOptions button span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#globalSurveyOptions button em {
  flex: none;
  color: #687d8c;
  font-size: 11px;
  font-style: normal;
}

#globalSurveyOptions button:focus-visible {
  outline: 2px solid #3f78ad;
  outline-offset: 2px;
}

.survey-filter-empty {
  color: #687d8c;
  font-size: 12px;
}

.global-filter-field {
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.global-filter-field select {
  margin-top: 7px;
  background:
    linear-gradient(45deg, transparent 50%, #2f506a 50%) calc(100% - 16px) 50% / 6px 6px no-repeat,
    linear-gradient(135deg, #2f506a 50%, transparent 50%) calc(100% - 11px) 50% / 6px 6px no-repeat,
    rgba(255, 255, 255, 0.88);
  appearance: none;
  -webkit-appearance: none;
}

.filter-select {
  position: relative;
  z-index: 8;
  min-width: 0;
  margin-top: 7px;
}

.filter-select-button {
  position: relative;
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 36px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 30px 0 10px;
  border: 1px solid rgba(127, 168, 198, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  color: #2f506a;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  text-align: left;
  overflow: hidden;
}

.filter-select-button span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-select-button::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid #2f506a;
  border-bottom: 2px solid #2f506a;
  transform: translateY(-65%) rotate(45deg);
}

.filter-select.is-open .filter-select-button {
  border-color: #7faed5;
  box-shadow: 0 0 0 3px rgba(127, 174, 213, 0.22);
}

.filter-select.is-open .filter-select-button::after {
  transform: translateY(-35%) rotate(225deg);
}

.filter-select-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  display: none;
  max-height: 310px;
  padding: 6px;
  overflow: auto;
  border: 1px solid rgba(127, 168, 198, 0.3);
  border-radius: 8px;
  background: #f8fbfe;
  box-shadow: 0 16px 30px rgba(24, 47, 68, 0.16);
}

.filter-select.is-open .filter-select-menu {
  display: grid;
  gap: 3px;
}

.filter-select-menu button {
  min-height: 32px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #244968;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  text-align: left;
}

.filter-select-menu button:hover,
.filter-select-menu button.is-active {
  border-color: rgba(127, 168, 198, 0.28);
  background: rgba(213, 232, 244, 0.72);
}

.global-filter-values {
  min-width: 0;
  margin-top: 12px;
  padding: 12px 0 0;
  border: 0;
  border-top: 1px solid rgba(127, 168, 198, 0.18);
  border-radius: 0;
  background: transparent;
}

.global-filter-field + .global-filter-values {
  margin-top: 12px;
  padding: 12px 0 0;
  border: 0;
  border-top: 1px solid rgba(127, 168, 198, 0.18);
}

.global-filter-values .chip-list {
  margin-top: 8px;
  max-height: 220px;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.global-filter-values .chip-list button {
  justify-content: flex-start;
  min-height: 42px;
  width: max-content;
  max-width: none;
  min-width: 100%;
  padding: 0 14px;
  border-color: rgba(127, 168, 198, 0.2);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.68);
  color: #355a78;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
}

.global-filter-values .chip-list button span {
  min-width: max-content;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

.global-filter-values .chip-list button.is-active {
  border-color: rgba(63, 120, 173, 0.4);
  background: rgba(213, 232, 244, 0.78);
}

.drill-card {
  display: grid;
  gap: 8px;
  padding: 13px;
  border: 1px solid rgba(127, 168, 198, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.64);
}

.drill-card + .drill-card { margin-top: 10px; }
.drill-card strong { font-size: 13px; }
.drill-card p { color: #687d8c; font-size: 12px; line-height: 1.65; }

.workspace {
  min-width: 0;
  padding: 24px 28px 42px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.eyebrow {
  margin-bottom: 4px;
  font-size: 13px;
  font-weight: 700;
  color: var(--teal);
}

.topbar h2 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0;
}

.top-actions button, .panel-heading button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
}

.top-actions button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 12px;
  border-color: var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.9);
  color: #58748a;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  white-space: nowrap;
  box-shadow: none;
}

.top-actions button:hover,
.top-actions button:focus-visible {
  border-color: rgba(127, 168, 198, 0.46);
  background: #ffffff;
  color: #244968;
}

.panel-heading .mini-info-button {
  min-height: 15px;
  width: 15px;
  height: 15px;
  padding: 0;
  border-radius: 50%;
  color: rgba(47, 120, 173, 0.82);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 11px;
  font-style: italic;
  font-weight: 700;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.kpi-card, .panel {
  border: 1px solid rgba(199, 220, 235, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.kpi-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  padding: 17px;
  min-height: 108px;
}

button.kpi-card {
  width: 100%;
  color: inherit;
  font: inherit;
  text-align: left;
}

.kpi-card.is-clickable {
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.kpi-card.is-clickable:hover,
.kpi-card.is-clickable:focus-visible {
  border-color: rgba(47, 127, 184, 0.48);
  background: #fff;
  box-shadow: 0 10px 24px rgba(24, 47, 68, 0.1);
  outline: none;
  transform: translateY(-1px);
}

.kpi-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.kpi-card strong {
  font-size: 28px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.kpi-card em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 600;
}

.tabs {
  display: flex;
  gap: 8px;
  margin: 4px 0 14px;
  padding: 8px;
  border: 1px solid rgba(199, 220, 235, 0.8);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.55);
}

.tab-button {
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.tab-button.is-active {
  border-color: rgba(127, 168, 198, 0.32);
  background: rgba(213, 232, 244, 0.58);
  color: #244968;
  box-shadow: 0 8px 18px rgba(24, 47, 68, 0.07);
}

.view { display: none; }
.view.is-active { display: grid; gap: 14px; }

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  gap: 14px;
}

.panel {
  min-width: 0;
  padding: 18px;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.panel-heading h3 {
  margin: 0 0 5px;
  font-size: 18px;
}

.panel-heading p {
  line-height: 1.55;
  font-size: 13px;
}

.category-heading-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
}

.category-mode-switch {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid #d4e2ec;
  border-radius: 9px;
  background: #f3f8fb;
}

.panel-heading .category-mode-switch button {
  min-height: 32px;
  padding: 0 13px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #687d8c;
  box-shadow: none;
  font-size: 12px;
  font-weight: 800;
}

.panel-heading .category-mode-switch button:hover {
  color: #245f86;
}

.panel-heading .category-mode-switch button.is-active {
  background: #fff;
  color: #245f86;
  box-shadow: 0 2px 8px rgba(24, 47, 68, 0.1), inset 0 0 0 1px rgba(127, 168, 198, 0.26);
}

.panel select, .panel input {
  min-height: 38px;
  min-width: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
}

.panel select.category-select-fallback {
  position: absolute;
  left: -9999px;
  width: 1px;
  min-width: 0;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.category-workbench {
  display: grid;
  grid-template-columns: 318px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  overflow: visible;
  padding-bottom: 8px;
}

.category-workbench.is-picker-collapsed {
  grid-template-columns: 28px minmax(0, 1fr);
  position: relative;
}

.category-workbench.is-picker-collapsed .question-picker-rail {
  display: grid;
}

.category-workbench.is-picker-collapsed .question-picker {
  display: none;
}

.category-workbench.is-picker-collapsed .category-detail {
  padding-top: 0;
}

.question-picker-rail {
  display: none;
  position: sticky;
  top: 16px;
  z-index: 3;
  height: 54px;
  place-items: center;
}

.question-picker-toggle {
  position: relative;
  display: grid;
  width: 28px;
  min-width: 28px;
  height: 44px;
  min-height: 44px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #3f78ad;
}

.question-picker-toggle::before {
  content: "";
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.question-picker-toggle.is-collapse::before {
  border-right: 6px solid currentColor;
}

.question-picker-toggle.is-expand::before {
  border-left: 6px solid currentColor;
}

.question-picker-toggle:hover,
.question-picker-toggle:focus-visible {
  border-color: #7faed5;
  background: #eff7fc;
}

.question-picker-rail .question-picker-toggle {
  box-shadow: 0 8px 18px rgba(24, 47, 68, 0.08);
}

.category-toolbar {
  display: none;
}

.category-toolbar button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.category-toolbar button:hover {
  border-color: #a8cfe8;
  background: #eff7fc;
}

.question-picker {
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: min(900px, calc(100vh - 32px));
  min-width: 0;
  padding: 12px;
  border: 1px solid #d6e4ee;
  border-radius: 8px;
  background: #f8fbfd;
  overflow: hidden;
}

.question-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 2px 8px;
  border-bottom: 1px solid #dce8f1;
}

.question-picker-head strong {
  font-size: 14px;
}

.question-picker-head .question-picker-toggle {
  width: 28px;
  height: 32px;
  min-height: 32px;
}

.question-picker-head span {
  color: var(--muted);
  font-size: 12px;
}

.question-list {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.category-select-all {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid #dce8f1;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  text-align: left;
}

.category-select-all[hidden] { display: none; }

.category-select-all.is-active { border-color: #91c8e8; background: #e4f1fb; }

.category-question-section + .category-question-section {
  margin-top: 30px;
  padding-top: 26px;
  border-top: 2px solid #d7e7f2;
}

.question-list-item {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  width: 100%;
  min-height: 62px;
  padding: 9px;
  border: 1px solid #dce8f1;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.question-list-item:hover {
  border-color: #a8cfe8;
  background: #eff7fc;
}

.question-list-item.is-active {
  border-color: #91c8e8;
  background: #eff7fc;
  box-shadow: inset 3px 0 0 var(--teal);
}

.question-index {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 8px;
  background: #e4f1fb;
  color: #245f86;
  font-size: 11px;
  font-weight: 900;
}

.question-main {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.question-main strong,
.question-main em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.question-main strong {
  font-size: 12px;
}

.question-main em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.instant-tooltip {
  position: fixed;
  z-index: 5000;
  display: none;
  width: max-content;
  max-width: min(360px, calc(100vw - 32px));
  padding: 9px 10px;
  border: 1px solid rgba(189, 220, 240, 0.95);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(24, 47, 68, 0.18);
  color: #23445d;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.55;
  pointer-events: none;
  white-space: pre-line;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity 0.04s ease-out, transform 0.04s ease-out;
}

.instant-tooltip.is-visible {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.type-pill {
  display: inline-grid;
  min-height: 24px;
  place-items: center;
  padding: 0 7px;
  border-radius: 999px;
  background: #1f3b52;
  color: #f7fbff;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.category-detail {
  min-width: 0;
  overflow: visible;
  padding-bottom: 4px;
}

.category-scroll-canvas {
  min-width: 0;
  container-type: inline-size;
  overflow-x: auto;
}

.category-subject {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding: 0 2px;
}

.category-subject-main {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
}

.category-subject-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

.subject-nav-button {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
}

.subject-nav-button:hover {
  border-color: #a8cfe8;
  background: #eff7fc;
}

.subject-index {
  width: auto;
  min-width: 38px;
  padding: 0 8px;
}

.category-subject h4 {
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.style-pill {
  display: inline-grid;
  min-height: 24px;
  place-items: center;
  padding: 0 8px;
  border: 1px solid #a8cfe8;
  border-radius: 999px;
  background: #eff7fc;
  color: #245f86;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.category-visual-layout {
  display: grid;
  grid-template-columns: minmax(720px, 1fr) minmax(280px, 300px);
  gap: 12px;
  align-items: start;
  min-width: 1020px;
}

.category-chart-card {
  min-height: 0;
  overflow: auto;
}

.category-explain {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid #d6e4ee;
  border-radius: 8px;
  background: #fbfdfc;
}

.advisor-grid {
  display: grid;
  gap: 8px;
}

.split-chart-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

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

.split-chart-grid h5 {
  margin: 0 0 12px;
  font-size: 14px;
}

.chart-subsection {
  min-width: 0;
}

.open-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

.open-grid .bar-row {
  grid-template-columns: minmax(92px, 0.65fr) minmax(220px, 2fr) 48px;
}

.open-grid .bar-track {
  height: 12px;
}

.open-samples-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 330px;
  overflow: auto;
  padding-right: 4px;
}

.open-samples-list .insight {
  min-height: 86px;
  margin: 0;
  padding: 12px;
  border-left-width: 3px;
  font-size: 12px;
  line-height: 1.65;
}

.nps-score-card {
  display: grid;
  gap: 8px;
  place-items: center;
  min-height: 150px;
  margin-bottom: 14px;
  border-radius: 8px;
  background: #eff7fc;
  border: 1px solid #a8cfe8;
}

.nps-score-card span,
.nps-score-card em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.nps-score-card strong {
  font-size: 56px;
  line-height: 1;
}

.nps-score-card small {
  padding: 0 12px 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

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

.ranking-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.ranking-table th,
.ranking-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e2edf5;
  text-align: left;
}

.ranking-table thead th {
  color: var(--muted);
  background: #f4f9fc;
}

.ranking-table tbody th {
  font-weight: 700;
}

.ranking-position {
  display: inline-grid;
  width: 24px;
  height: 24px;
  margin-right: 10px;
  place-items: center;
  border-radius: 6px;
  background: #e7f3fb;
  color: #287bac;
}

.ranking-first {
  display: flex;
  min-width: 150px;
  align-items: center;
  gap: 10px;
}

.ranking-first-track {
  flex: 1;
  height: 9px;
  overflow: hidden;
  border-radius: 99px;
  background: #e7f0f7;
}

.ranking-first-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #4597ca;
}

.ranking-first strong {
  min-width: 66px;
  text-align: right;
  white-space: nowrap;
}

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

.image-choice-card {
  display: grid;
  gap: 8px;
  min-height: 112px;
  padding: 12px;
  border: 1px solid #d6e4ee;
  border-radius: 8px;
  background: linear-gradient(145deg, #f8fbfd, #eff7fc);
}

.image-choice-card span {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 8px;
  background: #1f3b52;
  color: #f7fbff;
  font-size: 12px;
  font-weight: 900;
}

.image-choice-card strong {
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-choice-card em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

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

.structure-panel.is-wide {
  grid-column: 1 / -1;
}

.spss-grid {
  display: block;
}

.stats-workbench {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.stats-model-list {
  display: grid;
  gap: 8px;
  position: sticky;
  top: 14px;
}

.stats-model-button {
  display: grid;
  gap: 6px;
  width: 100%;
  min-height: 82px;
  padding: 12px;
  border: 1px solid #d6e4ee;
  border-radius: 8px;
  background: #fbfdfc;
  color: var(--ink);
  text-align: left;
}

.stats-model-button:hover,
.stats-model-button.is-active {
  border-color: #91c8e8;
  background: #eff7fc;
}

.stats-model-button.is-active {
  box-shadow: inset 4px 0 0 var(--teal);
}

.stats-model-button span {
  width: fit-content;
  padding: 3px 8px;
  border-radius: 999px;
  background: #e4f1fb;
  color: #245f86;
  font-size: 12px;
  font-weight: 900;
}

.stats-model-button strong {
  font-size: 14px;
  line-height: 1.35;
}

.stats-model-button em {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats-model-detail {
  min-width: 0;
}

.stats-analysis {
  display: grid;
  gap: 14px;
  min-height: 420px;
  padding: 16px;
  border: 1px solid #d9e6ef;
  border-radius: 8px;
  background: #fbfdfc;
}

.stats-analysis.good { border-color: #a8cfe8; }
.stats-analysis.mid { border-color: #d6e4ee; }
.stats-analysis.warn { border-color: #ecd7b7; }

.stats-analysis-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid #dce8f1;
}

.stats-analysis-head span {
  color: #245f86;
  font-size: 12px;
  font-weight: 900;
}

.stats-analysis-head h4 {
  margin: 4px 0 0;
  color: var(--ink);
  font-size: 22px;
  line-height: 1.25;
}

.stats-analysis-head > strong {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 8px;
  background: #1f3b52;
  color: #f7fbff;
  font-size: 12px;
}

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

.stats-inline-controls label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.stats-inline-controls label span {
  color: #3d627e;
  font-size: 11px;
  font-weight: 900;
}

.stats-inline-controls select {
  width: 100%;
  min-height: 34px;
  padding: 0 8px;
  border: 1px solid #cfe0ec;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.stats-result-strip {
  display: grid;
  grid-template-columns: minmax(180px, 0.45fr) minmax(0, 1fr);
  gap: 10px;
}

.stats-result-strip > div,
.stats-reading-grid section {
  padding: 12px;
  border: 1px solid #d6e4ee;
  border-radius: 8px;
  background: #f8fbfd;
}

.stats-result-strip span,
.stats-reading-grid h5 {
  display: block;
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.stats-result-strip strong {
  color: #2d5e88;
  font-size: 24px;
  line-height: 1.2;
}

.stats-result-strip p,
.stats-reading-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

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

.stats-output {
  min-width: 0;
}

.stats-summary-card {
  display: grid;
  gap: 8px;
  min-height: 118px;
  padding: 14px;
  border: 1px solid #d6e4ee;
  border-radius: 8px;
  background: #fbfdfc;
  align-content: start;
}

.stats-summary-card.good { border-color: #a8cfe8; background: #eff7fc; }
.stats-summary-card.mid { border-color: #d6e4ee; background: #f8fbfd; }
.stats-summary-card.warn { border-color: #ecd7b7; background: #fff9ef; }

.stats-summary-card span {
  display: inline-flex;
  width: fit-content;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  background: #e4f1fb;
  color: #245f86;
  font-size: 12px;
  font-weight: 900;
}

.stats-summary-card em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.stats-summary-card strong {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.2;
}

.metric-tile {
  display: grid;
  gap: 7px;
  padding: 14px;
  border: 1px solid #d6e4ee;
  border-radius: 8px;
  background: #f8fbfd;
}

.metric-tile span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.metric-tile strong { font-size: 22px; }
.metric-tile p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }

.overview-panel {
  margin-bottom: 0;
  padding-bottom: 16px;
}

.ai-report-card {
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid rgba(127, 168, 198, 0.24);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(235, 246, 253, 0.74), rgba(255, 255, 255, 0.86));
}

.ai-report-card.is-empty {
  background: rgba(255, 255, 255, 0.74);
}

.ai-report-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.ai-report-head h4 {
  margin: 0;
  color: #1f3244;
  font-size: 16px;
  font-weight: 900;
}

.ai-report-head p,
.ai-report-card p {
  margin: 4px 0 0;
  color: #687d8c;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.55;
}

.ai-report-head span {
  flex: 0 0 auto;
  border-radius: 999px;
  background: rgba(47, 127, 184, 0.12);
  color: #2f6f9f;
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 900;
}

.ai-report-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.ai-report-grid div {
  min-width: 0;
  border: 1px solid rgba(127, 168, 198, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.64);
  padding: 12px;
}

.ai-report-grid strong {
  color: #244968;
  font-size: 13px;
  font-weight: 900;
}

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

.board-query-head .filter-title {
  margin-bottom: 0;
}

.board-query-admin-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.board-query-admin-actions[hidden] {
  display: none;
}

.board-query-admin-actions button {
  min-height: 30px;
  border: 1px solid rgba(127, 168, 198, 0.28);
  border-radius: 8px;
  background: #fff;
  color: #2f6f9f;
  font-size: 11px;
  font-weight: 900;
  padding: 0 9px;
}

.ai-panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(246, 251, 254, 0.98));
}

.ai-heading-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
  align-items: center;
  flex-wrap: nowrap;
  justify-content: flex-end;
}

.ai-heading-actions .ai-usage-meter {
  display: flex;
  min-height: 34px;
  align-items: center;
  gap: 9px;
  padding: 0 10px;
  border: 1px solid rgba(199, 220, 235, 0.9);
  border-radius: 8px;
  background: #f5fbff;
  color: #587187;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.ai-heading-actions .ai-usage-meter span + span {
  padding-left: 8px;
  border-left: 1px solid rgba(199, 220, 235, 0.9);
}

.ai-heading-actions .ai-device-link,
.ai-heading-actions .ai-log-link,
.ai-heading-actions .ai-secondary-button {
  min-height: 34px;
  padding: 0 9px;
  border: 1px solid rgba(127, 168, 198, 0.28);
  border-radius: 8px;
  background: #fff;
  color: #2f6f9f;
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  box-shadow: none;
}

.ai-heading-actions .ai-device-link {
  border: 0;
  background: transparent;
  font-weight: 800;
}

.ai-heading-actions .ai-secondary-button {
  padding: 0 12px;
  font-size: 13px;
  font-weight: 800;
  border-color: rgba(127, 168, 198, 0.28);
  color: #2f6f9f;
}

.ai-heading-actions .ai-device-link:hover,
.ai-heading-actions .ai-device-link[aria-expanded="true"],
.ai-heading-actions .ai-log-link:hover,
.ai-heading-actions .ai-log-link[aria-expanded="true"],
.ai-heading-actions .ai-secondary-button:hover,
.ai-heading-actions .ai-secondary-button[aria-expanded="true"] {
  border-color: rgba(47, 127, 184, 0.42);
  background: #eef7fd;
  color: #245f88;
}

.ai-heading-actions .ai-primary-button {
  position: relative;
  min-height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: #2f7fb8;
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 10px 18px rgba(47, 127, 184, 0.16);
  white-space: nowrap;
}

.ai-heading-actions .ai-primary-button::after {
  content: attr(data-tooltip);
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 30;
  width: 260px;
  max-width: min(260px, calc(100vw - 48px));
  padding: 8px 10px;
  border: 1px solid rgba(199, 220, 235, 0.9);
  border-radius: 8px;
  background: #fff;
  color: #587187;
  box-shadow: 0 10px 24px rgba(24, 47, 68, 0.14);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
  text-align: left;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  transform: translateY(2px);
  transition: opacity 0.08s ease, transform 0.08s ease;
}

.ai-heading-actions .ai-primary-button:hover::after {
  opacity: 1;
  transform: translateY(0);
}

.ai-heading-actions .ai-primary-button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.ai-heading-actions .ai-primary-button:hover {
  background: #276fa2;
}

.ai-workbench {
  display: grid;
  gap: 14px;
}

.ai-control-column {
  display: grid;
  grid-template-columns: minmax(360px, 620px) 190px 190px;
  gap: 12px;
  align-items: start;
}

.ai-control-column .ai-status {
  grid-column: 1 / -1;
}

.ai-field,
.ai-option-grid label {
  display: grid;
  gap: 7px;
  color: #587187;
  font-size: 13px;
  font-weight: 800;
}

.ai-field textarea,
.ai-dropdown-trigger {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

.ai-field textarea {
  height: 38px;
  min-height: 38px;
  padding: 8px 12px;
  resize: vertical;
  font-size: 14px;
  line-height: 1.4;
}

.ai-option-grid {
  display: contents;
}

.ai-dropdown {
  position: relative;
  display: grid;
  gap: 6px;
  min-width: 0;
}

.ai-dropdown-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  padding: 0 11px;
  text-align: left;
  font-size: 13px;
  font-weight: 800;
}

.ai-dropdown-trigger::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 2px solid #2f6f9f;
  border-bottom: 2px solid #2f6f9f;
  transform: translateY(-2px) rotate(45deg);
}

.ai-dropdown.is-open .ai-dropdown-trigger::after {
  transform: translateY(2px) rotate(225deg);
}

.ai-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 50;
  display: grid;
  width: 100%;
  gap: 5px;
  padding: 6px;
  border: 1px solid rgba(127, 168, 198, 0.3);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 14px 30px rgba(24, 47, 68, 0.14);
}

.ai-dropdown-menu[hidden],
.ai-prompt-panel[hidden],
.ai-device-panel[hidden],
.ai-log-panel[hidden] {
  display: none;
}

.ai-dropdown-menu button {
  min-height: 34px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  padding: 0 10px;
  text-align: left;
  font-size: 13px;
  font-weight: 800;
}

.ai-dropdown-menu button:hover,
.ai-dropdown-menu button.is-selected {
  background: #e8f4fb;
  color: #2f6f9f;
}

.ai-field textarea:focus,
.ai-dropdown-trigger:focus {
  border-color: rgba(47, 127, 184, 0.5);
  box-shadow: 0 0 0 3px rgba(47, 127, 184, 0.12);
}

.ai-status {
  min-height: 34px;
  margin: 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: #eef7fd;
  color: #587187;
  font-size: 12px;
  line-height: 1.5;
}

.ai-status.is-loading { color: #2f6f9f; }
.ai-status.is-stale { background: #f7fbfe; color: #587187; }
.ai-status.is-error { background: #fff2f0; color: #bd514b; }
.ai-status.is-success { background: #eef8f2; color: #438666; }

.ai-prompt-panel,
.ai-device-panel,
.ai-log-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(199, 220, 235, 0.86);
  border-radius: 8px;
  background: #fafdff;
}

.ai-prompt-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #687d8c;
  font-size: 12px;
  font-weight: 800;
}

.ai-prompt-head strong {
  color: #244968;
  font-size: 13px;
}

.ai-device-grid {
  display: grid;
  grid-template-columns: minmax(120px, 0.7fr) minmax(280px, 2fr) minmax(120px, 0.8fr) auto;
  gap: 10px;
  align-items: stretch;
}

.ai-device-grid > div {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid rgba(199, 220, 235, 0.76);
  border-radius: 8px;
  background: #fff;
}

.ai-device-grid span {
  color: #687d8c;
  font-size: 12px;
  font-weight: 800;
}

.ai-device-grid strong,
.ai-device-grid code {
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.ai-device-grid code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

.ai-device-copy {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  background: #2f7fb8;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  padding: 0 12px;
}

.ai-result-card {
  min-height: 224px;
  padding: 14px;
  border: 1px solid rgba(199, 220, 235, 0.86);
  border-radius: 8px;
  background: #fff;
  overflow: auto;
}

.ai-result-empty {
  display: grid;
  min-height: 194px;
  place-items: center;
  align-content: center;
  gap: 5px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fafdff;
  color: #687d8c;
  text-align: center;
  line-height: 1.6;
}

.ai-result-empty strong {
  color: var(--ink);
}

.ai-markdown {
  display: grid;
  gap: 10px;
  max-height: 360px;
  overflow: auto;
  padding-right: 2px;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  line-height: 1.7;
}

.ai-markdown[hidden] {
  display: none;
}

.ai-result-content {
  display: grid;
  gap: 12px;
}

.ai-result-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(199, 220, 235, 0.68);
}

.ai-result-meta > span {
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef7fd;
  color: #587187;
  font-size: 12px;
  font-weight: 900;
}

.ai-result-toggle {
  margin-left: auto;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(127, 168, 198, 0.28);
  border-radius: 8px;
  background: #fff;
  color: #2f6f9f;
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
}

.ai-prompt-template {
  display: block;
  max-height: 360px;
  overflow: auto;
  white-space: pre-wrap;
  margin: 0;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  line-height: 1.65;
}

.ai-prompt-data-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.ai-prompt-data-block {
  border: 1px solid rgba(199, 220, 235, 0.76);
  border-radius: 8px;
  background: #fafdff;
  overflow: hidden;
}

.ai-prompt-data-block summary {
  display: grid;
  grid-template-columns: minmax(160px, auto) minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 38px;
  padding: 8px 10px;
  color: #244968;
  cursor: pointer;
  list-style: none;
}

.ai-prompt-data-block summary::-webkit-details-marker {
  display: none;
}

.ai-prompt-data-block summary::before {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 2px solid #2f6f9f;
  border-bottom: 2px solid #2f6f9f;
  transform: rotate(-45deg);
}

.ai-prompt-data-block[open] summary::before {
  transform: translateY(-2px) rotate(45deg);
}

.ai-prompt-data-block summary strong {
  color: #244968;
  font-size: 12px;
}

.ai-prompt-data-block summary span {
  color: #687d8c;
  font-size: 12px;
  line-height: 1.45;
}

.ai-prompt-data-block pre {
  max-height: 360px;
  margin: 0;
  padding: 10px 12px;
  overflow: auto;
  border-top: 1px solid rgba(199, 220, 235, 0.76);
  background: #fff;
  color: var(--ink);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.ai-markdown h1,
.ai-markdown h2,
.ai-markdown h3,
.ai-markdown p,
.ai-markdown ul,
.ai-markdown ol {
  margin: 0;
}

.ai-markdown h1 {
  color: var(--ink);
  font-size: 21px;
  line-height: 1.35;
}

.ai-markdown h2 {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid rgba(199, 220, 235, 0.7);
  color: #244968;
  font-size: 17px;
  line-height: 1.42;
}

.ai-markdown h3 {
  color: #315b7b;
  font-size: 15px;
  line-height: 1.45;
}

.ai-markdown ul,
.ai-markdown ol {
  display: grid;
  gap: 6px;
  padding-left: 20px;
}

.ai-markdown li {
  padding-left: 2px;
}

.ai-markdown strong {
  color: #1b3348;
  font-weight: 900;
}

.ai-markdown hr {
  width: 100%;
  height: 1px;
  margin: 4px 0;
  border: 0;
  background: rgba(199, 220, 235, 0.8);
}

.ai-markdown-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.55;
}

.ai-markdown-table th,
.ai-markdown-table td {
  padding: 9px 10px;
  border-bottom: 1px solid rgba(199, 220, 235, 0.72);
  border-right: 1px solid rgba(199, 220, 235, 0.48);
  text-align: left;
  vertical-align: top;
}

.ai-markdown-table th:last-child,
.ai-markdown-table td:last-child {
  border-right: 0;
}

.ai-markdown-table tr:last-child td {
  border-bottom: 0;
}

.ai-markdown-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef7fc;
  color: #244968;
  font-weight: 900;
  white-space: nowrap;
}

.ai-log-empty {
  display: grid;
  min-height: 84px;
  place-items: center;
  color: #687d8c;
  font-size: 13px;
  font-weight: 800;
}

.ai-log-empty.is-error {
  color: #bd514b;
}

.ai-log-table {
  max-width: 100%;
  max-height: 360px;
  overflow: auto;
  border: 1px solid rgba(199, 220, 235, 0.76);
  border-radius: 8px;
  background: #fff;
}

.ai-log-table .ai-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow: auto;
  border: 0;
  border-radius: 0;
}

.ai-table-wrap {
  max-height: 420px;
  overflow: auto;
  border: 1px solid rgba(199, 220, 235, 0.76);
  border-radius: 8px;
}

.ai-log-mini-table {
  width: 100%;
  min-width: 1560px;
  border-collapse: collapse;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  table-layout: fixed;
}

.ai-log-mini-table th,
.ai-log-mini-table td {
  padding: 7px 9px;
  border-bottom: 1px solid rgba(199, 220, 235, 0.68);
  text-align: left;
  vertical-align: middle;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.ai-log-mini-table th {
  background: #e8f2f9;
  color: #244968;
  font-weight: 900;
}

.ai-log-mini-table th:nth-child(1),
.ai-log-mini-table td:nth-child(1) { width: 44px; }
.ai-log-mini-table th:nth-child(2),
.ai-log-mini-table td:nth-child(2) { width: 138px; }
.ai-log-mini-table th:nth-child(3),
.ai-log-mini-table td:nth-child(3) { width: 72px; }
.ai-log-mini-table th:nth-child(4),
.ai-log-mini-table td:nth-child(4) { width: 72px; }
.ai-log-mini-table th:nth-child(5),
.ai-log-mini-table td:nth-child(5) { width: 92px; }
.ai-log-mini-table th:nth-child(6),
.ai-log-mini-table td:nth-child(6) { width: 220px; }
.ai-log-mini-table th:nth-child(7),
.ai-log-mini-table td:nth-child(7) { width: 150px; }
.ai-log-mini-table th:nth-child(8),
.ai-log-mini-table td:nth-child(8) { width: 120px; }
.ai-log-mini-table th:nth-child(9),
.ai-log-mini-table td:nth-child(9) { width: 210px; }
.ai-log-mini-table th:nth-child(10),
.ai-log-mini-table td:nth-child(10) { width: 220px; }
.ai-log-mini-table th:nth-child(11),
.ai-log-mini-table td:nth-child(11) { width: 150px; }
.ai-log-mini-table th:nth-child(12),
.ai-log-mini-table td:nth-child(12) { width: 74px; }

.ai-loading-card {
  display: grid;
  gap: 14px;
  min-height: 194px;
  align-content: center;
  padding: 20px;
  border: 1px dashed rgba(127, 168, 198, 0.32);
  border-radius: 8px;
  background: #fafdff;
}

.ai-loading-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink);
}

.ai-loading-head > div {
  display: grid;
  gap: 4px;
}

.ai-loading-head strong {
  color: var(--ink);
  font-size: 16px;
  font-weight: 950;
}

.ai-loading-head span,
.ai-loading-note {
  color: #687d8c;
  font-size: 12px;
  font-weight: 800;
}

.ai-loading-stop {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(199, 72, 72, 0.24);
  border-radius: 8px;
  background: #fff4f1;
  color: #bf4742;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.ai-loading-stop:hover {
  border-color: rgba(199, 72, 72, 0.38);
  background: #ffebe7;
}

.ai-progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7f2fa;
}

.ai-progress-track i {
  display: block;
  width: var(--ai-progress, 10%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #63a7d7, #2f7fb8);
  transition: width 0.45s ease;
}

.ai-loading-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.ai-loading-steps span {
  padding: 8px 9px;
  border-radius: 8px;
  background: #eef7fd;
  color: #687d8c;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.ai-loading-steps span.is-active {
  background: #dff0fb;
  color: #2f6f9f;
}

.record-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(24, 47, 68, 0.28);
  backdrop-filter: blur(6px);
}

.record-modal[hidden] {
  display: none;
}

body.has-survey-preview {
  overflow: hidden;
}

.survey-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(24, 47, 68, 0.42);
}

.survey-preview-modal[hidden] {
  display: none;
}

.survey-preview-dialog {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1180px, 100%);
  height: min(900px, calc(100vh - 48px));
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(127, 168, 198, 0.32);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 24px 72px rgba(24, 47, 68, 0.28);
}

.survey-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 16px;
  border-bottom: 1px solid #d9e6ef;
  background: #f8fbfd;
}

.survey-preview-head h2 {
  margin: 0 0 3px;
  color: var(--ink);
  font-size: 18px;
}

.survey-preview-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.survey-preview-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.survey-preview-actions button {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 900;
}

.survey-preview-download {
  border: 1px solid #2f7fb8;
  background: #2f7fb8;
  color: #fff;
}

.survey-preview-close {
  border: 1px solid #cadde9;
  background: #fff;
  color: #315a77;
}

.survey-preview-actions button:hover,
.survey-preview-actions button:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(47, 127, 184, 0.16);
}

.survey-preview-actions button:focus-visible {
  outline: 3px solid rgba(89, 169, 214, 0.3);
  outline-offset: 2px;
}

.survey-preview-frame {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  background: #eef6fb;
}

.record-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  width: min(1180px, 96vw);
  max-height: min(760px, 86vh);
  overflow: hidden;
  border: 1px solid rgba(127, 168, 198, 0.28);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 22px 60px rgba(24, 47, 68, 0.24);
  padding: 16px;
}

.record-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.record-head > div {
  display: grid;
  gap: 3px;
}

.record-head strong {
  color: var(--ink);
  font-size: 13px;
}

.record-head span {
  color: #687d8c;
  font-size: 11px;
  font-weight: 800;
}

.record-close {
  min-height: 32px;
  border: 1px solid rgba(127, 168, 198, 0.28);
  border-radius: 8px;
  background: #fff;
  color: #2f6f9f;
  font-weight: 900;
  padding: 0 10px;
}

.record-table-wrap {
  min-height: 0;
  max-height: 620px;
  overflow: auto;
  border: 1px solid rgba(199, 220, 235, 0.76);
  border-radius: 8px;
}

.record-table {
  width: 100%;
  min-width: 1088px;
  border-collapse: collapse;
  background: #fff;
}

.record-table th,
.record-table td {
  padding: 9px 10px;
  border-bottom: 1px solid rgba(199, 220, 235, 0.68);
  color: var(--ink);
  font-size: 11px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.record-table th {
  position: sticky;
  top: 0;
  background: #e8f2f9;
  color: #244968;
  font-weight: 900;
}

.record-code {
  font-family: "SFMono-Regular", Consolas, monospace;
}

.record-cell-ellipsis {
  display: block;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-col-time { width: 150px; }
.record-col-user { width: 112px; }
.record-col-code { width: 205px; }
.record-col-query { width: 290px; }
.record-col-method { width: 64px; }
.record-col-count { width: 66px; }
.record-col-status { width: 201px; }

.record-method,
.record-count {
  text-align: center;
}

.permission-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.permission-badge.is-admin {
  background: #e6f3ff;
  color: #2f6f9f;
}

.permission-badge.is-member {
  background: #f1f6fa;
  color: #587187;
}

.record-empty {
  min-height: 120px;
  display: grid;
  place-items: center;
  color: #687d8c;
  font-size: 13px;
  font-weight: 800;
}

.record-empty.is-error {
  color: #bd514b;
}

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

.insight {
  padding: 13px;
  border-left: 4px solid var(--teal);
  border-radius: 8px;
  background: #f5f9fc;
  line-height: 1.65;
  font-size: 13px;
}

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

.diagnosis-card {
  display: grid;
  gap: 6px;
  min-height: 104px;
  padding: 13px;
  border: 1px solid #d6e4ee;
  border-radius: 8px;
  background: #f8fbfd;
}

.diagnosis-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.diagnosis-card strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 22px;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.diagnosis-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.question-report {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(360px, 1.05fr);
  gap: 14px;
}

.chart-card {
  border: 1px solid #d9e6ef;
  border-radius: 8px;
  background: #fbfdfc;
  padding: 14px;
}

.chart-card h4 {
  margin: 0 0 12px;
  font-size: 15px;
}

.guide-box {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 14px;
}

.guide-item {
  padding: 12px;
  border: 1px solid #d6e4ee;
  border-radius: 8px;
  background: #f8fbfd;
}

.guide-item span {
  display: block;
  margin-bottom: 6px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
}

.guide-item p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.type-map {
  margin: -4px 0 10px;
  border: 1px solid #d6e4ee;
  border-radius: 8px;
  background: rgba(248, 251, 253, 0.72);
}

.type-map summary {
  padding: 8px 12px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

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

.type-map-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 0 12px 12px;
}

.type-map-group {
  display: grid;
  gap: 8px;
  align-content: start;
  min-width: 0;
  padding: 10px;
  border: 1px solid #dce8f1;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.64);
}

.type-map-group h4 {
  margin: 0;
  color: var(--teal);
  font-size: 12px;
  line-height: 1.2;
}

.type-map-item {
  display: grid;
  gap: 5px;
  min-height: 94px;
  padding: 9px;
  border: 1px solid #dce8f1;
  border-radius: 8px;
  background: #fbfdfc;
}

.type-map-item.is-active {
  border-color: #91c8e8;
  background: #eff7fc;
  box-shadow: inset 3px 0 0 var(--teal);
}

.type-map-item strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.25;
}

.type-map-item em {
  width: fit-content;
  min-height: 21px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #eff7fc;
  color: #245f86;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.type-map-item span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.bar-list {
  display: grid;
  gap: 9px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(170px, 1.4fr) 82px;
  gap: 10px;
  align-items: center;
  font-size: 12px;
}

.bar-row > strong {
  text-align: right;
  white-space: nowrap;
}

.linked-bar-row {
  width: 100%;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  padding: 4px 6px;
  text-align: left;
}

.linked-bar-row:hover,
.linked-bar-row.is-active {
  border-color: #a8cfe8;
  background: #eff7fc;
}

.linked-bar-row.is-active {
  box-shadow: inset 3px 0 0 var(--teal);
}

.bar-name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.bar-track {
  height: 10px;
  border-radius: 999px;
  background: #e4edf5;
  overflow: hidden;
}

.bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), #5aa9d6);
}

.donut-wrap {
  display: grid;
  place-items: center;
  min-height: 230px;
}

.donut-svg {
  width: 220px;
  height: 220px;
}

.donut-segment {
  cursor: pointer;
  outline: none;
  stroke: #fbfdfc;
  stroke-width: 1.5;
  transform-box: fill-box;
  transform-origin: center;
  transition: opacity 0.18s ease, stroke-width 0.18s ease, transform 0.18s ease;
}

.donut-segment:hover,
.donut-segment.is-active {
  opacity: 1;
  stroke: #d8ecfb;
  stroke-width: 4;
  filter: drop-shadow(0 4px 9px rgba(47, 127, 184, 0.28));
  transform: scale(1.025);
}

.donut-total {
  fill: var(--ink);
  font-size: 24px;
  font-weight: 800;
}

.donut-label {
  fill: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.linked-marker {
  display: inline-grid;
  min-height: 18px;
  place-items: center;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: #e4f1fb;
  color: #245f86;
  font-size: 11px;
}

.analysis-note {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid #d6e4ee;
  border-radius: 8px;
  background: #f8fbfd;
}

.analysis-note.primary {
  border-color: #a8cfe8;
  background: #eff7fc;
}

.analysis-note.subtle {
  background: #fbfdfc;
}

.analysis-note span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.analysis-note strong {
  color: var(--ink);
  font-size: 16px;
}

.analysis-note p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

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

.scale-table td:last-child {
  min-width: 180px;
}

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

.co-table {
  table-layout: fixed;
  min-width: calc(var(--co-label-width, 120px) + var(--co-option-count, 2) * 92px);
}

.co-table th,
.co-table td {
  height: 34px;
  padding: 5px;
  text-align: center;
  vertical-align: middle;
}

.co-table th:first-child {
  width: var(--co-label-width, 120px);
  text-align: left;
}

.co-axis-label {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.co-cell {
  display: grid;
  min-width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 6px;
  background: var(--teal);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
}

.matrix-table, table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.matrix-table th, .matrix-table td, table th, table td {
  border-bottom: 1px solid #dce8f1;
  padding: 9px 8px;
  text-align: left;
  vertical-align: top;
}

.matrix-table th, table th {
  color: #4d6477;
  background: var(--table-head);
  font-weight: 800;
}

.matrix-compact-table {
  table-layout: fixed;
}

.matrix-compact-table th,
.matrix-compact-table td {
  height: 38px;
  padding: 7px 8px;
  vertical-align: middle;
}

.matrix-compact-table th:first-child,
.matrix-compact-table td:first-child {
  width: 145px;
  max-width: 145px;
}

.matrix-item-name {
  display: block;
  overflow: hidden;
  max-width: 128px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.matrix-distribution-table {
  table-layout: fixed;
}

.matrix-distribution-table td {
  vertical-align: middle;
}

.matrix-distribution-table th:first-child,
.matrix-distribution-table td:first-child {
  width: 34%;
}

.matrix-distribution-table th:nth-child(2),
.matrix-distribution-table td:nth-child(2) {
  width: 46%;
  padding-right: 16px;
}

.matrix-distribution-table th:nth-child(3),
.matrix-distribution-table td:nth-child(3) {
  width: 10%;
  min-width: 64px;
  text-align: center;
}

.matrix-distribution-table th:nth-child(4),
.matrix-distribution-table td:nth-child(4) {
  width: 10%;
  min-width: 64px;
  text-align: center;
}

.matrix-distribution-table .matrix-item-name {
  max-width: none;
  overflow: visible;
  line-height: 1.45;
  text-overflow: clip;
  white-space: normal;
}

.matrix-distribution-table td:nth-child(3) strong {
  display: inline-block;
  min-width: 44px;
}

.dist-cell {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.dist-track {
  display: flex;
  width: 100%;
  min-width: 0;
  height: 30px;
  border-radius: 7px;
  background: #e6eff6;
  overflow: hidden;
}

.dist-seg {
  display: grid;
  min-width: 0;
  overflow: hidden;
  padding: 0 2px;
  border-right: 1px solid rgba(255, 255, 255, 0.52);
  place-items: center;
  color: #1f3244;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
  opacity: 0.9;
}

.dist-seg:last-child {
  border-right: 0;
}

.dist-labels {
  display: flex;
  width: 100%;
  gap: 0;
  color: #4d6477;
  font-size: 10px;
  font-weight: 700;
}

.dist-labels span {
  min-width: 0;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.heat {
  display: inline-grid;
  min-width: 52px;
  height: 26px;
  place-items: center;
  border-radius: 6px;
  color: #2d5e88;
  font-weight: 800;
}

.heat-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.heat-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.heat-swatch {
  width: 18px;
  height: 10px;
  border-radius: 999px;
}

.stack-row {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 10px;
  align-items: center;
  margin: 10px 0;
  font-size: 12px;
}

.stack-track {
  display: flex;
  height: 24px;
  border-radius: 6px;
  overflow: hidden;
  background: #e4edf5;
}

.stack-seg {
  display: grid;
  place-items: center;
  min-width: 2px;
  color: #fff;
  font-size: 11px;
}

.cross-stack-card {
  overflow: hidden;
}

.cross-stack-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.chart-card .cross-stack-card-head h4 {
  margin-bottom: 0;
}

.cross-label-controls {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
}

.cross-label-controls[hidden] {
  display: none;
}

.cross-label-controls > span {
  padding-right: 3px;
  color: #718594;
  font-size: 11px;
  font-weight: 800;
}

.cross-label-controls button {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  border: 1px solid #cddde8;
  border-radius: 7px;
  background: #fff;
  color: #687d8c;
  box-shadow: none;
  font-size: 12px;
  font-weight: 800;
}

.cross-label-controls button::before {
  display: grid;
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid #9fb8ca;
  border-radius: 3px;
  background: #fff;
  color: #fff;
  content: "";
  font-size: 10px;
  line-height: 1;
}

.cross-label-controls button:hover,
.cross-label-controls button:focus-visible {
  color: #245f86;
  outline: none;
}

.cross-label-controls button.is-active {
  border-color: #82b8da;
  background: #edf7fc;
  color: #245f86;
  box-shadow: none;
}

.cross-label-controls button.is-active::before {
  border-color: #3f86b6;
  background: #3f86b6;
  content: "✓";
}

.cross-stack-list {
  display: grid;
  gap: 18px;
  margin-top: 12px;
}

.cross-stack-row {
  display: grid;
  grid-template-columns: minmax(90px, 140px) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.cross-stack-group {
  min-width: 0;
  padding-top: 7px;
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cross-stack-body {
  min-width: 0;
}

.cross-stack-track {
  display: flex;
  width: 100%;
  height: 34px;
  overflow: hidden;
  border-radius: 7px;
  background: #e4edf5;
}

.cross-stack-seg {
  display: grid;
  min-width: 2px;
  place-items: center;
  border-right: 1px solid rgba(255, 255, 255, 0.72);
  color: #10283a;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  line-height: 1;
  text-shadow: none;
}

.cross-stack-seg:last-child {
  border-right: 0;
}

.cross-stack-seg-label {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 0 7px;
  overflow: hidden;
  text-overflow: clip;
  text-align: center;
  white-space: nowrap;
}

.cross-stack-seg-label[hidden],
.cross-stack-seg-label [hidden] {
  display: none;
}

.control-panel {
  box-shadow: none;
}

.control-grid, .query-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.control-panel .guide-box {
  margin-top: 16px;
}

.control-grid label, .query-row label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.query-builder {
  display: grid;
  gap: 10px;
  overflow: visible;
}

.query-row {
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.1fr) 42px;
  position: relative;
  overflow: visible;
  padding: 12px;
  border: 1px solid #d9e6ef;
  border-radius: 8px;
  background: #f8fbfd;
}

.query-heading-actions,
.sample-detail-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.panel-heading .query-heading-actions button:first-child,
.panel-heading .sample-detail-actions button {
  border-color: #77b6df;
  background: #3389bd;
  color: #fff;
}

.panel-heading button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.query-select {
  position: relative;
  min-width: 0;
}

.query-select-trigger {
  display: flex;
  width: 100%;
  min-height: 40px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 36px 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  text-align: left;
}

.query-select-trigger span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.query-select-trigger::after {
  position: absolute;
  right: 13px;
  width: 8px;
  height: 8px;
  border-right: 2px solid #47718f;
  border-bottom: 2px solid #47718f;
  content: "";
  transform: translateY(-2px) rotate(45deg);
  transition: transform 160ms ease;
}

.query-select.is-open .query-select-trigger {
  border-color: #6fb0da;
  box-shadow: 0 0 0 3px rgba(75, 153, 204, 0.14);
}

.query-select.is-open .query-select-trigger::after {
  transform: translateY(2px) rotate(225deg);
}

.query-select-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  display: grid;
  max-height: 286px;
  padding: 6px;
  overflow-y: auto;
  border: 1px solid #cbdde9;
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(24, 47, 68, 0.16);
}

.query-select-menu[hidden] {
  display: none;
}

.query-select-menu button {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #29475f;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
  text-align: left;
}

.query-select-menu button:hover,
.query-select-menu button:focus-visible {
  background: #eef7fc;
  color: #236a98;
  outline: none;
}

.query-select-menu button.is-selected {
  background: #dff0fa;
  color: #1f628e;
}

.query-detail-panel {
  min-height: 660px;
}

.sample-detail-actions input {
  width: min(360px, 32vw);
  min-width: 240px;
}

#sampleTable {
  min-height: 520px;
  max-height: min(760px, 72vh);
}

.icon-button {
  align-self: end;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--red);
  font-weight: 900;
}

.table-wrap {
  max-height: 540px;
  overflow: auto;
  border: 1px solid #d9e6ef;
  border-radius: 8px;
}

.table-wrap table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--table-head);
}

.stats-output table thead th,
.compact-data-table thead th,
.compact-table thead th {
  background: var(--table-head);
}

.compact-table {
  max-width: 100%;
}

.compact-data-table {
  table-layout: fixed;
}

#sampleTable .sample-data-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
}

#sampleTable .sample-data-table th,
#sampleTable .sample-data-table td {
  width: max-content;
  min-width: 112px;
  max-width: 320px;
}

#sampleTable .sample-data-table th.is-meta-column,
#sampleTable .sample-data-table td.is-meta-column {
  min-width: 126px;
}

#sampleTable .sample-data-table th:first-child,
#sampleTable .sample-data-table td:first-child {
  min-width: 64px;
}

#sampleTable .sample-cell-content {
  display: block;
  width: max-content;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-data-table th,
.compact-data-table td,
.compact-table th,
.compact-table td {
  max-width: 132px;
  height: 34px;
  padding: 7px 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

.compact-data-table th:first-child,
.compact-data-table td:first-child,
.compact-table th:first-child,
.compact-table td:first-child {
  max-width: 180px;
}

.word-cloud {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  min-height: 0;
  padding: 12px;
  border: 1px solid #dce8f1;
  border-radius: 8px;
  background: #f8fbfd;
}

.word-cloud span {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 26px;
  padding: 0 4px;
  color: var(--teal);
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.empty {
  display: grid;
  min-height: 220px;
  place-items: center;
  border: 1px dashed #c7dceb;
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.55);
}

.badge {
  display: inline-grid;
  min-height: 24px;
  place-items: center;
  padding: 0 8px;
  border-radius: 999px;
  background: #e4f1fb;
  color: #245f86;
  font-size: 12px;
  font-weight: 800;
}

.mini-note {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.boxplot-list {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 4px 0;
}

.boxplot-axis {
  display: flex;
  justify-content: space-between;
  margin-left: 112px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.boxplot-row {
  display: grid;
  grid-template-columns: 104px minmax(180px, 1fr) 46px;
  gap: 10px;
  align-items: center;
}

.boxplot-name {
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.boxplot-track {
  position: relative;
  height: 28px;
  border-radius: 999px;
  background: linear-gradient(90deg, #edf5fb, #f8fbfd);
}

.boxplot-whisker,
.boxplot-box,
.boxplot-median,
.boxplot-mean {
  position: absolute;
  top: 50%;
  display: block;
  transform: translateY(-50%);
}

.boxplot-whisker {
  height: 2px;
  border-radius: 999px;
  background: #7890a0;
}

.boxplot-box {
  height: 16px;
  border: 1px solid #2f7fb8;
  border-radius: 5px;
  background: rgba(89, 169, 214, 0.38);
}

.boxplot-median {
  width: 3px;
  height: 22px;
  border-radius: 999px;
  background: #17384d;
}

.boxplot-mean {
  width: 10px;
  height: 10px;
  margin-left: -5px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #c99634;
  box-shadow: 0 0 0 1px rgba(31, 50, 68, 0.18);
}

.boxplot-row strong {
  color: var(--ink);
  font-size: 12px;
  text-align: right;
}

.radar {
  width: 100%;
  height: 320px;
}

.spss-detail-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.spss-detail {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  padding: 16px;
  border: 1px solid #d9e6ef;
  border-radius: 8px;
  background: #fbfdfc;
}

.spss-detail.good { border-color: #a8cfe8; }
.spss-detail.mid { border-color: #d6e4ee; }
.spss-detail.warn { border-color: #ecd7b7; }

.spss-detail-head {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid #d7e6f0;
  border-left: 4px solid #17384d;
  border-radius: 8px;
  background: #eff6fb;
}

.spss-detail-head span,
.spss-evidence,
.spss-detail-head small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.spss-detail-head small {
  line-height: 1.55;
}

.spss-detail-head strong {
  color: var(--ink);
  font-size: 19px;
  line-height: 1.35;
}

.spss-detail-head em {
  color: #2d5e88;
  font-size: 20px;
  font-style: normal;
  font-weight: 900;
  line-height: 1.25;
}

.spss-detail-body {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.spss-judgement {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.spss-judgement b {
  color: #2d5e88;
  font-size: 18px;
  line-height: 1.35;
}

.spss-detail p,
.spss-next {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.spss-next {
  min-width: 0;
}

@media (max-width: 900px) {
  body { min-width: 0; }
  .app-shell { display: block; }
  .sidebar { position: static; height: auto; }
  body.is-sidebar-collapsed .sidebar { display: block; }
  .sidebar-toggle { display: none; }
  .workspace { padding: 18px 14px 32px; }
  .kpi-grid, .main-grid, .question-report, .category-workbench, .category-visual-layout, .split-chart-grid, .open-grid, .control-grid, .query-row, .guide-box, .type-map-grid, .scale-summary-grid, .spss-grid, .spss-detail-list, .stats-workbench, .stats-inline-controls, .stats-result-strip, .stats-reading-grid { grid-template-columns: 1fr; }
  .question-picker { position: static; width: 100%; height: auto; max-height: 420px; }
  .category-workbench { grid-template-columns: minmax(0, 1fr); }
  .category-workbench.is-picker-collapsed { grid-template-columns: 28px minmax(0, 1fr); }
  .panel-heading { align-items: stretch; }
  .cross-stack-card-head { align-items: flex-start; flex-wrap: wrap; }
  .cross-label-controls { align-self: flex-start; flex-wrap: wrap; }
  .query-heading-actions, .sample-detail-actions { align-items: stretch; flex-wrap: wrap; }
  .sample-detail-actions input { width: 100%; min-width: 0; }
  .query-row > .icon-button { justify-self: start; }
  #sampleTable { min-height: 420px; max-height: 68vh; }
  .category-heading-actions { align-self: flex-start; }
  .category-detail, .category-scroll-canvas { min-width: 0; }
  .category-visual-layout { grid-template-columns: minmax(720px, 1fr) minmax(280px, 300px); min-width: 1020px; }
  .category-chart-card { min-height: 0; }
  .cross-stack-card { overflow-x: auto; }
  .cross-stack-list { min-width: 720px; }
  .category-toolbar { justify-content: flex-start; flex-wrap: wrap; }
  .type-map-groups { grid-template-columns: 1fr; }
  .stats-model-list { position: static; }
  .spss-detail { grid-template-columns: 1fr; }
  .tabs { overflow: auto; }
  .survey-preview-modal { padding: 10px; }
  .survey-preview-dialog { height: calc(100vh - 20px); }
  .survey-preview-head { align-items: flex-start; flex-direction: column; }
  .survey-preview-actions { width: 100%; }
  .survey-preview-actions button { flex: 1 1 0; }
  .metadata-audit-grid { grid-template-columns: 1fr; }
  .metadata-audit-heading, .metadata-toolbar { align-items: stretch; flex-direction: column; }
  #metadataSearchInput { width: 100%; min-width: 0; }
}
