:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --panel-subtle: #f9fafb;
  --text: #171a24;
  --text-secondary: #475467;
  --muted: #667085;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #f3f2ff;
  --success: #067647;
  --success-soft: #ecfdf3;
  --warning: #b54708;
  --warning-soft: #fffaeb;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --radius-sm: 8px;
  --radius: 12px;
  --header-height: 68px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 68px);
}

body {
  display: flex;
  min-height: 100vh;
  min-width: 320px;
  margin: 0;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button,
a,
select,
label {
  -webkit-tap-highlight-color: transparent;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3,
strong,
.metric-value,
.analysis-summary-value {
  font-variant-numeric: tabular-nums;
}

a {
  color: inherit;
}

svg {
  display: block;
}

::selection {
  background: #dddafe;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  padding: 9px 13px;
  border-radius: var(--radius-sm);
  background: var(--text);
  color: #fff;
  text-decoration: none;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: var(--header-height);
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1320px, 100%);
  min-height: var(--header-height);
  margin: 0 auto;
  padding: 0 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
}

.brand-mark svg {
  width: 25px;
  height: 25px;
}

.brand-copy {
  display: grid;
  line-height: 1.2;
}

.brand-copy strong {
  font-size: 15px;
  font-weight: 720;
}

.brand-copy small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.privacy-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--success);
  font-size: 12px;
  font-weight: 620;
}

.privacy-badge svg {
  width: 18px;
  height: 18px;
}

.header-cta {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 15px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
}

.header-cta:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.app-shell {
  width: min(1320px, 100%);
  margin: 0 auto;
  padding: 30px 24px 44px;
  flex: 1 0 auto;
}

@media (min-width: 1101px) {
  body:not(.has-results) .app-shell {
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
}

.workspace-intro {
  display: grid;
  grid-template-columns: minmax(300px, 0.78fr) minmax(500px, 1.22fr);
  gap: 32px;
  align-items: stretch;
}

body.has-results .workspace-intro {
  display: none;
}

.product-summary,
.upload-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}

.product-summary {
  padding: 32px;
}

.eyebrow,
.section-label {
  margin: 0 0 7px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.product-summary h1 {
  max-width: 11em;
  margin-bottom: 16px;
  font-size: clamp(30px, 3.4vw, 44px);
  font-weight: 740;
  letter-spacing: -0.035em;
  line-height: 1.18;
}

.product-summary h1 span {
  display: block;
}

.product-description {
  max-width: 620px;
  margin-bottom: 24px;
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.75;
}

.product-capabilities {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  color: var(--text-secondary);
  list-style: none;
}

.product-capabilities li {
  position: relative;
  padding-left: 24px;
}

.product-capabilities li::before {
  position: absolute;
  top: 0.2em;
  left: 0;
  color: var(--success);
  content: "✓";
  font-weight: 750;
}

.upload-panel {
  display: flex;
  min-width: 0;
  padding: 30px;
  flex-direction: column;
  justify-content: center;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.upload-panel.dragging {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.upload-heading {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 22px;
}

.upload-icon {
  display: grid;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
}

.upload-icon svg {
  width: 31px;
  height: 31px;
}

.upload-heading h2 {
  margin-bottom: 5px;
  font-size: 22px;
  font-weight: 720;
}

.upload-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

#csvFile {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

button,
.file-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

button svg,
.file-button svg {
  width: 18px;
  height: 18px;
  margin-right: 8px;
}

button:hover,
.file-button:hover {
  border-color: var(--primary-hover);
  background: var(--primary-hover);
}

.secondary-button {
  border-color: var(--border-strong);
  background: #fff;
  color: var(--text-secondary);
}

.secondary-button:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

button:disabled,
select:disabled {
  border-color: var(--border);
  background: #f2f4f7;
  color: #98a2b3;
  cursor: not-allowed;
}

button:disabled:hover {
  border-color: var(--border);
  background: #f2f4f7;
  color: #98a2b3;
}

.file-button {
  width: 100%;
  min-height: 48px;
  font-size: 15px;
}

body.is-loading .file-button {
  border-color: var(--border);
  background: #f2f4f7;
  color: #98a2b3;
  cursor: wait;
  pointer-events: none;
}

#csvFile:focus-visible + .file-button {
  outline: 3px solid rgba(79, 70, 229, 0.22);
  outline-offset: 2px;
}

.upload-options {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 10px;
  margin-top: 14px;
}

.encoding-control {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 42px;
  padding: 0 8px 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 620;
}

.encoding-control select {
  width: 100%;
  min-height: 32px;
  border: 0;
  background-color: var(--panel-subtle);
}

.upload-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 12px;
}

.upload-footer p {
  margin-bottom: 0;
}

.upload-footer a {
  flex: 0 0 auto;
  color: var(--primary);
  font-weight: 620;
  text-decoration: none;
}

.upload-footer a:hover {
  text-decoration: underline;
}

.status-panel {
  position: relative;
  margin-top: 18px;
  padding: 13px 16px 13px 44px;
  border: 1px solid #c7d7fe;
  border-radius: var(--radius-sm);
  background: #f5f8ff;
  color: #344054;
  font-size: 13px;
  font-weight: 580;
}

.status-panel::before {
  position: absolute;
  top: 50%;
  left: 17px;
  width: 14px;
  height: 14px;
  border: 2px solid #c7d7fe;
  border-top-color: var(--primary);
  border-radius: 50%;
  content: "";
  animation: spin 0.8s linear infinite;
  transform: translateY(-50%);
}

.status-panel.success {
  border-color: #abefc6;
  background: var(--success-soft);
  color: var(--success);
}

.status-panel.warning {
  border-color: #fedf89;
  background: var(--warning-soft);
  color: var(--warning);
}

.status-panel.error {
  border-color: #fecdca;
  background: var(--danger-soft);
  color: var(--danger);
}

.status-panel.success::before,
.status-panel.warning::before,
.status-panel.error::before {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border: 0;
  background: transparent;
  animation: none;
  content: "✓";
  font-size: 15px;
  font-weight: 800;
}

.status-panel.warning::before,
.status-panel.error::before {
  content: "!";
}

@keyframes spin {
  to { transform: translateY(-50%) rotate(360deg); }
}

.sheet-selection-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px 28px;
  align-items: end;
  margin-top: 18px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}

.sheet-selection-panel h2 {
  margin-bottom: 5px;
  font-size: 20px;
}

.muted-text {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.sheet-selection-controls {
  display: flex;
  gap: 10px;
  align-items: end;
}

.sheet-selection-controls label {
  display: grid;
  gap: 6px;
  min-width: 220px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 650;
}

.sheet-selection-controls select {
  width: 100%;
}

.sheet-selection-message {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.sheet-selection-message:empty {
  display: none;
}

.sheet-selection-message.error {
  color: var(--danger);
  font-weight: 620;
}

.results {
  margin-top: 22px;
}

body.has-results #statusPanel.success {
  display: none;
}

.report-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}

.report-header h2 {
  margin-bottom: 4px;
  font-size: 26px;
  font-weight: 740;
  letter-spacing: -0.025em;
}

.source-name {
  overflow: hidden;
  max-width: min(70vw, 760px);
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.results-nav {
  position: sticky;
  top: var(--header-height);
  z-index: 20;
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.97);
}

.desktop-results-nav {
  display: flex;
  flex: 1 1 auto;
  gap: 4px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.results-nav nav a {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 11px;
  border-radius: 7px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
}

.results-nav nav a span {
  color: #98a2b3;
  font-size: 11px;
}

.results-nav nav a:hover {
  background: #f2f4f7;
}

.results-nav nav a.active,
.results-nav nav a[aria-current="location"] {
  background: var(--primary-soft);
  color: var(--primary);
}

.results-nav nav a.active span,
.results-nav nav a[aria-current="location"] span {
  color: var(--primary);
}

.mobile-results-nav {
  display: none;
}

.global-filter-status {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 8px;
  align-items: center;
  min-height: 34px;
  padding: 0 9px;
  border-left: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.global-filter-status.active {
  color: var(--primary);
  font-weight: 650;
}

.global-filter-status .text-button {
  min-height: 28px;
  padding: 0 7px;
  font-size: 12px;
}

.section-block {
  margin-bottom: 14px;
  padding: 24px;
  scroll-margin-top: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.section-heading h2 {
  margin-bottom: 0;
  font-size: 21px;
  font-weight: 720;
  letter-spacing: -0.02em;
}

.section-note {
  margin: -4px 0 16px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.7;
}

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

.metric-card {
  min-height: 96px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-subtle);
}

.metric-label {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 560;
}

.metric-value {
  font-size: 27px;
  font-weight: 740;
  letter-spacing: -0.035em;
  line-height: 1;
}

.module-subsection {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.module-subsection.first {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.subsection-title {
  margin-bottom: 10px;
  font-size: 15px;
  font-weight: 680;
}

.table-wrap {
  position: relative;
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  -webkit-overflow-scrolling: touch;
}

.row-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin-top: 10px;
}

.row-pager-info {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
}

.row-pager-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.row-pager-buttons button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
}

.table-wrap.compact {
  max-height: 390px;
  overflow: auto;
}

.table-wrap:focus-visible {
  outline: 3px solid rgba(79, 70, 229, 0.18);
  outline-offset: 2px;
}

table {
  width: 100%;
  min-width: 680px;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
}

.two-column table {
  min-width: 500px;
}

th,
td {
  padding: 11px 13px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12px;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fafc;
  color: #344054;
  font-weight: 700;
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: #fafafa;
}

.two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.two-column > * {
  min-width: 0;
}

.quality-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.quality-pill {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-subtle);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 620;
}

.quality-pill.warning {
  border-color: #fedf89;
  background: var(--warning-soft);
  color: var(--warning);
}

.problem-view-button {
  min-height: 26px;
  padding: 0 8px;
  font-size: 12px;
  vertical-align: middle;
}

td .problem-view-button + .problem-view-button {
  margin-left: 6px;
}

.quality-summary .problem-view-button {
  min-height: 30px;
}

.placeholder-item .problem-view-button {
  margin-left: 8px;
}

.problem-view-none {
  color: var(--text-secondary);
  font-size: 12px;
}

.parse-warning-summary {
  margin: -6px 0 16px;
  color: var(--warning);
  font-size: 13px;
  font-weight: 620;
}

.problem-rows-message:empty {
  display: none;
}

.problem-rows-message {
  margin: 12px 0 0;
  color: var(--text-secondary);
  font-size: 13px;
}

.problem-rows {
  padding: 14px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--panel-subtle);
}

.problem-rows-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.problem-rows-heading .subsection-title {
  margin-bottom: 0;
}

.problem-rows-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.problem-rows-heading button {
  min-height: 34px;
  font-size: 12px;
}

.problem-rows-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.problem-rows-category {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 620;
}

.problem-rows-toolbar select {
  flex: 1 1 240px;
  max-width: 100%;
}

.problem-rows-summary,
.problem-rows-note {
  margin: 10px 0;
  font-size: 13px;
}

.problem-rows-note {
  color: var(--warning);
}

td.cell-problem {
  background: var(--warning-soft);
  color: var(--warning);
  font-weight: 650;
  box-shadow: inset 0 0 0 1px #fedf89;
}

.id-duplicate-field + .id-duplicate-field,
.id-duplicate-field + .id-duplicate-note,
.id-duplicate-note + .id-duplicate-field,
.id-duplicate-note + .id-duplicate-note {
  margin-top: 14px;
}

.id-duplicate-field-name {
  margin-bottom: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
}

.id-duplicate-field table {
  min-width: 500px;
}

.id-duplicate-note {
  margin-bottom: 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.7;
}

.id-duplicate-field .id-duplicate-note {
  margin-top: 8px;
}

.id-duplicate-note.warning {
  padding: 10px 12px;
  border: 1px solid #fedf89;
  border-radius: var(--radius-sm);
  background: var(--warning-soft);
  color: var(--warning);
}

.number-note-list {
  margin: 0;
  padding-left: 20px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.number-note-list li + li {
  margin-top: 6px;
}

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

.placeholder-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.placeholder-item {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}

.placeholder-list > :first-child {
  border-top: 0;
}

.placeholder-text {
  flex: 1 1 320px;
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.7;
}

.placeholder-item.confirmed .placeholder-text {
  color: var(--text-secondary);
}

.placeholder-note,
.placeholder-field-summary {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.7;
}

.placeholder-item .placeholder-note {
  flex-basis: 100%;
  order: 3;
}

.placeholder-note.warning {
  padding: 8px 10px;
  border: 1px solid #fedf89;
  border-radius: var(--radius-sm);
  background: var(--warning-soft);
  color: var(--warning);
}

.placeholder-field-summary {
  padding-bottom: 10px;
}

.placeholder-button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
}

.placeholder-message {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.placeholder-message:empty {
  display: none;
}

.placeholder-message.warning {
  color: var(--warning);
  font-weight: 620;
}

.placeholder-message.success {
  color: var(--success);
  font-weight: 620;
}

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

.filter-count-item {
  display: flex;
  min-width: 0;
  min-height: 74px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-subtle);
}

.filter-count-item.current {
  border-color: #c7d7fe;
  background: #f5f8ff;
}

.filter-count-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 620;
}

.filter-count-item strong {
  flex: 0 0 auto;
  font-size: 24px;
  font-weight: 740;
}

.filter-builder-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.filter-condition {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-subtle);
}

.filter-condition-heading {
  display: flex;
  min-height: 28px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.filter-condition-heading h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.filter-condition-heading span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-field-label,
.filter-search-label,
.filter-range-grid label {
  display: grid;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 650;
}

.filter-field-label select,
.filter-condition input {
  width: 100%;
  max-width: none;
}

.filter-condition input {
  min-height: 38px;
  padding: 0 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  outline: 0;
  background: #fff;
  color: var(--text);
  font-size: 13px;
}

.filter-condition input:disabled {
  background: #f2f4f7;
  color: var(--muted);
  cursor: not-allowed;
}

.category-filter-controls {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.filter-selection-actions {
  display: flex;
  gap: 12px;
}

.text-button {
  min-height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--primary);
  font-size: 12px;
  font-weight: 680;
  box-shadow: none;
}

.text-button:hover {
  background: transparent;
  color: var(--primary-hover);
}

.filter-value-list {
  display: grid;
  max-height: 184px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
}

.filter-value-option {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 36px;
  padding: 7px 9px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
}

.filter-value-option:last-child {
  border-bottom: 0;
}

.filter-value-option:hover {
  background: #fafafa;
}

.filter-value-option input {
  width: 16px;
  min-height: 16px;
  margin: 0;
  accent-color: var(--primary);
}

.filter-value-option .value-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-value-option .value-count {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.filter-empty-note,
.filter-value-empty {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.filter-value-empty {
  padding: 12px;
  text-align: center;
}

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

.filter-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.filter-message {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.filter-message.warning {
  color: var(--warning);
  font-weight: 620;
}

.filter-message.success {
  color: var(--success);
  font-weight: 620;
}

.filter-toolbar-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.filter-toolbar-actions button {
  min-height: 38px;
  font-size: 12px;
}

.field-config-toolbar {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-subtle);
}

.field-config-message {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.field-config-message.warning {
  color: var(--warning);
  font-weight: 620;
}

.field-config-message.success {
  color: var(--success);
  font-weight: 620;
}

.field-config-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.field-config-actions button {
  min-height: 38px;
  font-size: 12px;
}

.schema-type-select {
  min-width: 118px;
}

.schema-example {
  display: block;
  overflow: hidden;
  max-width: 250px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#schemaTable {
  min-width: 620px;
}

.schema-details summary {
  color: var(--primary);
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
}

.schema-details[open] summary {
  margin-bottom: 9px;
}

.schema-detail-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 10px;
  min-width: 210px;
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
}

.schema-detail-list dt,
.schema-detail-list dd {
  margin: 0;
}

.schema-detail-list dt {
  color: var(--muted);
}

.conversion-failure-count {
  color: var(--muted);
  font-weight: 700;
}

.conversion-failure-count.warning {
  color: var(--danger);
}

.cell-warning {
  background: var(--warning-soft);
  color: var(--warning);
  font-weight: 620;
}

.type-badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  background: #f2f4f7;
  color: #344054;
  font-size: 11px;
  font-weight: 700;
}

.type-badge.numeric {
  background: #eff8ff;
  color: #175cd3;
}

.type-badge.category {
  background: #f4f3ff;
  color: #5925dc;
}

.type-badge.date {
  background: var(--success-soft);
  color: var(--success);
}

.type-badge.id {
  background: var(--warning-soft);
  color: var(--warning);
}

.type-badge.ignore {
  background: #f2f4f7;
  color: var(--muted);
}

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

.frequency-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-subtle);
}

.frequency-card h3 {
  margin-bottom: 8px;
  font-size: 14px;
}

.frequency-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12px;
}

.frequency-row:last-child {
  border-bottom: 0;
}

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

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

.chart-card {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.chart-card.wide {
  grid-column: 1 / -1;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 38px;
  margin-bottom: 12px;
}

.chart-header h3 {
  margin-bottom: 0;
  font-size: 14px;
  font-weight: 680;
}

.chart-control {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 620;
}

.chart-control-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px 14px;
}

select {
  min-height: 38px;
  max-width: 280px;
  padding: 0 34px 0 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  outline: 0;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 20 20'%3E%3Cpath d='m6 8 4 4 4-4' fill='none' stroke='%23667085' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.7'/%3E%3C/svg%3E");
  background-position: right 9px center;
  background-repeat: no-repeat;
  color: var(--text);
  font-size: 13px;
  appearance: none;
}

select:hover {
  border-color: #98a2b3;
}

.chart-frame {
  position: relative;
  height: 310px;
}

.chart-insight {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-left: 3px solid var(--primary);
  border-radius: 0 7px 7px 0;
  background: var(--primary-soft);
  color: var(--text-secondary);
  font-size: 13px;
}

.chart-card.wide .chart-frame {
  height: 340px;
}

.analysis-panel {
  margin-top: 14px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-subtle);
}

.primary-analysis-panel {
  background: #fff;
}

.analysis-panel:first-of-type {
  margin-top: 0;
}

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

.analysis-panel-heading .subsection-title {
  margin-bottom: 0;
}

.analysis-panel-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
}

.field-selector-panel {
  display: grid;
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}

.field-selector-panel {
  grid-template-columns: repeat(3, minmax(160px, 1fr)) auto;
}

.custom-primary-controls {
  grid-template-columns: repeat(4, minmax(145px, 1fr)) auto;
}

.field-selector-panel label {
  display: grid;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 650;
}

.field-selector-panel select {
  width: 100%;
  max-width: none;
}

.analysis-prompt {
  min-height: 22px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
}

.analysis-prompt.warning {
  padding: 10px 12px;
  border: 1px solid #fedf89;
  border-radius: var(--radius-sm);
  background: var(--warning-soft);
  color: var(--warning);
  font-weight: 620;
}

.v2-analysis-results {
  display: grid;
  gap: 14px;
}

.custom-result-summary {
  margin: 0;
  padding: 11px 13px;
  border-left: 3px solid var(--primary);
  border-radius: 0 7px 7px 0;
  background: var(--primary-soft);
  color: var(--text-secondary);
  font-size: 13px;
}

.custom-result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}

.custom-result-table {
  min-width: 0;
}

.v2-trend-card {
  margin-top: 0;
}

.analysis-details {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-subtle);
}

.analysis-details > summary {
  padding: 13px 16px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 680;
  list-style-position: inside;
}

.analysis-details > summary:hover {
  color: var(--primary);
}

.analysis-details[open] > summary {
  border-bottom: 1px solid var(--border);
  background: #fff;
}

.analysis-details-content {
  padding: 16px;
}

.result-details {
  margin-top: 0;
  background: #fff;
}

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

.analysis-summary-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
}

.analysis-summary-label {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 620;
}

.analysis-summary-value {
  overflow: hidden;
  font-size: 18px;
  font-weight: 720;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-note {
  display: grid;
  min-height: 110px;
  padding: 22px;
  place-items: center;
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  background: var(--panel-subtle);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.data-export-options {
  border-top: 1px solid var(--border);
}

.export-module + .export-module {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.export-module-heading {
  margin-bottom: 14px;
}

.export-module-heading h3 {
  margin: 2px 0 0;
  font-size: 17px;
}

.data-export-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.data-export-option h3 {
  margin-bottom: 5px;
  font-size: 14px;
}

.data-export-option p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.data-export-option button {
  min-width: 164px;
}

.report-export-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
}

.report-export-copy h3 {
  margin-bottom: 6px;
  font-size: 15px;
}

.report-export-copy p {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

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

.inline-status {
  min-height: 20px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.inline-status:empty {
  display: none;
}

.inline-status.success {
  color: var(--success);
}

.inline-status.warning {
  color: var(--warning);
}

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

.inline-status.loading {
  color: var(--primary);
}

.app-footer {
  display: flex;
  justify-content: space-between;
  width: min(1320px, 100%);
  margin: 0 auto;
  padding: 0 24px 24px;
  color: var(--muted);
  font-size: 12px;
}

.app-footer p {
  margin-bottom: 0;
}

.app-footer strong {
  color: var(--text-secondary);
}

.app-footer a {
  color: inherit;
  text-decoration-color: transparent;
  text-underline-offset: 2px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.app-footer a:hover {
  color: var(--primary);
  text-decoration-color: currentColor;
}

.footer-github-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.footer-github-link svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

.hidden {
  display: none !important;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex="0"]:focus-visible {
  outline: 3px solid rgba(79, 70, 229, 0.22);
  outline-offset: 2px;
}

#reportTitle:focus {
  outline: none;
}

@media (max-width: 1100px) {
  .workspace-intro {
    grid-template-columns: 1fr;
  }

  .product-summary {
    padding: 28px;
  }

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

  .field-selector-panel {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .field-selector-panel button {
    width: 100%;
  }

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

  .filter-condition:first-child {
    grid-column: 1 / -1;
  }

  .two-column {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  :root {
    --header-height: 64px;
  }

  .header-inner,
  .app-shell,
  .app-footer {
    padding-right: 16px;
    padding-left: 16px;
  }

  .workspace-intro {
    gap: 14px;
  }

  .chart-grid,
  .category-grid {
    grid-template-columns: 1fr;
  }

  .chart-card.wide {
    grid-column: auto;
  }

  .chart-card.wide .chart-frame {
    height: 310px;
  }

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

  .custom-result-grid {
    grid-template-columns: 1fr;
  }

  .report-export-layout {
    grid-template-columns: 1fr;
  }

  .report-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  html {
    scroll-padding-top: 154px;
  }

  .brand-copy strong,
  .header-cta {
    white-space: nowrap;
  }

  .brand-copy strong {
    font-size: 14px;
  }

  .brand-copy small {
    display: none;
  }

  .privacy-badge {
    display: none;
  }

  .header-actions {
    gap: 10px;
  }

  .header-cta {
    min-height: 36px;
    padding: 0 11px;
    font-size: 12px;
  }

  .app-shell {
    padding-top: 16px;
    padding-bottom: 32px;
  }

  .product-summary,
  .upload-panel,
  .section-block,
  .report-header {
    padding: 18px;
  }

  .product-summary h1 {
    font-size: 30px;
  }

  .product-description {
    font-size: 14px;
  }

  .upload-heading {
    gap: 12px;
  }

  .upload-heading h2 {
    font-size: 19px;
  }

  .upload-options {
    grid-template-columns: 1fr;
  }

  .upload-footer,
  .report-header,
  .analysis-panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .report-header {
    display: flex;
  }

  .source-name {
    max-width: 100%;
  }

  .results-nav {
    position: sticky;
    top: var(--header-height);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 8px;
    margin-bottom: 10px;
    padding: 7px 8px;
  }

  .desktop-results-nav {
    display: none;
  }

  .mobile-results-nav {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    min-width: 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
  }

  .mobile-results-nav select {
    width: 100%;
    max-width: none;
    min-height: 36px;
  }

  .global-filter-status {
    grid-column: 1 / -1;
    justify-content: space-between;
    min-height: 30px;
    padding: 4px 2px 0;
    border-top: 1px solid var(--border);
    border-left: 0;
  }

  .section-block {
    scroll-margin-top: 0;
  }

  .section-heading {
    margin-bottom: 16px;
  }

  .section-heading h2 {
    font-size: 19px;
  }

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

  .metric-card {
    min-height: 88px;
    padding: 13px;
  }

  .metric-value {
    font-size: 24px;
  }

  .field-config-toolbar,
  .field-config-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .field-config-actions button {
    width: 100%;
  }

  .filter-builder-grid {
    grid-template-columns: 1fr;
  }

  .filter-condition:first-child {
    grid-column: auto;
  }

  .filter-toolbar,
  .filter-toolbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .filter-toolbar-actions button {
    width: 100%;
  }

  .data-export-option {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .data-export-option button {
    width: 100%;
    min-width: 0;
  }

  .filter-count-item {
    min-height: 68px;
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
    padding: 12px;
  }

  .filter-count-item strong {
    font-size: 21px;
  }

  table {
    min-width: 640px;
  }

  .chart-header {
    align-items: stretch;
    flex-direction: column;
  }

  .chart-control {
    display: grid;
  }

  .chart-control-group {
    display: grid;
    justify-content: stretch;
    gap: 10px;
  }

  .chart-control select {
    width: 100%;
    max-width: none;
  }

  .chart-frame,
  .chart-card.wide .chart-frame {
    height: 270px;
  }

  .analysis-panel {
    padding: 14px;
  }

  .field-selector-panel {
    grid-template-columns: 1fr;
  }

  .analysis-details-content {
    padding: 13px;
  }

  .field-selector-panel button {
    width: 100%;
  }

  .report-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .report-actions button {
    width: 100%;
  }

  .app-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
}

@media (max-width: 390px) {
  .product-summary h1 {
    font-size: 27px;
  }

  .filter-count-grid {
    grid-template-columns: 1fr;
  }

  .analysis-summary-grid {
    grid-template-columns: 1fr;
  }
}

@media print {
  body {
    background: #fff;
  }

  .app-header,
  .workspace-intro,
  #statusPanel,
  .sheet-selection-panel,
  .results-nav,
  .nav-new-analysis,
  .field-config-actions,
  .filter-toolbar-actions,
  .data-export-option button,
  .report-actions,
  .app-footer {
    display: none !important;
  }

  .app-shell,
  .results {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
  }

  .section-block,
  .chart-card,
  .metric-card {
    break-inside: avoid;
  }
}

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