:root {
  --bg: #f4f5f6;
  --surface: #ffffff;
  --text: #202326;
  --muted: #687078;
  --line: #d8dde1;
  --line-strong: #aeb6bd;
  --primary: #d3081b;
  --primary-hover: #ad0616;
  --success: #247347;
  --success-bg: #edf7f1;
  --warning: #8a5b00;
  --warning-bg: #fff7e5;
  --danger: #a71924;
  --danger-bg: #fff0f1;
  --focus: #1768a6;
  --page-gutters: clamp(24px, 4.6vw, 80px);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

body {
  margin: 0;
  min-width: 320px;
}

button,
input,
select {
  font: inherit;
  letter-spacing: 0;
}

.app-header {
  background: #25292d;
  color: #fff;
  border-bottom: 4px solid var(--primary);
}

.header-inner,
.steps ol,
footer {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

main {
  width: calc(100% - var(--page-gutters));
  margin: 0 auto;
}

.header-inner {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

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

h1 {
  margin-bottom: 3px;
  font-size: 26px;
  line-height: 1.2;
  font-weight: 700;
}

.subtitle {
  margin-bottom: 0;
  color: #c8cdd1;
  font-size: 14px;
}

.status-badge,
.section-state {
  border: 1px solid #586169;
  border-radius: 4px;
  padding: 5px 9px;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

.status-badge.online {
  color: #c9f3d8;
  border-color: #4e9a6c;
}

.status-badge.offline {
  color: #ffd0d4;
  border-color: #bb626a;
}

.steps {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.steps ol {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  list-style: none;
  padding: 0;
}

.steps li {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: var(--muted);
  font-size: 14px;
  border-bottom: 3px solid transparent;
}

.steps li span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  font-size: 12px;
}

.steps li.active {
  color: var(--text);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.steps li.active span,
.steps li.complete span {
  border-color: var(--primary);
  color: var(--primary);
}

main {
  padding: 34px 0 56px;
}

.workspace {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-bottom: 24px;
  padding: 26px;
}

#upload-section,
#result-section {
  max-width: 1180px;
  margin-right: auto;
  margin-left: auto;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
  line-height: 1.3;
}

h3 {
  margin-bottom: 14px;
  font-size: 15px;
  line-height: 1.3;
}

h4 {
  margin: 0;
  font-size: 15px;
  line-height: 1.3;
}

.section-state {
  color: var(--muted);
  border-color: var(--line);
}

.section-state.success {
  color: var(--success);
  border-color: #84b59a;
}

.instruction-panel {
  margin-bottom: 24px;
  padding: 18px 20px;
  border: 1px solid #adc9dc;
  border-radius: 5px;
  background: #eff6fa;
}

.instruction-panel h3 {
  color: #315d78;
}

.instruction-panel ol {
  margin: 0;
  padding-left: 22px;
  color: #315d78;
  font-size: 13px;
  line-height: 1.55;
}

.instruction-panel li + li {
  margin-top: 4px;
}

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

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

.upload-field {
  min-height: 190px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  border: 2px dashed var(--line-strong);
  border-radius: 6px;
  background: #fafbfb;
  cursor: pointer;
  text-align: center;
  transition: border-color 140ms ease, background-color 140ms ease;
}

.upload-field:hover,
.upload-field.dragover {
  border-color: var(--focus);
  background: #f1f7fb;
}

.upload-field.selected {
  border-style: solid;
  border-color: var(--success);
  background: var(--success-bg);
}

.upload-field input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.upload-type {
  min-width: 44px;
  padding: 5px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.file-name {
  max-width: 100%;
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.file-action {
  color: var(--focus);
  font-size: 13px;
  font-weight: 600;
}

.form-actions {
  min-height: 44px;
  margin-top: 22px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.split-actions .secondary-button {
  margin-right: auto;
}

.primary-button,
.secondary-button,
.download-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--primary);
  border-radius: 5px;
  padding: 9px 18px;
  background: var(--primary);
  color: #fff;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}

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

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

.secondary-button:hover {
  border-color: #7d878f;
  background: #f1f3f4;
}

.primary-button:disabled,
.secondary-button:disabled {
  border-color: #bec4c9;
  background: #bec4c9;
  color: #fff;
  cursor: not-allowed;
}

.primary-button:focus-visible,
.secondary-button:focus-visible,
.download-button:focus-visible,
.upload-field:focus-within,
select:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(23, 104, 166, 0.28);
  outline-offset: 2px;
}

.working-state {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 13px;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--line);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.error-message,
.notice {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: 4px;
  font-size: 13px;
  line-height: 1.45;
}

.error-message {
  border: 1px solid #e4a1a7;
  background: var(--danger-bg);
  color: var(--danger);
}

.notice.warning {
  border: 1px solid #e4c46f;
  background: var(--warning-bg);
  color: var(--warning);
}

.notice.neutral {
  border: 1px solid #adc9dc;
  background: #eff6fa;
  color: #315d78;
}

.settings-block + .settings-block,
.function-settings {
  margin-top: 30px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}

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

.block-heading h3 {
  margin-bottom: 5px;
}

.block-heading p,
.details-intro {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.function-mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
  border: 0;
}

.function-mode-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fafbfb;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}

.function-mode-card:hover {
  border-color: var(--line-strong);
  background: #fff;
}

.function-mode-card:has(input:checked) {
  border-color: #84b59a;
  background: var(--success-bg);
}

.function-mode-card.rebuild-mode-card:has(input:checked) {
  border-color: #d9ad5f;
  background: #fff7e7;
}

.function-mode-card:focus-within {
  outline: 3px solid rgba(23, 104, 166, 0.28);
  outline-offset: 1px;
}

.function-mode-card input {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  margin: 1px 0 0;
  accent-color: var(--success);
}

.function-mode-card span {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.function-mode-card strong {
  font-size: 14px;
}

.function-mode-card small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.function-mode-notice {
  margin: 14px 0 0;
}

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

.room-subfolder-hint {
  margin: 0 0 16px;
}

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

.room-subfolder-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}

.room-subfolder-card:hover {
  border-color: var(--line-strong);
  background: #fff;
}

.room-subfolder-card:has(input:checked) {
  border-color: #84b59a;
  background: var(--success-bg);
}

.room-subfolder-card:focus-within {
  outline: 3px solid rgba(23, 104, 166, 0.28);
  outline-offset: 1px;
}

.room-subfolder-card input {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  margin: 0;
  accent-color: var(--success);
}

.room-subfolder-card span {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.room-subfolder-card strong {
  font-size: 13px;
}

.room-subfolder-card small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.setting-card {
  min-width: 0;
  margin: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fafbfb;
}

.setting-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 15px;
}

.setting-badge {
  flex: none;
  padding: 4px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  background: #fff;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.setting-badge.detected {
  border-color: #84b59a;
  color: var(--success);
  background: var(--success-bg);
}

.setting-badge.required {
  border-color: #e4c46f;
  color: var(--warning);
  background: var(--warning-bg);
}

.control-field,
.search-field {
  display: grid;
  gap: 7px;
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
}

.control-field select,
.search-field input,
.compact-select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 8px 34px 8px 10px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
}

.field-help {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.icon-hint {
  margin: 0 0 16px;
}

.icon-catalog-panel {
  margin: 0 0 20px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fafbfb;
}

.icon-catalog-panel summary {
  width: fit-content;
  color: var(--focus);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.icon-catalog-search {
  max-width: 360px;
  margin: 12px 0;
}

.icon-catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 8px;
}

.icon-catalog-item {
  min-width: 0;
  min-height: 105px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 10px 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.25;
  text-align: center;
  overflow-wrap: anywhere;
}

.icon-catalog-item strong {
  color: var(--text);
  font-size: 11px;
}

.gpa-icon-choice {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.gpa-icon-choice.empty {
  color: var(--muted);
}

.gpa-icon-art {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: inline-grid;
  place-items: center;
  overflow: hidden;
}

.gpa-icon-art img {
  width: 34px;
  height: 34px;
  display: block;
  object-fit: contain;
}

.gpa-icon-fallback {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 4px;
  color: var(--muted);
  background: #f5f6f7;
  font-size: 9px;
  font-weight: 700;
}

.gpa-icon-label {
  min-width: 0;
  overflow-wrap: anywhere;
}

.profile-card {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.profile-card legend {
  max-width: 100%;
  padding: 0 5px;
  font-size: 14px;
  font-weight: 700;
}

.profile-card legend span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.control-label {
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
}

.compact-icon-picker {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
}

.icon-picker-trigger {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 5px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.icon-picker-trigger:hover {
  border-color: #7d878f;
  background: #f8f9f9;
}

.icon-picker-trigger:focus-visible,
.icon-picker-option:focus-visible,
.icon-picker-close:focus-visible {
  outline: 3px solid rgba(23, 104, 166, 0.28);
  outline-offset: 2px;
}

.icon-picker-trigger:disabled {
  border-color: var(--line);
  background: #f2f3f4;
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.72;
}

.icon-picker-trigger-label {
  min-width: 0;
  color: inherit;
  font-size: 11px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.compact-icon-picker .gpa-icon-art {
  width: 34px;
  height: 34px;
  flex-basis: 34px;
}

.compact-icon-picker .gpa-icon-art img,
.compact-icon-picker .gpa-icon-fallback {
  width: 30px;
  height: 30px;
}

.icon-picker-dialog {
  width: min(980px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100vh - 32px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 18px 65px rgba(23, 29, 34, 0.28);
}

.password-dialog {
  width: min(520px, calc(100vw - 32px));
  max-width: none;
  margin: auto;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 18px 65px rgba(23, 29, 34, 0.28);
}

.password-dialog::backdrop {
  background: rgba(20, 24, 28, 0.58);
}

.password-dialog-shell {
  display: grid;
  gap: 18px;
  padding: 22px;
}

.password-dialog-heading h2 {
  margin: 0 0 5px;
  font-size: 21px;
}

.password-dialog-heading p,
.password-privacy-note,
.password-transport-warning {
  margin: 0;
  line-height: 1.5;
}

.password-dialog-heading p {
  color: var(--muted);
  font-size: 13px;
}

.password-privacy-note {
  padding: 13px 14px;
  border-left: 4px solid var(--success);
  background: #eef8f2;
  font-size: 13px;
}

.password-transport-warning {
  padding: 13px 14px;
  border-left: 4px solid #a65b00;
  background: #fff4df;
  color: #653900;
  font-size: 13px;
}

.password-field {
  display: grid;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
}

.password-field input {
  width: 100%;
  min-height: 46px;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.password-field input:focus-visible {
  outline: 3px solid rgba(23, 104, 166, 0.28);
  outline-offset: 2px;
}

.password-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.icon-picker-dialog::backdrop {
  background: rgba(20, 24, 28, 0.58);
}

.icon-picker-shell {
  max-height: calc(100vh - 34px);
  display: flex;
  flex-direction: column;
  padding: 20px;
}

.icon-picker-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.icon-picker-heading h2 {
  margin: 0 0 4px;
  font-size: 20px;
}

.icon-picker-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.icon-picker-close {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
}

.icon-picker-close:hover {
  border-color: var(--line-strong);
  background: #f2f3f4;
}

.icon-picker-search {
  width: min(460px, 100%);
  margin: 18px 0 12px;
}

.icon-picker-toolbar {
  min-height: 42px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.icon-picker-toolbar .secondary-button {
  min-height: 36px;
  padding: 7px 12px;
  font-size: 11px;
}

.icon-picker-toolbar span {
  margin-left: auto;
  color: var(--muted);
  font-size: 11px;
}

.icon-picker-grid {
  min-height: 180px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 8px;
  overflow-y: auto;
  padding: 2px 4px 4px 2px;
  overscroll-behavior: contain;
}

.icon-picker-option {
  min-width: 0;
  min-height: 112px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 10px 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.25;
  text-align: center;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.icon-picker-option:hover {
  border-color: var(--line-strong);
  background: #f8f9f9;
}

.icon-picker-option.selected {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary);
  background: #fff7f8;
}

.icon-picker-option strong {
  color: var(--text);
  font-size: 11px;
}

.switch-control {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.switch-control legend {
  margin-bottom: 7px;
  padding: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
}

.segmented-control label {
  position: relative;
  cursor: pointer;
}

.segmented-control label + label {
  border-left: 1px solid var(--line-strong);
}

.segmented-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented-control span {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 7px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.segmented-control small {
  font-size: 9px;
}

.segmented-control input:checked + span {
  background: #fcebed;
  color: var(--primary);
  font-weight: 700;
}

.segmented-control input:focus-visible + span {
  outline: 3px solid rgba(23, 104, 166, 0.28);
  outline-offset: -3px;
}

.function-settings summary {
  width: fit-content;
  color: var(--focus);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.summary-count {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.details-intro {
  margin: 12px 0 16px;
}

.search-field {
  width: min(420px, 100%);
  margin-bottom: 14px;
}

.function-table {
  min-width: 680px;
}

.function-table td {
  vertical-align: middle;
}

.function-table td:nth-child(2) {
  color: var(--muted);
}

.compact-select {
  min-height: 36px;
  padding-top: 6px;
  padding-bottom: 6px;
  font-size: 12px;
}

.profile-override-select {
  min-width: 0;
}

.compact-select:disabled {
  border-color: var(--line);
  background: #f1f3f4;
  color: #8b9298;
  cursor: not-allowed;
}

.import-control {
  width: 100%;
  min-height: 36px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  cursor: pointer;
}

.import-control input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--success);
}

.import-control:hover {
  background: #eef1f3;
}

.import-control:focus-within {
  outline: 3px solid rgba(23, 104, 166, 0.28);
  outline-offset: 0;
}

.bulk-import-control {
  width: 100%;
  min-height: 24px;
  display: grid;
  place-items: center;
  margin-top: 3px;
  border-radius: 4px;
  cursor: pointer;
}

.bulk-import-control input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--success);
}

.bulk-import-control:hover {
  background: #eef1f3;
}

.bulk-import-control:focus-within {
  outline: 3px solid rgba(23, 104, 166, 0.28);
  outline-offset: 0;
}

.bulk-import-control:has(input:disabled) {
  background: transparent;
  cursor: not-allowed;
  opacity: 0.5;
}

tr.excluded-function td {
  background: #f2f3f4;
  color: var(--muted);
}

tr.excluded-function [data-function-name] {
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

tr.excluded-function .gpa-icon-art {
  opacity: 0.38;
}

.not-applicable {
  color: var(--muted);
}

.review-functions {
  margin: 0 0 30px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fafbfb;
}

.review-functions-heading {
  margin-bottom: 16px;
}

.review-toolbar {
  display: flex;
  align-items: end;
  gap: 16px;
  margin-bottom: 14px;
}

.review-scope {
  flex: none;
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
}

.review-scope button {
  min-height: 40px;
  border: 0;
  padding: 8px 13px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}

.review-scope button + button {
  border-left: 1px solid var(--line-strong);
}

.review-scope button[aria-pressed="true"] {
  background: #fcebed;
  color: var(--primary);
}

.review-scope button:disabled {
  color: #a1a8ad;
  background: #f1f3f4;
  cursor: not-allowed;
}

.review-scope button:focus-visible {
  position: relative;
  z-index: 1;
  outline: 3px solid rgba(23, 104, 166, 0.28);
  outline-offset: -3px;
}

.review-search {
  width: min(420px, 100%);
  margin: 0 0 0 auto;
}

.review-function-table {
  min-width: 840px;
}

.review-function-table td {
  vertical-align: middle;
}

.review-function-table tr.unresolved-location td {
  background: #fffbf1;
}

.review-location-badge {
  display: inline-flex;
  padding: 4px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.review-location-badge.warning {
  border-color: #e4c46f;
  background: var(--warning-bg);
  color: var(--warning);
}

.review-location-badge.success,
.review-location-badge.changed {
  border-color: #84b59a;
  background: var(--success-bg);
  color: var(--success);
}

.review-location-badge.excluded {
  border-color: #d38c92;
  background: var(--danger-bg);
  color: var(--danger);
}

.review-location-cell small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.review-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 14px;
}

.review-pagination .secondary-button {
  min-height: 34px;
  padding: 6px 12px;
  font-size: 12px;
}

.review-pagination span {
  min-width: 105px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.empty-state {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.ai-option {
  width: fit-content;
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}

.ai-option input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--primary);
}

.ai-option:focus-within {
  outline: 3px solid rgba(23, 104, 166, 0.28);
  outline-offset: 3px;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: 26px;
}

.metric {
  min-height: 88px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 14px 18px;
  border-right: 1px solid var(--line);
}

.metric:last-child {
  border-right: 0;
}

.review-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 26px;
}

.review-card {
  min-width: 0;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fafbfb;
}

.review-card h3 {
  margin-bottom: 11px;
}

.review-card dl {
  margin: 0;
}

.summary-row {
  display: grid;
  grid-template-columns: minmax(110px, 0.8fr) minmax(0, 1.2fr);
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

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

.summary-row dt {
  font-weight: 700;
}

.summary-row dd {
  margin: 0;
  color: var(--muted);
  text-align: right;
  overflow-wrap: anywhere;
}

.override-summary {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.metric strong {
  font-size: 24px;
  line-height: 1.1;
}

.metric span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

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

.data-panel {
  min-width: 0;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 5px;
}

.resizable-table {
  table-layout: fixed;
}

.resizable-table th {
  position: relative;
}

.resizable-table td {
  min-width: 0;
  overflow-wrap: anywhere;
}

.resizable-table .compact-select {
  min-width: 0;
  text-overflow: ellipsis;
}

.import-column,
.import-column-cell {
  padding-right: 6px;
  padding-left: 6px;
  text-align: center;
}

.column-resize-tools {
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin: -4px 0 6px;
  color: var(--muted);
  font-size: 11px;
}

.column-resize-tools p {
  margin: 0;
}

.column-resize-tools button {
  border: 0;
  padding: 4px 0;
  background: transparent;
  color: var(--focus);
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
}

.column-resize-tools button:hover {
  text-decoration: underline;
}

.column-resize-tools button:focus-visible {
  outline: 3px solid rgba(23, 104, 166, 0.28);
  outline-offset: 2px;
}

.column-resizer {
  position: absolute;
  z-index: 2;
  top: 0;
  right: -6px;
  width: 12px;
  height: 100%;
  cursor: col-resize;
  touch-action: none;
}

.column-resizer::after {
  position: absolute;
  top: 20%;
  right: 5px;
  width: 2px;
  height: 60%;
  border-radius: 2px;
  background: var(--line-strong);
  content: "";
  transition: background-color 120ms ease, box-shadow 120ms ease;
}

.column-resizer:hover::after,
.column-resizer:focus-visible::after,
.resizable-table.is-resizing .column-resizer.is-active::after {
  background: var(--focus);
  box-shadow: 0 0 0 2px rgba(23, 104, 166, 0.16);
}

.column-resizer:focus-visible {
  outline: 0;
}

.resizable-table.is-resizing,
.resizable-table.is-resizing * {
  cursor: col-resize !important;
  user-select: none;
}

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

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: #f5f6f7;
  color: #4c545b;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

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

td.numeric,
th.numeric {
  text-align: right;
}

.coverage-panel {
  margin-top: 26px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.coverage-panel summary {
  width: fit-content;
  margin-bottom: 14px;
  color: var(--focus);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.result-row p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.result-actions {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 10px;
}

footer {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: var(--muted);
  font-size: 12px;
}

.release-notes {
  position: relative;
}

.release-notes summary {
  color: var(--focus);
  font-weight: 650;
  cursor: pointer;
}

.release-notes ul {
  position: absolute;
  z-index: 2;
  bottom: calc(100% + 8px);
  left: 50%;
  width: min(440px, calc(100vw - 32px));
  margin: 0;
  padding: 16px 16px 16px 34px;
  transform: translateX(-50%);
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(32, 35, 38, 0.14);
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
  max-height: min(70vh, calc(100dvh - 32px));
  overflow-y: auto;
  overscroll-behavior: contain;
}

.release-notes li + li {
  margin-top: 6px;
}

[hidden] {
  display: none !important;
}

@media (max-width: 760px) {
  .header-inner,
  .steps ol,
  footer {
    width: min(100% - 24px, 1180px);
  }

  main {
    width: calc(100% - 24px);
  }

  .upload-grid,
  .preview-grid,
  .settings-card-grid,
  .profile-card-grid,
  .function-mode-grid,
  .review-summary {
    grid-template-columns: 1fr;
  }

  .steps li {
    min-width: 0;
    min-height: 66px;
    flex-direction: column;
    gap: 4px;
    font-size: 10px;
    text-align: center;
  }

  .steps li span {
    width: 22px;
    height: 22px;
  }

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

  .metric {
    border-bottom: 1px solid var(--line);
  }

  .metric:nth-child(even) {
    border-right: 0;
  }

  .workspace {
    padding: 18px;
  }

  .result-row,
  footer {
    align-items: stretch;
    flex-direction: column;
    justify-content: center;
  }

  .result-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .form-actions.split-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .split-actions .secondary-button {
    margin-right: 0;
  }

  .primary-button,
  .secondary-button {
    width: 100%;
  }

  .review-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .review-scope {
    display: grid;
    grid-template-columns: 1fr;
  }

  .review-scope button + button {
    border-top: 1px solid var(--line-strong);
    border-left: 0;
  }

  .review-search {
    width: 100%;
    margin-left: 0;
  }

  .column-resize-tools {
    align-items: flex-end;
    flex-direction: column;
    gap: 2px;
  }

  .review-pagination .secondary-button {
    width: auto;
  }

  .summary-row {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .summary-row dd {
    text-align: left;
  }

  .release-notes ul {
    position: static;
    width: 100%;
    margin-top: 10px;
    transform: none;
    max-height: min(60vh, calc(100dvh - 32px));
  }

  .download-button {
    width: 100%;
  }
}
