@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Source+Sans+3:wght@400;500;600&display=swap");

:root {
  color-scheme: light;
  --ink: #0f1115;
  --muted: #5d6270;
  --accent: #0f6fec;
  --accent-dark: #0a4cab;
  --card: #ffffff;
  --surface: #f6f4f0;
  --table-head: #f2ede6;
  --stroke: rgba(15, 17, 21, 0.1);
  --shadow: 0 30px 60px rgba(15, 17, 21, 0.12);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Source Sans 3", system-ui, sans-serif;
  background: radial-gradient(circle at top left, #fff6e8, transparent 52%),
    radial-gradient(circle at 25% 35%, #e8f0ff, transparent 40%),
    linear-gradient(180deg, #fefcf9, #f2eee6);
  color: var(--ink);
  min-height: 100vh;
}

h1,
h2 {
  font-family: "Space Grotesk", "Source Sans 3", system-ui, sans-serif;
}

.page {
  max-width: 1220px;
  margin: 0 auto;
  padding: 48px 24px 72px;
  display: flex;
  flex-direction: column;
  gap: 36px;
}

.topbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
}

.lang-label {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 600;
}

.lang-switch {
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: var(--card);
  color: var(--ink);
  padding: 6px 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 18px rgba(15, 17, 21, 0.08);
}

.hero {
  display: flex;
  gap: 32px;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  animation: rise 0.7s ease-out both;
}

.hero-copy {
  flex: 1 1 320px;
}

.eyebrow {
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.24em;
  font-size: 0.72rem;
  color: var(--accent);
  margin-bottom: 12px;
}

h1 {
  font-size: clamp(2.2rem, 3vw, 3.4rem);
  line-height: 1.05;
  margin-bottom: 12px;
}

.subhead {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 560px;
}

.hero-card {
  flex: 0 1 280px;
  background: var(--card);
  border-radius: 18px;
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--stroke);
  display: grid;
  gap: 16px;
}

#status-block,
#mode-block,
#api-helper {
  display: none;
}

body.dev-mode #status-block,
body.dev-mode #mode-block {
  display: flex;
}

body.dev-mode #api-helper {
  display: block;
}

.hero-toggle {
  display: grid;
  gap: 8px;
}

.toggle-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.toggle-label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--muted);
}

.toggle-label-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.info-inline {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
}

.toggle-hint {
  width: 100%;
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.toggle-code {
  font-weight: 600;
  color: var(--ink);
  background: var(--surface);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.8rem;
}

.switch {
  position: relative;
  width: 46px;
  height: 26px;
  display: inline-flex;
  align-items: center;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-track {
  position: absolute;
  inset: 0;
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: 999px;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.switch-track::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  top: 2px;
  left: 3px;
  border-radius: 50%;
  background: var(--card);
  box-shadow: 0 6px 12px rgba(15, 17, 21, 0.18);
  transition: transform 0.2s ease, background 0.2s ease;
}

.switch input:checked + .switch-track {
  background: rgba(15, 111, 236, 0.16);
  border-color: rgba(15, 111, 236, 0.5);
}

.switch input:checked + .switch-track::after {
  transform: translateX(20px);
  background: var(--accent);
}

.switch input:focus-visible + .switch-track {
  box-shadow: 0 0 0 3px rgba(15, 111, 236, 0.25);
}

.hero-metric {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}

.hero-mode {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}

.metric-label {
  color: var(--muted);
  font-size: 0.9rem;
}

.metric-value {
  font-size: 1.2rem;
}

.content {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(740px, 4fr);
  gap: 24px;
  animation: rise 0.9s ease-out both;
  animation-delay: 0.1s;
}

.is-faq .content {
  grid-template-columns: minmax(0, 1fr);
}

.is-faq .panel {
  width: min(100%, 960px);
  margin: 0 auto;
}

.panel {
  background: var(--card);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--stroke);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

label {
  font-weight: 600;
  font-size: 0.95rem;
}

.input-row {
  margin-top: 12px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  background: var(--surface);
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid transparent;
  transition: border-color 0.2s ease;
  width: 100%;
}

.input-stack {
  display: grid;
  gap: 12px;
  width: 100%;
}

.input-row:focus-within {
  border-color: rgba(15, 111, 236, 0.4);
}

.currency-select {
  font-weight: 600;
  color: var(--muted);
  min-width: 10px;
}

input {
  border: none;
  background: transparent;
  font-size: 1rem;
  outline: none;
  padding: 6px 0;
  width: 100%;
  min-width: 0;
}

select {
  border: none;
  background: transparent;
  font-size: 1rem;
  outline: none;
  padding: 6px 0;
  min-width: 0;
  color: var(--ink);
}

.input-row select {
  width: 100%;
}

input:disabled,
select:disabled {
  color: var(--muted);
  cursor: not-allowed;
}

.input-row.is-disabled {
  opacity: 0.6;
}

.primary {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 10px 18px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
  width: 100%;
}

.primary:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

.primary:disabled {
  opacity: 0.85;
  cursor: not-allowed;
  transform: none;
  background: #c9cfd8;
  color: #6b7280;
}

.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px dashed var(--stroke);
  border-radius: 12px;
  padding: 8px 14px;
  font-weight: 600;
}

.consent-block {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid rgba(15, 17, 21, 0.08);
}

.consent-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
}

.consent-text {
  background: none;
  border: none;
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-align: left;
}

.consent-text:hover {
  color: var(--accent);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 17, 21, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 50;
}

.modal.is-open {
  display: flex;
}

.modal-card {
  background: var(--card);
  border-radius: 18px;
  padding: 20px;
  max-width: 520px;
  width: 100%;
  box-shadow: var(--shadow);
  border: 1px solid var(--stroke);
  display: grid;
  gap: 12px;
}

.modal-legal-text {
  max-height: 60vh;
  overflow: auto;
  font-family: "Source Sans 3", system-ui, sans-serif;
  line-height: 1.45;
  font-size: 0.95rem;
}

.modal-legal-text h4 {
  margin: 12px 0 6px;
  font-size: 1rem;
}

.modal-legal-text p {
  margin: 0 0 10px;
}

.modal-legal-text ul {
  margin: 0 0 12px;
  padding-left: 0;
  list-style: none;
}

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

.modal-close {
  border: none;
  background: var(--surface);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--muted);
}

.modal-close:hover {
  color: var(--accent);
}

.helper {
  color: var(--muted);
  font-size: 0.9rem;
}

.error {
  min-height: 1.2rem;
  color: #b42318;
  font-weight: 600;
}

.table-wrap {
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  width: 100%;
  overflow-x: auto;
  min-width: 600px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
  table-layout: fixed;
  min-width: 760px;
}

.col-country {
  width: 28%;
}

.col-tax {
  width: 12%;
}

.col-health {
  width: 14%;
}

.col-social {
  width: 14%;
}

.col-rate {
  width: 10%;
}

.col-net {
  width: 22%;
}

thead {
  background: var(--table-head);
  text-align: left;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--stroke);
  white-space: nowrap;
}

th:nth-child(1),
td:nth-child(1) {
  padding-right: 24px;
}

th:nth-child(2),
td:nth-child(2) {
  padding-left: 20px;
  padding-right: 10px;
}

th:nth-child(3),
td:nth-child(3) {
  padding-left: 10px;
  padding-right: 10px;
}

th:nth-child(4),
td:nth-child(4) {
  padding-left: 10px;
  padding-right: 10px;
}

th {
  text-align: left;
}

th:nth-child(5),
td:nth-child(5) {
  width: 10%;
}

th:nth-child(6),
td:nth-child(6) {
  width: 18%;
}


.sort-button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  text-align: left;
  align-items: center;
  gap: 6px;
  white-space: normal;
  hyphens: manual;
}

.sort-button::after {
  content: "↕";
  font-size: 0.85em;
  color: var(--muted);
  width: 1em;
  text-align: center;
  display: inline-block;
}

.sort-button[data-dir="asc"]::after {
  content: "↑";
  color: var(--accent);
}

.sort-button[data-dir="desc"]::after {
  content: "↓";
  color: var(--accent);
}

.tooltip-cell.has-tooltip {
  cursor: help;
}

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

.country {
  font-weight: 600;
}

.info-toggle {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--stroke);
  background: var(--surface);
  color: var(--muted);
  font-weight: 700;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  padding: 0;
  line-height: 0;
}

.expand-toggle {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1px solid var(--stroke);
  background: var(--surface);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 6px;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  padding: 0;
  line-height: 0;
}

.expand-spacer {
  display: inline-flex;
  width: 22px;
  height: 22px;
  margin-right: 6px;
}

.expand-toggle:hover {
  transform: translateY(-1px);
  border-color: rgba(15, 111, 236, 0.4);
  color: var(--accent);
}

.expand-toggle[aria-expanded="true"] .expand-icon {
  transform: rotate(90deg);
}

.expand-icon {
  width: 12px;
  height: 12px;
  display: block;
  transition: transform 0.2s ease;
}

.info-icon {
  width: 14px;
  height: 14px;
  display: block;
}

.info-toggle:hover {
  transform: translateY(-1px);
  border-color: rgba(15, 111, 236, 0.4);
  color: var(--accent);
}

.note-row {
  background: rgba(15, 111, 236, 0.04);
}

.note-row td {
  padding: 0;
  border-bottom: 1px solid var(--stroke);
}

.note-panel {
  max-height: 0;
  overflow: hidden;
  padding: 0 16px;
  color: var(--muted);
  font-size: 0.92rem;
  white-space: normal;
  word-break: break-word;
  transition: max-height 0.25s ease, padding 0.25s ease;
}

.note-row.is-open .note-panel {
  max-height: 360px;
  padding: 12px 16px;
}

.sub-row {
  display: none;
  background: rgba(15, 111, 236, 0.04);
}

.sub-row.is-open {
  display: table-row;
}

.sub-row td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--stroke);
  font-size: 0.95rem;
  color: var(--muted);
}

.sub-country {
  padding-left: 36px;
  font-weight: 600;
  color: var(--ink);
}

.note {
  color: var(--muted);
  font-size: 0.9rem;
}

.contact-card {
  display: grid;
  gap: 6px;
  font-weight: 600;
  color: var(--ink);
}

.faq-list {
  display: grid;
  gap: 18px;
}

.faq-item h2 {
  font-size: 1.2rem;
  margin-bottom: 6px;
}

.footer {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.footer-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.footer-link:hover {
  text-decoration: underline;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 720px) {
  .topbar {
    justify-content: flex-start;
  }

  .hero {
    align-items: flex-start;
  }

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

  .hero-card {
    width: 100%;
  }

  .input-row {
    grid-template-columns: 1fr;
  }

  .primary {
    width: 100%;
  }
}
