:root {
  color-scheme: light;
  --bg: #f4f7f9;
  --surface: #ffffff;
  --surface-soft: #eefbf9;
  --text: #1d2c3a;
  --muted: #6d6e71;
  --line: #d9e2e8;
  --teal: #00aea6;
  --teal-dark: #008c86;
  --fenavi-blue: #07157e;
  --fonav-red: #ef0037;
  --brand-yellow: #f8aa14;
  --amber: #c45c00;
  --danger: #b42318;
  --shadow: 0 10px 26px rgba(29, 44, 58, 0.07);
  font-family: Arial, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
}

body::after {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  height: 6px;
  background: var(--teal);
  content: "";
}

button,
input,
select {
  font: inherit;
}

.topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  min-height: 110px;
  padding: 20px 36px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar::after {
  position: absolute;
  right: 36px;
  bottom: -1px;
  left: 36px;
  height: 3px;
  background: linear-gradient(90deg, var(--teal), var(--fenavi-blue), var(--fonav-red));
  content: "";
}

.brand-title {
  min-width: 280px;
}

.brand-side {
  display: grid;
  justify-items: end;
  gap: 8px;
  min-width: 300px;
}

.brand-logo {
  display: block;
  width: min(330px, 34vw);
  height: auto;
  object-fit: contain;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--teal);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.42em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  color: #030712;
  font-size: 30px;
  font-weight: 800;
  line-height: 1.15;
}

h2 {
  color: #111827;
  font-size: 17px;
  font-weight: 800;
}

.source-note {
  max-width: 520px;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
  overflow-wrap: anywhere;
}

.app-shell,
.wizard-shell {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  gap: 18px;
  width: min(1480px, calc(100% - 32px));
  margin: 20px auto 34px;
}

.input-panel,
.wizard-sidebar,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.input-panel {
  position: sticky;
  top: 18px;
  align-self: start;
  padding: 18px;
  border-top: 4px solid var(--teal);
}

.wizard-sidebar {
  position: sticky;
  top: 18px;
  align-self: start;
  padding: 18px;
  border-top: 4px solid var(--teal);
}

.wizard-main {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.workspace {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.panel {
  padding: 18px;
  border-top: 3px solid rgba(0, 174, 166, 0.55);
}

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

.stepper {
  display: grid;
  gap: 8px;
  margin: 12px 0 18px;
}

.step-button {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 7px 9px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
}

.step-button span {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: var(--fenavi-blue);
  background: #eef1ff;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
}

.step-button strong {
  font-size: 14px;
}

.step-button.is-active {
  border-color: var(--teal);
  box-shadow: inset 3px 0 0 var(--teal);
}

.step-button.is-active span,
.step-button.is-complete span {
  color: #fff;
  background: var(--teal);
}

.wizard-summary {
  display: grid;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.summary-item {
  display: grid;
  gap: 3px;
}

.summary-item span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.summary-item strong {
  color: var(--text);
  font-size: 13px;
  line-height: 1.25;
}

.freshness-panel {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.freshness-panel .panel-heading {
  margin-bottom: 0;
}

.freshness-list {
  display: grid;
  gap: 8px;
  max-height: min(42vh, 380px);
  overflow: auto;
  padding-right: 4px;
}

.freshness-item {
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-left: 3px solid var(--teal);
  border-radius: 7px;
}

.freshness-item.needs-update {
  border-left-color: var(--brand-yellow);
}

.freshness-item strong {
  color: var(--fenavi-blue);
  font-size: 12px;
  line-height: 1.2;
}

.freshness-item span,
.freshness-item small,
.freshness-note {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.freshness-item span {
  color: var(--text);
  font-weight: 800;
}

.freshness-note {
  margin: 0;
}

.wizard-panel {
  display: none;
}

.wizard-panel.is-active {
  display: grid;
  gap: 18px;
}

.wizard-heading {
  display: grid;
  gap: 6px;
  padding: 2px 2px 0;
}

.step-kicker {
  margin: 0;
  color: var(--teal);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.36em;
  text-transform: uppercase;
}

.wizard-heading h2 {
  font-size: 26px;
}

.wizard-actions {
  position: sticky;
  bottom: 6px;
  z-index: 10;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px;
  background: rgba(244, 247, 249, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  backdrop-filter: blur(8px);
}

.wizard-actions .primary-button,
.wizard-actions .secondary-button {
  min-width: 130px;
}

.wizard-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border: 1px solid #b7d9d4;
  border-radius: 999px;
  color: var(--teal);
  background: var(--surface-soft);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.control-stack {
  display: grid;
  gap: 13px;
}

.field,
.toggle-row {
  display: grid;
  gap: 6px;
}

.field span,
.toggle-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.field small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.field small.is-data-backed {
  color: var(--teal-dark);
  font-weight: 800;
}

.field small.is-low-evidence {
  color: var(--amber);
  font-weight: 800;
}

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

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

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

input,
select {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  color: var(--text);
  background: #fff;
  border: 1px solid #c8d2df;
  border-radius: 6px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0, 174, 166, 0.16);
}

.toggle-row {
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  min-height: 34px;
}

.toggle-row input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--teal);
}

.primary-button,
.secondary-button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
}

.primary-button {
  color: #fff;
  background: var(--teal);
}

.primary-button:hover {
  background: var(--teal-dark);
}

.secondary-button {
  color: var(--fenavi-blue);
  background: #f7f9ff;
  border-color: #c7cef8;
}

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

.compact-metrics {
  grid-template-columns: repeat(2, minmax(170px, 1fr));
  margin-top: 14px;
}

.metric-card {
  display: grid;
  gap: 6px;
  min-height: 116px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric-card:nth-child(1) {
  border-top: 4px solid var(--teal);
}

.metric-card:nth-child(2) {
  border-top: 4px solid var(--fenavi-blue);
}

.metric-card:nth-child(3) {
  border-top: 4px solid var(--fonav-red);
}

.metric-card:nth-child(4) {
  border-top: 4px solid var(--brand-yellow);
}

.metric-card span,
.metric-card small {
  color: var(--muted);
}

.metric-card span {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.metric-card strong {
  color: #061021;
  font-size: 21px;
  font-weight: 800;
  line-height: 1.16;
}

.metric-card small {
  font-size: 12px;
}

.search-panel {
  display: grid;
  gap: 12px;
}

.result-panel {
  border-top-color: var(--fenavi-blue);
}

.result-selected {
  color: var(--text);
  font-weight: 700;
}

.engine-explanation {
  display: grid;
  gap: 12px;
  color: var(--text);
}

.engine-explanation p,
.engine-explanation ul {
  margin: 0;
}

.engine-explanation ul {
  padding-left: 18px;
  color: var(--muted);
}

.engine-best,
.engine-warning {
  display: grid;
  gap: 7px;
}

.engine-best strong {
  color: #061021;
  font-size: 18px;
}

.engine-warning strong {
  color: var(--fonav-red);
}

.export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: -4px 0 14px;
}

.simulation-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.summary-chip {
  display: grid;
  gap: 4px;
  min-height: 88px;
  padding: 11px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.summary-chip span,
.summary-chip small {
  color: var(--muted);
}

.summary-chip span {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.summary-chip strong {
  color: #061021;
  font-size: 17px;
  line-height: 1.15;
}

.summary-chip small {
  font-size: 12px;
}

.amortization-wrap table {
  min-width: 1080px;
}

.technical-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.panel-note {
  margin: -4px 0 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.inline-note {
  margin: 0 0 16px;
  padding: 10px 12px;
  color: var(--text);
  background: #f8fafc;
  border: 1px solid var(--line);
  border-left: 4px solid var(--teal);
  border-radius: 6px;
}

input[readonly] {
  color: var(--text);
  background: #f8fafc;
}

.availability-panel {
  border-top-color: var(--brand-yellow);
}

.availability-summary {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
}

.availability-summary p {
  margin: 0;
}

.availability-badges,
.source-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.availability-badges span {
  min-height: 26px;
  padding: 4px 9px;
  color: var(--fenavi-blue);
  background: #f7f9ff;
  border: 1px solid #c7cef8;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.availability-wrap table {
  min-width: 1280px;
}

.availability-state {
  display: inline-block;
  color: #061021;
  font-weight: 700;
}

.table-subtext {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.source-links a {
  color: var(--fenavi-blue);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.source-links a:hover {
  text-decoration: underline;
}

.help-term {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
}

.info-dot {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: #fff;
  background: var(--fenavi-blue);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  cursor: help;
  text-transform: none;
}

.info-dot:hover::after,
.info-dot:focus::after {
  display: none;
}

.info-dot:hover::before,
.info-dot:focus::before {
  display: none;
}

.global-tooltip {
  position: fixed;
  z-index: 9999;
  display: none;
  padding: 10px 12px;
  color: #fff;
  background: #061021;
  border-radius: 6px;
  box-shadow: var(--shadow);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.4;
  pointer-events: none;
  text-align: left;
}

.global-tooltip.is-visible {
  display: block;
}

.glossary-panel {
  margin-top: 12px;
  border-top-color: var(--teal);
}

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

.glossary-item {
  display: grid;
  gap: 4px;
  min-height: 116px;
  padding: 11px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.glossary-item strong {
  color: var(--fenavi-blue);
  font-size: 14px;
}

.glossary-item span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.glossary-item p {
  margin: 0;
  color: var(--text);
  font-size: 12px;
}

.best-candidate {
  border-left: 4px solid var(--teal);
}

.best-candidate strong {
  display: block;
  color: var(--fenavi-blue);
}

.best-candidate span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.technical-details {
  display: grid;
  gap: 12px;
}

.technical-details.is-hidden {
  display: none;
}

.technical-details summary {
  width: fit-content;
  min-height: 36px;
  padding: 8px 11px;
  color: var(--fenavi-blue);
  background: #f7f9ff;
  border: 1px solid #c7cef8;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 800;
}

.sidebar-glossary {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.sidebar-glossary summary {
  display: flex;
  align-items: center;
  width: 100%;
  justify-content: center;
  text-align: center;
}

.sidebar-help-panel {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.sidebar-glossary .glossary-list {
  display: flex;
  flex-direction: column;
  max-height: min(58vh, 560px);
  overflow: auto;
  padding-right: 4px;
}

.sidebar-glossary .glossary-item {
  display: block;
  min-height: 0;
  height: auto;
  padding: 10px;
  overflow: visible;
}

.sidebar-glossary .glossary-item strong,
.sidebar-glossary .glossary-item span,
.sidebar-glossary .glossary-item p {
  display: block;
  line-height: 1.35;
}

.sidebar-glossary .glossary-item span {
  margin-top: 3px;
}

.sidebar-glossary .glossary-item p {
  margin-top: 6px;
}

.technical-grid {
  margin-top: 12px;
}

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

.search-field input {
  min-height: 44px;
}

.search-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 34px;
}

.suggestion-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  max-width: 100%;
  padding: 6px 9px;
  color: var(--fenavi-blue);
  background: #f4f7ff;
  border: 1px solid #cbd4f2;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
}

.suggestion-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.suggestion-chip small {
  color: var(--teal-dark);
  font-size: 11px;
  font-weight: 900;
}

.suggestion-chip:hover {
  border-color: var(--teal);
  background: #eefcfa;
}

.selected-destination {
  min-height: 38px;
  padding: 9px 11px;
  color: var(--muted);
  background: #f9fbfd;
  border: 1px solid var(--line);
  border-radius: 6px;
}

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

.result-item {
  display: grid;
  gap: 8px;
  min-height: 176px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.result-item.is-selected {
  border-color: var(--teal);
  box-shadow: inset 0 0 0 1px var(--teal);
}

.result-item.has-ltps-special {
  border-color: rgba(0, 174, 166, 0.68);
  box-shadow: inset 4px 0 0 var(--teal);
}

.result-item.has-ltps-special .code-pill {
  color: #fff;
  background: var(--teal-dark);
}

.decision-box {
  display: grid;
  gap: 5px;
  margin: 2px 0 0;
  padding: 9px 10px;
  color: var(--text);
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.35;
}

.decision-box strong {
  color: var(--fenavi-blue);
}

.result-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.result-title strong {
  font-size: 15px;
}

.code-pill {
  align-self: start;
  padding: 2px 7px;
  border-radius: 999px;
  color: var(--fenavi-blue);
  background: #eef1ff;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

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

.result-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
}

.mini-tag {
  color: var(--amber);
  font-size: 12px;
  font-weight: 800;
}

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

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

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

th {
  color: var(--muted);
  background: #f8fafc;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

td {
  font-size: 13px;
}

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

.empty-row {
  color: var(--muted);
}

.trace-list,
.keyword-list {
  display: grid;
  gap: 10px;
}

.trace-item,
.keyword-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.trace-item:last-child,
.keyword-item:last-child {
  border-bottom: 0;
}

.trace-item strong,
.keyword-item strong {
  display: block;
  margin-bottom: 4px;
}

.trace-item span,
.keyword-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.loading-error {
  color: var(--danger);
  font-weight: 700;
}

@media (max-width: 1180px) {
  .metrics-grid,
  .result-list,
  .glossary-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

@media (max-width: 820px) {
  .topbar,
  .app-shell,
  .wizard-shell {
    width: 100%;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 16px;
  }

  .topbar::after {
    right: 16px;
    left: 16px;
  }

  .brand-side {
    justify-items: start;
    min-width: 0;
    width: 100%;
  }

  .brand-logo {
    width: min(280px, 92vw);
  }

  .eyebrow {
    max-width: 100%;
    font-size: 11px;
    letter-spacing: 0.12em;
    overflow-wrap: anywhere;
  }

  .source-note {
    max-width: none;
    font-size: 12px;
    text-align: left;
  }

  .app-shell,
  .wizard-shell {
    grid-template-columns: 1fr;
    margin: 0;
    padding: 14px;
  }

  .input-panel,
  .wizard-sidebar {
    position: static;
  }

  .metrics-grid,
  .result-list,
  .glossary-list,
  .field-grid,
  .input-grid,
  .simulation-grid,
  .simulation-summary,
  .compact-metrics {
    grid-template-columns: 1fr;
  }

  .metric-card {
    min-height: 98px;
  }

  .wizard-heading h2 {
    font-size: 22px;
  }

  .wizard-actions {
    bottom: 6px;
    flex-wrap: wrap;
  }

  .wizard-actions .primary-button,
  .wizard-actions .secondary-button {
    flex: 1 1 120px;
    min-width: 0;
  }

  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}
