:root {
  color: #18212f;
  background:
    radial-gradient(circle at top left, rgb(137 192 255 / 26%), transparent 34%),
    radial-gradient(circle at top right, rgb(115 212 184 / 22%), transparent 30%),
    linear-gradient(180deg, #f4f8fd 0%, #eef3f9 48%, #f7fafc 100%);
  --page-bg:
    radial-gradient(circle at top left, rgb(137 192 255 / 26%), transparent 34%),
    radial-gradient(circle at top right, rgb(115 212 184 / 22%), transparent 30%),
    linear-gradient(180deg, #f4f8fd 0%, #eef3f9 48%, #f7fafc 100%);
  --surface: rgb(255 255 255 / 72%);
  --surface-strong: rgb(255 255 255 / 84%);
  --surface-soft: rgb(247 250 252 / 88%);
  --surface-dark: rgb(18 41 63 / 78%);
  --line: rgb(193 206 219 / 68%);
  --line-strong: rgb(180 196 210 / 92%);
  --text-main: #18212f;
  --text-secondary: #607286;
  --brand: #0f7a73;
  --brand-strong: #0b6761;
  --brand-soft: #dff4ef;
  --accent: #2f5f87;
  --danger: #9b2f35;
  --shadow-soft: 0 18px 42px rgb(28 45 68 / 10%);
  --shadow-panel: 0 20px 52px rgb(27 44 66 / 12%);
  --shadow-button: 0 10px 24px rgb(15 122 115 / 16%);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text-main);
  background: var(--page-bg);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.shell {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

.app-header {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px 28px 18px;
  color: #fff;
  background:
    linear-gradient(135deg, rgb(18 49 82 / 92%), rgb(22 63 97 / 84%)),
    rgb(25 50 74 / 88%);
  border-bottom: 1px solid rgb(255 255 255 / 10%);
  box-shadow: 0 16px 36px rgb(18 37 57 / 14%);
  backdrop-filter: blur(18px);
}

.brand-block h1,
.topbar h2,
.section-title h3 {
  margin: 0;
  letter-spacing: 0;
}

.brand-block h1 {
  margin-top: 8px;
  font-size: 26px;
  line-height: 1.15;
}

.eyebrow {
  margin: 0;
  color: #6a7d91;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.brand-block .eyebrow {
  color: #9bd2cb;
}

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

.step-link {
  display: grid;
  gap: 0;
  min-width: 0;
  align-items: center;
  min-height: 72px;
  padding: 14px 18px;
  border: 1px solid rgb(255 255 255 / 14%);
  border-radius: 8px;
  color: #d7e4ef;
  background:
    linear-gradient(180deg, rgb(255 255 255 / 12%), rgb(255 255 255 / 4%)),
    rgb(255 255 255 / 6%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 14%);
  text-decoration: none;
  transition:
    transform 0.18s ease,
    background 0.18s ease,
    color 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.step-link:hover,
.step-link.active {
  color: #163047;
  background: #c7f0e8;
  border-color: #c7f0e8;
  box-shadow: 0 12px 28px rgb(6 62 58 / 14%);
}

.step-link:hover {
  transform: translateY(-1px);
}

.step-label {
  color: inherit;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.2;
}

.header-subnav {
  display: grid;
  justify-content: end;
}

.header-subnav .config-tabs {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  width: 220px;
  padding: 12px;
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgb(255 255 255 / 10%), rgb(255 255 255 / 4%)),
    rgb(255 255 255 / 6%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 12%);
  backdrop-filter: blur(16px);
}

.header-subnav .config-tab {
  justify-content: flex-start;
  min-height: 40px;
  color: #d7e4ef;
  border-color: rgb(255 255 255 / 12%);
  background:
    linear-gradient(180deg, rgb(255 255 255 / 12%), rgb(255 255 255 / 5%)),
    rgb(255 255 255 / 6%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 14%);
}

.header-subnav .config-tab:hover,
.header-subnav .config-tab.active {
  color: #163047;
  border-color: #c7f0e8;
  background: #c7f0e8;
  box-shadow: 0 10px 24px rgb(6 62 58 / 14%);
}

.metric span {
  color: #6a7d91;
  font-size: 13px;
}

.workspace {
  display: grid;
  gap: 22px;
  align-content: start;
  padding: 28px;
}

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

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

.topbar h2 {
  margin-top: 4px;
  font-size: 28px;
  color: #163047;
}

.topbar-title-only h2 {
  margin-top: 0;
  font-size: 36px;
  line-height: 1.1;
}

.table-panel,
.metric,
.config-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgb(255 255 255 / 78%), rgb(255 255 255 / 66%)),
    var(--surface);
  box-shadow: var(--shadow-panel);
  backdrop-filter: blur(18px);
}

.action-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.primary-button,
.secondary-button,
.ghost-button,
.text-button {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 700;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease,
    color 0.16s ease,
    border-color 0.16s ease;
}

.primary-button {
  color: #fff;
  background: linear-gradient(180deg, #14948b 0%, #0f7a73 100%);
  box-shadow: var(--shadow-button);
}

.secondary-button {
  color: #fff;
  background: linear-gradient(180deg, #376886 0%, #28506c 100%);
  box-shadow: 0 10px 22px rgb(40 80 108 / 18%);
}

.ghost-button {
  color: #19324a;
  background: linear-gradient(180deg, #edf4f8 0%, #dce8ee 100%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 72%);
}

.text-button {
  min-height: 34px;
  color: #9b2f35;
  background: linear-gradient(180deg, #fbeff0 0%, #f5e8ea 100%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 72%);
}

.primary-button:not(:disabled):hover,
.secondary-button:not(:disabled):hover,
.ghost-button:not(:disabled):hover,
.text-button:not(:disabled):hover,
.upload-button:hover,
.row-upload:hover,
.config-tab:hover,
.view-tab:hover,
.info-dot:hover {
  transform: translateY(-1px);
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.compact-button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

.upload-button {
  display: inline-grid;
  min-height: 42px;
  align-items: center;
  border-radius: 8px;
  padding: 0 16px;
  color: #19324a;
  background: linear-gradient(180deg, #edf4f8 0%, #dce8ee 100%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 78%);
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.upload-button input {
  display: none;
}

.row-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  white-space: nowrap;
}

.selection-cell {
  width: 44px;
  min-width: 44px;
  text-align: center;
}

.selection-cell input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.action-cell {
  width: 1%;
  white-space: nowrap;
}

.remark-cell {
  display: inline-flex;
  flex-direction: column;
  min-width: 64px;
  align-items: flex-start;
  justify-content: center;
  gap: 6px;
}

.remark-text {
  max-width: 140px;
  overflow: hidden;
  color: #385066;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.readonly-cell {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  color: var(--text-main);
  line-height: 1.6;
}

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

.metric {
  display: grid;
  gap: 8px;
  padding: 18px;
  background:
    linear-gradient(180deg, rgb(255 255 255 / 86%), rgb(248 251 253 / 76%)),
    var(--surface);
}

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

.summary-line {
  margin-top: 14px;
  color: #19324a;
  font-weight: 800;
}

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

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

.empty-panel {
  min-height: 240px;
}

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

.section-title h3 {
  font-size: 18px;
}

.section-title span {
  color: var(--text-secondary);
  font-size: 13px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid rgb(213 223 232 / 72%);
  border-radius: 8px;
  background: rgb(255 255 255 / 48%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 66%);
}

.upload-dropzone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px dashed rgb(124 152 175 / 55%);
  border-radius: 8px;
  padding: 22px;
  background:
    linear-gradient(180deg, rgb(255 255 255 / 82%), rgb(243 248 251 / 78%)),
    var(--surface-soft);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 74%);
}

.upload-dropzone strong {
  color: #19324a;
  font-size: 16px;
}

.upload-dropzone p {
  margin: 8px 0 0;
  color: #617386;
}

table {
  width: 100%;
  min-width: 1040px;
  border-collapse: collapse;
  background: transparent;
}

.progress-title {
  margin-top: 16px;
}

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

.progress-item {
  display: grid;
  gap: 6px;
  min-width: 0;
  border: 1px solid rgb(210 221 231 / 78%);
  border-radius: 8px;
  padding: 14px;
  background:
    linear-gradient(180deg, rgb(255 255 255 / 84%), rgb(245 249 252 / 76%)),
    var(--surface-soft);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 72%);
}

.progress-item span {
  color: #617386;
  font-size: 13px;
  font-weight: 700;
}

.progress-item strong {
  color: #19324a;
  font-size: 22px;
}

th,
td {
  padding: 13px 12px;
  border-bottom: 1px solid rgb(225 233 240 / 82%);
  text-align: left;
  vertical-align: top;
}

th {
  color: #5f7184;
  background: rgb(244 248 251 / 78%);
  font-size: 13px;
  font-weight: 800;
}

td {
  font-size: 14px;
  background: rgb(255 255 255 / 12%);
}

tbody tr:hover td {
  background: rgb(15 122 115 / 4%);
}

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

.group-row td {
  color: #19324a;
  background: rgb(233 242 246 / 88%);
  font-weight: 800;
}

.row-upload {
  display: inline-grid;
  max-width: 180px;
  min-height: 34px;
  align-items: center;
  border-radius: 8px;
  padding: 0 12px;
  color: #28506c;
  background: linear-gradient(180deg, #f4f8fb 0%, #eaf2f6 100%);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 72%);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.row-upload input {
  display: none;
}

.row-upload span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.config-panel {
  display: grid;
  gap: 18px;
}

.config-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: end;
}

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

.filter-bar {
  display: grid;
  grid-template-columns: repeat(7, minmax(130px, 1fr)) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
}

#differenceTypeFilterForm {
  grid-template-columns: 220px auto;
  justify-content: start;
}

.checkbox-filter {
  position: relative;
  border: 0;
  padding: 0;
  margin: 0;
}

.checkbox-filter legend {
  margin-bottom: 8px;
  color: #617386;
  font-size: 13px;
  font-weight: 700;
}

.checkbox-dropdown {
  position: relative;
}

.checkbox-dropdown summary {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid #cfd9e2;
  border-radius: 8px;
  background: #fff;
  color: #18212f;
  cursor: pointer;
  list-style: none;
}

.checkbox-dropdown summary::-webkit-details-marker {
  display: none;
}

.checkbox-dropdown summary::after {
  content: "⌄";
  margin-left: auto;
  color: #617386;
  font-size: 14px;
}

.checkbox-dropdown[open] summary {
  border-color: #0f7a73;
  outline: 2px solid rgb(15 122 115 / 16%);
}

.checkbox-dropdown[open] summary::after {
  transform: rotate(180deg);
}

.checkbox-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.checkbox-dropdown .checkbox-options {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  width: 320px;
  max-height: 280px;
  overflow: auto;
  padding: 12px;
  border: 1px solid #cfd9e2;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 32px rgb(24 33 47 / 12%);
}

.filter-bar .checkbox-options label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid #cfd9e2;
  border-radius: 8px;
  background: #fff;
  color: #263545;
  font-weight: 600;
}

.filter-bar .checkbox-options input[type="checkbox"] {
  width: 14px;
  min-height: 14px;
  margin: 0;
  padding: 0;
}

.config-form label,
.filter-bar label {
  display: grid;
  gap: 8px;
  color: #617386;
  font-size: 13px;
  font-weight: 700;
}

.config-form input,
.config-form select,
.filter-bar input,
.filter-bar select,
.cell-input,
.amount-input {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgb(197 209 220 / 88%);
  border-radius: 8px;
  padding: 0 12px;
  color: #18212f;
  background: rgb(255 255 255 / 88%);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 82%),
    0 6px 18px rgb(36 59 84 / 5%);
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease,
    transform 0.16s ease;
}

.amount-input {
  min-width: 120px;
}

.tolerance-amount-control {
  display: grid;
  grid-template-columns: 72px minmax(110px, 1fr) 96px;
  gap: 8px;
  align-items: center;
}

.tolerance-amount-control select,
.tolerance-amount-control input {
  width: 100%;
  min-height: 42px;
}

.config-form input:focus,
.config-form select:focus,
.filter-bar input:focus,
.filter-bar select:focus,
.cell-input:focus,
.amount-input:focus {
  border-color: #0f7a73;
  outline: 2px solid rgb(15 122 115 / 12%);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 88%),
    0 0 0 4px rgb(15 122 115 / 8%),
    0 12px 26px rgb(15 122 115 / 10%);
}

.view-panel {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid #e9eef2;
}

.config-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 4px;
}

.config-tab {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid rgb(202 214 224 / 86%);
  border-radius: 8px;
  color: #4a6075;
  background: linear-gradient(180deg, rgb(255 255 255 / 84%), rgb(244 248 251 / 76%));
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 72%);
  transition:
    transform 0.16s ease,
    color 0.16s ease,
    background 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}

.config-tab:hover,
.config-tab.active {
  color: #fff;
  border-color: #0f7a73;
  background: linear-gradient(180deg, #14948b 0%, #0f7a73 100%);
  box-shadow: 0 10px 24px rgb(15 122 115 / 16%);
}

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

.view-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  border-radius: 999px;
  padding: 0 10px 0 14px;
  color: #28506c;
  background: linear-gradient(180deg, rgb(255 255 255 / 84%), rgb(234 242 246 / 88%));
  font-weight: 800;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 72%);
  transition:
    transform 0.16s ease,
    background 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease;
}

.view-tab button {
  min-height: 30px;
  padding: 0;
  color: inherit;
  background: transparent;
  font-weight: inherit;
}

.view-tab a {
  color: inherit;
  text-decoration: none;
}

.view-tab.active {
  color: #fff;
  background: linear-gradient(180deg, #14948b 0%, #0f7a73 100%);
  box-shadow: 0 10px 24px rgb(15 122 115 / 16%);
}

.expected-payable-tabs {
  margin-bottom: 18px;
}

.country-match-tabs {
  margin-bottom: 18px;
}

.country-match-tabs .view-tab {
  min-height: 42px;
  border: 1px solid rgb(202 214 224 / 86%);
  border-radius: 8px;
  padding: 0 18px;
  background: linear-gradient(180deg, rgb(255 255 255 / 88%), rgb(244 248 251 / 84%));
}

.country-match-tabs .view-tab.active {
  border-color: #0f7a73;
  background: linear-gradient(180deg, #14948b 0%, #0f7a73 100%);
}

.expected-payable-tabs .view-tab {
  min-height: 42px;
  border: 1px solid rgb(202 214 224 / 86%);
  border-radius: 8px;
  padding: 0 18px;
  background: linear-gradient(180deg, rgb(255 255 255 / 88%), rgb(244 248 251 / 84%));
}

.expected-payable-tabs .view-tab.active {
  border-color: #0f7a73;
  background: #0f7a73;
}

.expected-payable-table {
  min-width: 1820px;
}

.expected-calc-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.expected-calc-form label {
  display: grid;
  gap: 8px;
  color: #617386;
  font-size: 13px;
  font-weight: 700;
}

.expected-calc-form input {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cfd9e2;
  border-radius: 8px;
  padding: 0 12px;
  color: #18212f;
  background: #fff;
}

.expected-calc-form input[readonly] {
  color: #617386;
  background: #f7fafc;
}

.view-delete {
  width: 22px;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
}

.view-delete:hover {
  background: rgb(255 255 255 / 22%);
}

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

.config-table {
  min-width: 1160px;
}

.config-table th:last-child,
.config-table td:last-child {
  width: 150px;
  text-align: right;
}

.data-table {
  min-width: 1680px;
}

.data-table input[type="checkbox"] {
  width: 16px;
  min-height: 16px;
  margin: 0;
}

.secondary-data-table {
  min-width: 1040px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  color: #0f5f59;
  background: linear-gradient(180deg, #eefaf7 0%, #dff4ef 100%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 72%);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.confidence-cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.info-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  min-height: 18px;
  border-radius: 50%;
  color: #28506c;
  background: linear-gradient(180deg, #edf4f8 0%, #dce8ee 100%);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 78%);
  transition: transform 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.info-dot:hover {
  color: #fff;
  background: #0f7a73;
}

.link-button {
  padding: 0;
  color: #0f7a73;
  background: transparent;
  font-weight: 800;
  text-decoration: underline;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: min(420px, calc(100vw - 48px));
  padding: 14px 16px;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(180deg, #b2474d 0%, #9b2f35 100%);
  box-shadow: 0 18px 40px rgb(0 0 0 / 20%);
  backdrop-filter: blur(12px);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgb(12 24 36 / 38%);
  backdrop-filter: blur(16px);
}

.modal-card {
  display: grid;
  gap: 18px;
  width: min(760px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border-radius: 8px;
  padding: 20px;
  border: 1px solid rgb(217 227 236 / 82%);
  background:
    linear-gradient(180deg, rgb(255 255 255 / 88%), rgb(247 250 252 / 84%)),
    var(--surface-strong);
  box-shadow: 0 24px 64px rgb(0 0 0 / 20%);
  backdrop-filter: blur(20px);
}

.confirm-card {
  width: min(420px, 100%);
}

.compact-modal {
  width: min(560px, 100%);
}

.formula-panel {
  display: grid;
  gap: 10px;
  border: 1px solid rgb(214 224 233 / 84%);
  border-radius: 8px;
  padding: 16px;
  background: linear-gradient(180deg, rgb(255 255 255 / 84%), rgb(244 248 251 / 78%));
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 72%);
}

.formula-panel p {
  margin: 0;
  color: #263545;
  line-height: 1.7;
}

.confirm-message {
  margin: 0;
  color: #263545;
  line-height: 1.7;
}

.danger-button {
  background: #9b2f35;
}

.modal-title,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-title h3 {
  margin: 0;
  font-size: 20px;
}

.modal-title button {
  width: 34px;
  min-height: 34px;
  border-radius: 50%;
  color: #28506c;
  background: linear-gradient(180deg, #f3f8fb 0%, #eaf2f6 100%);
  font-size: 20px;
  line-height: 1;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 78%);
}

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

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

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

.template-upload-panel {
  display: grid;
  gap: 14px;
  border: 1px solid rgb(209 220 230 / 82%);
  border-radius: 8px;
  padding: 16px;
  background: linear-gradient(180deg, rgb(255 255 255 / 84%), rgb(244 248 251 / 78%));
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 72%);
}

.template-upload-panel label {
  margin: 0;
}

.template-upload-panel input[type="file"] {
  background: #fff;
}

.template-actions {
  display: flex;
  justify-content: flex-end;
}

.import-mode-control {
  display: inline-flex;
  width: fit-content;
  overflow: hidden;
  border: 1px solid rgb(202 214 224 / 86%);
  border-radius: 8px;
  background: linear-gradient(180deg, rgb(255 255 255 / 84%), rgb(244 248 251 / 78%));
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 72%);
}

.import-mode-control label {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  color: #263545;
  font-size: 13px;
  font-weight: 800;
}

.import-mode-control label + label {
  border-left: 1px solid #cfd9e2;
}

.import-mode-control input {
  width: 14px;
  min-height: 14px;
  margin: 0;
}

.modal-form label {
  display: grid;
  gap: 8px;
  color: #617386;
  font-size: 13px;
  font-weight: 700;
}

.modal-form input,
.modal-form select,
.modal-form textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cfd9e2;
  border-radius: 8px;
  padding: 0 12px;
  color: #18212f;
  background: #fff;
}

.modal-form textarea {
  min-height: 120px;
  padding: 12px;
  resize: vertical;
  line-height: 1.5;
}

.modal-form input:focus,
.modal-form select:focus,
.modal-form textarea:focus {
  border-color: #0f7a73;
  outline: 2px solid rgb(15 122 115 / 16%);
}

.modal-checkbox-group {
  display: grid;
  gap: 8px;
  margin: 0;
  border: 0;
  padding: 0;
  color: #617386;
  font-size: 13px;
  font-weight: 700;
}

.modal-checkbox-group legend {
  padding: 0;
}

.modal-checkbox-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.modal-checkbox-options label {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  gap: 8px;
  border: 1px solid rgb(202 214 224 / 86%);
  border-radius: 8px;
  padding: 0 12px;
  color: #263545;
  background: linear-gradient(180deg, rgb(255 255 255 / 88%), rgb(244 248 251 / 82%));
  font-weight: 650;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 72%);
}

.modal-checkbox-options input[type="checkbox"] {
  width: 14px;
  min-height: 14px;
  margin: 0;
  padding: 0;
}

.modal-actions {
  justify-content: flex-end;
}

@media (max-width: 980px) {
  .content-grid {
    grid-template-columns: 1fr;
  }

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

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

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

  .config-form {
    grid-template-columns: 1fr;
  }

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

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

  .header-subnav {
    justify-content: stretch;
  }

  .header-subnav .config-tabs {
    width: 100%;
  }

}

@media (max-width: 640px) {
  .workspace,
  .app-header {
    padding: 20px;
  }

  .step-nav {
    grid-template-columns: 1fr;
  }

  .topbar,
  .section-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .progress-grid {
    grid-template-columns: 1fr;
  }

  .topbar h2 {
    font-size: 24px;
  }

  .topbar-title-only h2 {
    font-size: 30px;
  }

  .modal-form {
    grid-template-columns: 1fr;
  }

  .expected-calc-form {
    grid-template-columns: 1fr;
  }
}
