* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: linear-gradient(145deg, #1a1d29 0%, #252a3a 100%);
  color: #e4e6eb;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.app {
  width: 100%;
  max-width: 720px;
}

.app-tablist {
  display: flex;
  gap: 0;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid #4a5164;
}

.app-tab {
  padding: 0.75rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: #a0a8b8;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.app-tab:hover {
  color: #e4e6eb;
}

.app-tab.active {
  color: #8b9ef5;
  border-bottom-color: #8b9ef5;
}

.app-tab:focus-visible {
  outline: 2px solid #8b9ef5;
  outline-offset: 2px;
}

.app-tabpanel {
  display: none;
}

.app-tabpanel.active {
  display: block;
}

.settings-section {
  margin-top: 1rem;
  max-width: 560px;
}

.settings-aliases-panel .panel-title {
  margin-bottom: 0.5rem;
}

.settings-aliases-panel .panel-content {
  overflow: visible;
}

.settings-section + .settings-section {
  margin-top: 2rem;
}

.settings-section-list-panels {
  max-width: 720px;
}

.settings-list-panels {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  max-width: 100%;
}

.settings-list-panels .panel {
  flex: 1 1 280px;
  min-width: 0;
}

.settings-name-list-panel .panel-title {
  margin-bottom: 0.5rem;
}

.settings-company-list-panel .panel-title {
  margin-bottom: 0.5rem;
}

.settings-panel-hint {
  color: #a0a8b8;
  font-size: 0.9375rem;
  margin: 0.5rem 0 0;
}

.name-list-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.name-list-input {
  flex: 1;
  min-width: 140px;
  font-size: 0.875rem;
  padding: 0.35rem 0.6rem;
  color: #e4e6eb;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid #4a5164;
  border-radius: 6px;
  font-family: inherit;
}

.name-list-input::placeholder {
  color: #6b7280;
}

.name-list-input:focus {
  outline: none;
  border-color: #6b7fd7;
}

.name-list-sync-btn {
  font-size: 0.8125rem;
  padding: 0.35rem 0.6rem;
  color: #9ca3af;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid #4a5164;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}

.name-list-sync-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #e5e7eb;
}

.name-list-table {
  margin-top: 0;
}

.settings-shortcut-list-panel .panel-title {
  margin-bottom: 0.5rem;
}

.shortcut-list {
  margin: 0.75rem 0 0;
  font-size: 0.9375rem;
}

.shortcut-list dt {
  font-weight: 600;
  color: #e4e6eb;
  margin-top: 0.75rem;
}

.shortcut-list dt:first-child {
  margin-top: 0;
}

.shortcut-list dd {
  margin: 0.25rem 0 0 1rem;
  color: #a0a8b8;
  line-height: 1.4;
}

.app.has-panels {
  max-width: 1120px;
}

/* When Section 2 (Match result) is visible, allow it to extend without horizontal bounding */
.app:has(#matchSection:not([hidden])) {
  max-width: none;
  overflow-x: auto;
}

h1 {
  text-align: center;
  font-weight: 600;
  font-size: 1.75rem;
  margin-bottom: 2rem;
  letter-spacing: -0.02em;
}

.drop-row {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.drop-box {
  flex: 1;
  min-width: 220px;
  max-width: 320px;
  aspect-ratio: 4/3;
  border: 2px dashed #4a5164;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}

.drop-box:hover,
.drop-box:focus-within {
  border-color: #6b7fd7;
  background: rgba(107, 127, 215, 0.08);
}

.drop-box.drag-over {
  border-color: #8b9ef5;
  background: rgba(139, 158, 245, 0.12);
  transform: scale(1.02);
}

.drop-box.has-file {
  border-style: solid;
  border-color: #5a9f6e;
  background: rgba(90, 159, 110, 0.1);
}

.drop-label {
  font-weight: 600;
  font-size: 1rem;
  color: #a0a8b8;
}

.drop-hint {
  font-size: 0.875rem;
  color: #6b7280;
}

.drop-box.has-file .drop-hint {
  display: none;
}

.file-name {
  font-size: 0.8125rem;
  color: #8b9ef5;
  max-width: 100%;
  padding: 0 0.75rem;
  text-align: center;
  word-break: break-all;
  min-height: 1.25rem;
}

.drop-box input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.drop-box {
  position: relative;
}

.run-buttons-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  align-items: center;
}

.run-buttons-row .run-btn {
  margin: 0;
}

.run-btn {
  display: block;
  margin: 0 auto;
  padding: 0.75rem 2.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #5a6fd6 0%, #7b5dd6 100%);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  box-shadow: 0 4px 14px rgba(90, 111, 214, 0.4);
}

.run-btn:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

.run-btn:active {
  transform: translateY(0);
}

.match-btn {
  margin-top: 1.5rem;
  display: none;
}

.match-btn.visible {
  display: block;
}

.save-result-btn {
  margin: 0;
}

.save-result-row {
  display: none;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  align-items: center;
  margin-top: 1.5rem;
  width: 100%;
}

.match-result-section .section-content > .save-result-row {
  flex-shrink: 0;
}

.save-result-row.visible {
  display: flex;
}

.save-result-row .save-result-btn {
  margin: 0;
}

.save-folder-note {
  font-size: 0.8125rem;
  color: #6b7280;
}

.parse-section .section-content {
  overflow: visible;
}

.parse-section {
  margin-top: 2rem;
  width: 100%;
  overflow: visible;
}

.parse-section:has(#panels[hidden]) {
  display: none;
}

.section1-toolbar {
  margin-bottom: 0.5rem;
}

.section1-export-context-menu {
  position: fixed;
  z-index: 10000;
  display: none;
  min-width: 11rem;
  padding: 0.25rem 0;
  background: var(--panel-bg, #2d3748);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.section1-export-context-menu.visible {
  display: block;
}
.section1-export-context-menu .section1-export-raw-btn {
  display: block;
  width: 100%;
  padding: 0.5rem 1rem;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--text-color, #e4e6eb);
  font-size: 0.875rem;
  cursor: pointer;
}
.section1-export-context-menu .section1-export-raw-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.section1-add-row-btn {
  font-size: 0.875rem;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  border: 1px solid #4a5568;
  border-radius: 4px;
  background: #2d3748;
  color: #e2e8f0;
}

.section1-add-row-btn:hover {
  background: #4a5568;
}

.section1-actions-cell {
  white-space: nowrap;
  vertical-align: middle;
  min-width: 8.5rem;
  width: 1%;
}

#panels .panel-left table.entries-table .copy-cell,
#panels .panel-right table.entries-table .copy-cell {
  min-width: 3.25rem;
  width: 1%;
  padding: 0.35rem 0.5rem;
}

.section1-edit-row-btn,
.section1-remove-row-btn {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  margin-right: 0.25rem;
  cursor: pointer;
  border-radius: 4px;
  border: 1px solid transparent;
}

.section1-edit-row-btn {
  background: #2b6cb0;
  color: #fff;
  border-color: #2c5282;
}

.section1-edit-row-btn:hover {
  background: #2c5282;
}

.section1-remove-row-btn {
  background: #c53030;
  color: #fff;
  border-color: #9b2c2c;
}

.section1-remove-row-btn:hover {
  background: #9b2c2c;
}

.section1-edit-input {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 0.25rem 0.35rem;
  font-size: 0.875rem;
  border: 1px solid #4a5568;
  border-radius: 3px;
  background: #1a202c;
  color: #e2e8f0;
  pointer-events: auto;
  cursor: text;
}

.section1-row-edit-mode .section1-edit-input:focus {
  outline: 2px solid #3182ce;
  outline-offset: 1px;
}

.section1-edit-input.section1-edit-num {
  min-width: 0;
}

.section1-row-edit-mode td {
  padding: 0.25rem;
  overflow: hidden;
}

#panels .panel-left table.entries-table.section1-editable,
#panels .panel-right table.entries-table.section1-editable {
  table-layout: fixed;
}

#panels .panel-left table.entries-table.section1-editable .section1-row-edit-mode td,
#panels .panel-right table.entries-table.section1-editable .section1-row-edit-mode td {
  overflow: hidden;
}

#panels .panel-left table.entries-table.section1-editable .section1-edit-input,
#panels .panel-right table.entries-table.section1-editable .section1-edit-input {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

#panels .panel-left table.entries-table tbody tr.qb-deposit-row td {
  color: #22c55e;
}
#panels .panel-left table.entries-table tbody tr.qb-deposit-row .section1-edit-input {
  color: #22c55e;
}

.parse-section .section-title,
.match-result-section .section-title {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0 0 1rem 0;
  padding: 0;
  width: 100%;
  text-align: left;
  font-size: 1.125rem;
  font-weight: 600;
  color: #a0a8b8;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.section-toggle-icon {
  font-size: 0.75rem;
  transition: transform 0.2s ease;
}

.toggle-section.collapsed .section-content {
  display: none;
}

.toggle-section.collapsed .section-toggle-icon {
  transform: rotate(-90deg);
}

.match-result-section {
  margin-top: 2rem;
  width: max-content;
  max-width: 100%;
}

.match-result-section .section-content {
  position: relative;
  overflow: visible;
  width: max-content;
}

.match-result-section .panels.match-panels {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
  margin-top: 0;
  min-height: 0;
  width: max-content;
}

.match-result-section .panels.match-panels .panel-aliases {
  flex: 0 0 auto;
  width: 100%;
  height: fit-content;
  overflow: visible;
}

.match-result-section .panels.match-panels .panel-aliases .panel-content {
  overflow: visible;
}

.match-result-section .panels.match-panels .panel {
  overflow: visible;
}

.match-result-section .match-panels-row {
  display: flex;
  align-items: flex-start;
  gap: 9rem;
  flex: 0 0 auto;
  width: max-content;
}

.match-result-section .match-panels-row .panel-left,
.match-result-section .match-panels-row .panel-right {
  flex: 0 0 auto;
  width: max-content;
  min-width: 0;
  overflow: visible;
  height: fit-content;
}

.match-result-section .match-panels-row .panel-left .panel-content,
.match-result-section .match-panels-row .panel-right .panel-content {
  overflow: visible;
}

.alias-toolbar {
  margin-bottom: 0.5rem;
}

.alias-add-btn {
  font-size: 0.8125rem;
  padding: 0.35rem 0.6rem;
  color: #9ca3af;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid #4a5164;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}

.alias-add-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #e5e7eb;
}

.alias-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.alias-table th,
.alias-table td {
  text-align: left;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid #3a3f4e;
}

.alias-table th {
  color: #a0a8b8;
  font-weight: 600;
}

.alias-table .alias-actions-cell {
  width: 1%;
  padding: 0.3rem;
}

.alias-table td input {
  width: 100%;
  min-width: 20ch;
  box-sizing: border-box;
  padding: 0.25rem 0.4rem;
  font-size: inherit;
  font-family: inherit;
  color: #e5e7eb;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid #4a5164;
  border-radius: 4px;
}

.alias-table td input:focus {
  outline: none;
  border-color: #6366f1;
}

.alias-delete-btn {
  font-size: 0.75rem;
  padding: 0.2rem 0.4rem;
  color: #9ca3af;
  background: transparent;
  border: 1px solid #4a5164;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
}

.alias-delete-btn:hover {
  color: #e53e3e;
  border-color: #e53e3e;
}

#matchSection .entries-table tbody tr.matched-algo td {
  color: #48bb78;
}

#matchSection .entries-table tbody tr.matched-user td {
  color: #3182ce;
}


#matchSection .panel-left .entries-table tbody tr.match-pair-selected td,
#matchSection .panel-right .entries-table tbody tr.match-pair-selected td {
  background-color: rgba(201, 162, 39, 0.35) !important;
  color: #b8860b !important;
  border-color: #c9a227;
}

#matchSection .panel-left .entries-table tbody tr.left-group-sum-row.match-pair-selected,
#matchSection .panel-left .entries-table tbody tr.left-row-group.match-pair-selected {
  background-color: rgba(201, 162, 39, 0.3) !important;
  border-color: #c9a227 !important;
}

#matchSection .panel-left .entries-table tbody tr.left-group-sum-row.match-pair-selected td,
#matchSection .panel-left .entries-table tbody tr.left-row-group.match-pair-selected td,
#matchSection .panel-left .entries-table tbody tr.left-group-sum-row.match-pair-selected td.num,
#matchSection .panel-left .entries-table tbody tr.left-row-group.match-pair-selected td.num {
  color: #b8860b !important;
  background-color: rgba(201, 162, 39, 0.25) !important;
}

#matchSection .match-lines-svg {
  z-index: 1;
}

#matchSection .match-arrow-group:hover line:not([stroke="transparent"]) {
  stroke-width: 2;
}

#matchSection .match-arrow-delete:hover circle {
  fill: #dd6b20;
  opacity: 0.9;
}

#matchSection .match-arrow-left-to-left-delete:hover circle {
  fill: #dd6b20;
  opacity: 0.9;
}

#matchSection .row-dot-cell {
  width: 0.1%;
  min-width: 20px;
  padding: 0 6px;
  vertical-align: middle;
  text-align: center;
}

#matchSection .panel-left .row-dot-cell {
  text-align: right;
}

#matchSection .panel-right .row-dot-cell {
  text-align: left;
  min-width: 32px;
  padding-left: 12px;
  cursor: move;
}

#matchSection .panel-left .entries-table tbody tr.left-row-selected {
  background: rgba(49, 130, 206, 0.15);
}

#matchSection .panel-left .entries-table tbody tr.left-row-problematic td {
  color: #e53e3e;
}

#matchSection .panel-left .entries-table tbody tr.left-row-problematic td.num {
  color: #c53030;
}

#matchSection .problematic-clear-btn {
  font-size: 11px;
  padding: 2px 8px;
  cursor: pointer;
  border: 1px solid #e53e3e;
  border-radius: 4px;
  background: #fff;
  color: #e53e3e;
}

#matchSection .problematic-clear-btn:hover {
  background: #e53e3e;
  color: #fff;
}

#matchSection .panel-left .entries-table tbody tr.left-group-sum-row {
  background: rgba(219, 39, 119, 0.12);
  border-top: 2px solid #db2777;
  border-left: 2px solid #db2777;
  border-right: 2px solid #db2777;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #e4e6eb;
}

#matchSection .panel-left .entries-table tbody tr.left-group-sum-row td.num {
  color: #e53e3e;
}

#matchSection .panel-left .entries-table tbody tr.left-row-group {
  border-left: 2px solid #db2777;
  border-right: 2px solid #db2777;
  background: rgba(219, 39, 119, 0.06);
}

#matchSection .panel-left .entries-table tbody tr.left-row-group-last {
  border-bottom: 2px solid #db2777;
}

#matchSection .panel-left .entries-table tbody tr.left-group-sum-row.matched-algo,
#matchSection .panel-left .entries-table tbody tr.left-row-group.matched-algo {
  border-color: #48bb78;
  background: rgba(72, 187, 120, 0.08);
}

#matchSection .panel-left .entries-table tbody tr.left-group-sum-row.matched-algo td.num {
  color: #48bb78;
}

#matchSection .panel-left .entries-table tbody tr.left-row-group-last.matched-algo {
  border-bottom-color: #48bb78;
}

#matchSection .panel-left .entries-table tbody tr.left-group-sum-row.matched-user,
#matchSection .panel-left .entries-table tbody tr.left-row-group.matched-user {
  border-color: #3182ce;
  background: rgba(49, 130, 206, 0.08);
}

#matchSection .panel-left .entries-table tbody tr.left-group-sum-row.matched-user td.num {
  color: #3182ce;
}

#matchSection .panel-left .entries-table tbody tr.left-row-group-last.matched-user {
  border-bottom-color: #3182ce;
}

#matchSection .panel-left .entries-table tbody tr.left-row-group .row-dot-cell {
  position: relative;
}

#matchSection .group-ungroup-btn {
  margin-left: 4px;
  margin-right: 14px;
  padding: 0 6px;
  font-size: 0.75rem;
  color: #9ca3af;
  background: transparent;
  border: 1px solid #4a5164;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  vertical-align: middle;
}

#matchSection .group-ungroup-btn:hover {
  color: #e53e3e;
  border-color: #e53e3e;
}

#matchSection .panel-left .panel-content {
  position: relative;
}

#matchSection .left-selection-total {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 0.35rem 0.6rem;
  font-size: 0.8125rem;
  color: #a0a8b8;
  border: 1px solid #4a5164;
  border-radius: 0 0 6px 6px;
  background: #1e2433;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  white-space: nowrap;
}

#matchSection .left-selection-total-spacer {
  display: block;
  height: 0;
  min-height: 0;
}

#matchSection .left-selection-total .left-selection-sum-num {
  color: #e53e3e;
  font-weight: 600;
}

#matchSection .right-selection-total {
  position: fixed;
  top: 2.15rem;
  left: 0;
  right: 0;
  z-index: 99;
  padding: 0.35rem 0.6rem;
  font-size: 0.8125rem;
  color: #a0a8b8;
  border: 1px solid #4a5164;
  border-radius: 0 0 6px 6px;
  background: #1e2433;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  white-space: nowrap;
  text-align: right;
}

#matchSection .right-selection-total-spacer {
  display: block;
  height: 0;
  min-height: 0;
}

#matchSection .right-selection-total .right-selection-sum-num {
  color: #e53e3e;
  font-weight: 600;
}

#matchSection .panel-right .entries-table tbody tr.right-row-selected {
  background: rgba(49, 130, 206, 0.15);
}

#matchSection .panel-right .entries-table tbody tr.right-group-sum-row {
  background: rgba(219, 39, 119, 0.12);
  border-top: 2px solid #db2777;
  border-left: 2px solid #db2777;
  border-right: 2px solid #db2777;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #e4e6eb;
}

#matchSection .panel-right .entries-table tbody tr.right-group-sum-row td.num {
  color: #e53e3e;
}

#matchSection .panel-right .entries-table tbody tr.right-row-group {
  border-left: 2px solid #db2777;
  border-right: 2px solid #db2777;
  background: rgba(219, 39, 119, 0.06);
}

#matchSection .panel-right .entries-table tbody tr.right-row-group-last {
  border-bottom: 2px solid #db2777;
}

#matchSection .panel-right .entries-table tbody tr.right-group-sum-row.matched-algo,
#matchSection .panel-right .entries-table tbody tr.right-row-group.matched-algo {
  border-color: #48bb78;
  background: rgba(72, 187, 120, 0.08);
}

#matchSection .panel-right .entries-table tbody tr.right-group-sum-row.matched-algo td.num {
  color: #48bb78;
}

#matchSection .panel-right .entries-table tbody tr.right-row-group-last.matched-algo {
  border-bottom-color: #48bb78;
}

#matchSection .panel-right .entries-table tbody tr.right-group-sum-row.matched-user,
#matchSection .panel-right .entries-table tbody tr.right-row-group.matched-user {
  border-color: #3182ce;
  background: rgba(49, 130, 206, 0.08);
}

#matchSection .panel-right .entries-table tbody tr.right-group-sum-row.matched-user td.num {
  color: #3182ce;
}

#matchSection .panel-right .entries-table tbody tr.right-row-group-last.matched-user {
  border-bottom-color: #3182ce;
}

#matchSection .panel-right .entries-table tbody tr.right-row-group .row-dot-cell {
  position: relative;
}

#matchSection .panel-right .panel-content {
  position: relative;
}

#matchSection .match-context-menu,
.match-context-menu {
  position: fixed;
  z-index: 2000;
  min-width: 160px;
  padding: 0.25rem 0;
  background: #1e2433;
  border: 1px solid #4a5164;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

#matchSection .match-context-menu button,
.match-context-menu button {
  display: block;
  width: 100%;
  padding: 0.4rem 0.75rem;
  font-size: 0.875rem;
  text-align: left;
  color: #e4e6eb;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

#matchSection .match-context-menu button:hover,
.match-context-menu button:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* Find match helper – floating draggable box */
.find-match-helper {
  position: fixed;
  z-index: 2500;
  min-width: 320px;
  max-width: 90vw;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  background: #1e2433;
  border: 1px solid #4a5164;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.find-match-helper-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid #4a5164;
  cursor: move;
  user-select: none;
}

.find-match-helper-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #e4e6eb;
}

.find-match-helper-close {
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
  color: #a0a8b8;
  background: none;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.find-match-helper-close:hover {
  color: #e4e6eb;
  background: rgba(255, 255, 255, 0.08);
}

.find-match-helper-modes {
  padding: 0.4rem 0.75rem;
  font-size: 0.8125rem;
  color: #9ca3af;
  border-bottom: 1px solid #3a4050;
}

.find-match-helper-mode-label {
  margin-right: 0.35rem;
}

.find-match-helper-list-wrap {
  flex: 1;
  overflow: auto;
  padding: 0.5rem;
}

.find-match-helper-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.find-match-helper-table th,
.find-match-helper-table td {
  padding: 0.35rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid #3a4050;
}

.find-match-helper-table th {
  color: #9ca3af;
  font-weight: 500;
}

.find-match-helper-table tbody tr {
  cursor: pointer;
}

.find-match-helper-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.06);
}

.find-match-helper-table .num {
  text-align: right;
}

.find-match-helper-mode-btn {
  margin-right: 0.5rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.8125rem;
  color: #9ca3af;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid #4a5164;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
}

.find-match-helper-mode-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #e4e6eb;
}

.find-match-helper-mode-btn.active {
  background: rgba(49, 130, 206, 0.25);
  border-color: #3182ce;
  color: #93c5fd;
}

.find-match-combo-row {
  vertical-align: top;
}

.find-match-combo-cells {
  max-width: 320px;
  max-height: 120px;
  overflow: auto;
}

.find-match-combo-line {
  font-size: 0.75rem;
  padding: 0.2rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.find-match-combo-line:last-child {
  border-bottom: none;
}

/* Error dialog (e.g. invalid group) */
.error-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.error-dialog-box {
  background: #1e2433;
  border: 1px solid #4a5164;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  max-width: 420px;
  width: 100%;
  padding: 1.25rem 1.5rem;
}

.error-dialog-title {
  margin: 0 0 0.75rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: #e4e6eb;
}

.error-dialog-message {
  margin: 0 0 1.25rem;
  font-size: 0.9375rem;
  color: #a0a8b8;
  line-height: 1.45;
}

.error-dialog-dismiss {
  display: block;
  margin-left: auto;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-family: inherit;
  color: #e4e6eb;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid #4a5164;
  border-radius: 6px;
  cursor: pointer;
}

.error-dialog-dismiss:hover {
  background: rgba(255, 255, 255, 0.15);
}

#matchSection .row-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4a5164;
  flex-shrink: 0;
}

.panels {
  display: none;
  gap: 1rem;
  margin-top: 2rem;
  width: 100%;
  min-height: 280px;
}

.panels.visible {
  display: flex;
}

/* Section 1: full content visible, no scrollbars */
#panels.visible {
  width: max-content;
  max-width: min(100%, calc(100vw - 2rem));
  min-height: 0;
  align-items: flex-start;
  flex-wrap: nowrap;
}

#panels .panel {
  overflow: visible;
  flex: 0 0 auto;
  height: auto;
  align-self: flex-start;
}

#panels .panel-content {
  overflow-x: auto;
  overflow-y: visible;
  flex: 0 0 auto;
  min-height: 0;
  max-width: min(100%, calc(100vw - 3rem));
}

#panels .left-and-raw-column,
#panels .middle-and-raw-column {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 0 0 auto;
  width: max-content;
  max-width: none;
  align-items: stretch;
}

#panels .raw-data-toggle .section-content {
  margin-top: 0;
}

#panels .raw-data-toggle .section-title {
  cursor: move;
  user-select: none;
}

#panels .panel-left,
#panels .panel-right,
#panels .panel-raw-box1 {
  width: max-content;
  max-width: min(100%, calc(100vw - 3rem));
}

#panels .panel-raw-box1 {
  min-width: 640px;
}

#panels .panel-raw-box2 {
  min-width: 640px;
}

#panels .panel .panel-title {
  cursor: move;
  user-select: none;
}

.panel {
  flex: 1;
  min-width: 0;
  border: 1px solid #4a5164;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  cursor: default;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.panel.panel-focused {
  border-color: #eab308;
  box-shadow: 0 0 0 2px rgba(234, 179, 8, 0.35);
}

.panel .search-highlight {
  background-color: rgba(234, 179, 8, 0.4);
  padding: 0 1px;
  border-radius: 2px;
}

.panel .search-highlight.search-highlight-current {
  background-color: rgba(234, 179, 8, 0.7);
  outline: 1px solid rgba(234, 179, 8, 0.9);
}

.panel-search-bar {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  background: #1e2433;
  border: 1px solid #4a5164;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.panel-search-bar input {
  width: 180px;
  padding: 0.35rem 0.5rem;
  font-size: 0.875rem;
  color: #e4e6eb;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid #4a5164;
  border-radius: 4px;
  font-family: inherit;
}

.panel-search-bar input::placeholder {
  color: #6b7280;
}

.panel-search-bar input:focus {
  outline: none;
  border-color: #eab308;
}

.panel-search-bar button {
  padding: 0.3rem 0.5rem;
  font-size: 0.8125rem;
  color: #9ca3af;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid #4a5164;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
}

.panel-search-bar button:hover {
  color: #e4e6eb;
  background: rgba(255, 255, 255, 0.12);
}

.panel-left {
  flex: 1 1 0;
  min-width: 0;
  width: max-content;
  max-width: 100%;
}

.panel-left .entries-table td {
  white-space: nowrap;
}

.panel-left .entries-table td:nth-child(4),
.panel-left .entries-table td:nth-child(5) {
  white-space: normal;
  word-break: break-word;
}

.panel-right {
  flex: 1 1 0;
  min-width: 0;
  width: max-content;
  max-width: 100%;
}

.panel-raw-box1 {
  flex: 0 0 auto;
  width: max-content;
  max-width: 100%;
  min-width: 640px;
  overflow: visible;
  align-self: flex-start;
  height: auto;
}

.panel-raw-box1 .panel-content-raw {
  padding: 0.5rem;
  overflow: visible;
  height: auto;
}

.panel-raw-box1 .raw-data-pre {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.75rem;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-all;
  overflow: visible;
  color: #9ca3af;
}

.panel-raw-box1 .raw-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.7rem;
  color: #9ca3af;
}

.panel-raw-box1 .raw-data-table th,
.panel-raw-box1 .raw-data-table td {
  border: 1px solid #4a5164;
  padding: 0.25rem 0.4rem;
  text-align: left;
  vertical-align: top;
  white-space: normal;
  word-break: break-word;
}

.panel-raw-box1 .raw-data-table th {
  background: rgba(255, 255, 255, 0.06);
  font-weight: 600;
  color: #a0a8b8;
}

.panel-raw-box2 {
  flex: 0 0 auto;
  width: max-content;
  max-width: 100%;
  min-width: 640px;
  overflow: visible;
  align-self: flex-start;
  height: auto;
}

.panel-raw-box2 .panel-content-raw {
  padding: 0.5rem;
  overflow: visible;
  height: auto;
}

.panel-raw-box2 .raw-data-pre {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.75rem;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-all;
  overflow: visible;
  color: #9ca3af;
}

.panel-raw-box2 .raw-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.7rem;
  color: #9ca3af;
}

.panel-raw-box2 .raw-data-table th,
.panel-raw-box2 .raw-data-table td {
  border: 1px solid #4a5164;
  padding: 0.25rem 0.4rem;
  text-align: left;
  vertical-align: top;
  white-space: normal;
  word-break: break-word;
}

.panel-raw-box2 .raw-data-table th {
  background: rgba(255, 255, 255, 0.06);
  font-weight: 600;
  color: #a0a8b8;
}

.statement-table td:nth-child(2),
.statement-table td:nth-child(3) {
  word-break: break-word;
  white-space: pre-line;
  vertical-align: top;
}

.statement-table td:nth-child(4) {
  white-space: nowrap;
  vertical-align: top;
}

.panel-title {
  margin: 0;
  padding: 0.75rem 1rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #a0a8b8;
  border-bottom: 1px solid #4a5164;
}

#matchSection .panel-title {
  cursor: move;
  user-select: none;
}

.panel-content {
  flex: 1;
  padding: 1rem;
  overflow: auto;
  color: #9ca3af;
  font-size: 0.875rem;
}

.entries-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.entries-table th,
.entries-table td {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid #3a3f4e;
}

.entries-table .copy-cell {
  width: 1%;
  white-space: nowrap;
  padding: 0.35rem 0.5rem;
  vertical-align: middle;
}

.panel-left .entries-table .copy-cell {
  text-align: left;
}

.panel-right .entries-table .copy-cell {
  text-align: right;
}

.row-copy-btn {
  font-size: 0.6875rem;
  padding: 0.2rem 0.4rem;
  color: #9ca3af;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid #4a5164;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}

.row-copy-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #e5e7eb;
}

.row-copy-btn:disabled {
  opacity: 0.8;
  cursor: default;
}

.entries-table th {
  color: #a0a8b8;
  font-weight: 600;
  white-space: nowrap;
}

.entries-table td {
  color: #e4e6eb;
}

.name-highlight {
  font-size: 0.85em;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  padding: 0 2px;
  margin: 0 4px;
  background: transparent;
}

.entries-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.04);
}

.entries-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
