:root {
  --bg: #f3f6fa;
  --surface: #ffffff;
  --ink: #071b3a;
  --muted: #60708a;
  --line: #cfdbea;
  --primary: #10b8a6;
  --primary-dark: #079282;
  --accent: #009f8f;
  --accent-soft: #fff4df;
  --success-soft: #edfdfa;
  --shadow: 0 16px 42px rgba(34, 55, 92, 0.08);
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: none;
}

.site-header {
  align-items: center;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 24px;
  justify-content: space-between;
  padding: 10px max(18px, calc((100vw - 900px) / 2));
  position: sticky;
  top: 0;
  backdrop-filter: blur(14px);
  z-index: 10;
}

.brand {
  align-items: center;
  display: inline-flex;
  gap: 9px;
}

.brand-mark {
  align-items: center;
  background: var(--primary);
  border-radius: 7px;
  color: #fff;
  display: inline-flex;
  font-size: 17px;
  font-weight: 700;
  height: 30px;
  justify-content: center;
  width: 36px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 13px;
  font-weight: 700;
}

.brand small {
  color: var(--muted);
  font-size: 11px;
  margin-top: -2px;
}

.header-actions {
  display: flex;
  gap: 20px;
  font-size: 12px;
  font-weight: 600;
}

.header-actions a:hover {
  color: var(--primary);
}

main {
  overflow: hidden;
}

.tool-hero {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
  margin: 0 auto;
  max-width: 900px;
  padding: 14px 18px 10px;
}

.hero-copy {
  align-self: center;
}

.eyebrow {
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0 0 4px;
  text-transform: uppercase;
}

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

h1 {
  font-size: clamp(22px, 3vw, 28px);
  line-height: 1.16;
  margin-bottom: 5px;
}

.hero-text {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 0;
  max-width: 780px;
}

.calculator {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.calculator-form,
.result-panel {
  padding: 14px 18px;
}

.input-grid {
  align-items: start;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
}

.field,
.custom-rate {
  display: grid;
  gap: 8px;
}

.field > span,
.tax-rate-group legend,
.custom-rate span {
  color: #17243d;
  font-size: 12px;
  font-weight: 600;
}

.money-input {
  align-items: center;
  border: 1px solid var(--primary);
  border-radius: 7px;
  display: flex;
  min-height: 42px;
  overflow: hidden;
}

.money-input:focus-within {
  border-color: var(--primary-dark);
  box-shadow: 0 0 0 4px rgba(16, 184, 166, 0.13);
}

.money-input input {
  border: 0;
  color: var(--ink);
  flex: 1;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  min-width: 0;
  outline: 0;
  padding: 9px 14px;
}

.money-input span {
  background: #f1f6f9;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  height: 42px;
  padding: 11px 12px;
}

.field small {
  color: var(--muted);
  font-size: 12px;
}

.tax-rate-group {
  border: 0;
  margin: 0;
  padding: 0;
}

.method-group {
  background: #fbfbff;
  border: 0;
  border-radius: 8px;
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 10px 12px;
}

.method-group legend {
  color: #333b4f;
  float: left;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 7px;
  width: 100%;
}

.method-option {
  align-items: center;
  background: #f7f8fd;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #31384b;
  cursor: pointer;
  display: flex;
  gap: 10px;
  min-height: 38px;
  padding: 8px 12px;
}

.method-option input {
  accent-color: #6177ff;
  flex: 0 0 auto;
  height: 18px;
  margin: 0;
  width: 18px;
}

.method-option span {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
}

.method-option:has(input:checked) {
  background: #f2f3ff;
  border-color: #6177ff;
  box-shadow: 0 0 0 2px rgba(97, 119, 255, 0.18);
}

.rate-options {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(4, minmax(54px, 1fr));
  margin-top: 8px;
}

.rate-options label {
  cursor: pointer;
}

.rate-options input {
  position: absolute;
  opacity: 0;
}

.rate-options span {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  display: flex;
  font-size: 13px;
  font-weight: 700;
  justify-content: center;
  min-height: 34px;
}

.rate-options input:checked + span {
  background: var(--success-soft);
  border-color: var(--primary);
  color: var(--primary-dark);
}

.custom-rate {
  align-items: center;
  grid-template-columns: 1fr 86px;
  margin-top: 8px;
}

.custom-rate input {
  border: 1px solid var(--line);
  border-radius: 7px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  min-height: 34px;
  outline: 0;
  padding: 7px 10px;
  width: 100%;
}

.custom-rate input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(16, 184, 166, 0.13);
}

.form-actions {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(130px, 170px) 90px;
  justify-content: center;
  margin-top: 12px;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.primary-button,
.secondary-button,
.copy-button {
  border: 0;
  border-radius: 20px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  min-height: 35px;
  padding: 7px 14px;
}

.primary-button {
  background: var(--primary);
  box-shadow: 0 14px 28px rgba(16, 184, 166, 0.22);
  color: #fff;
}

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

.secondary-button,
.copy-button {
  background: #eef4f8;
  color: #263855;
}

.secondary-button:hover,
.copy-button:hover {
  background: #dfe9f0;
}

.result-panel {
  background: #fbfdff;
  border-top: 1px solid var(--line);
}

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

.result-heading p {
  font-size: 15px;
  font-weight: 700;
  margin: 0;
}

.copy-button {
  border-radius: 16px;
  min-height: 31px;
  padding: 5px 10px;
}

.result-list {
  display: grid;
  gap: 7px;
  grid-template-columns: 1fr;
  margin: 0;
}

.result-list div {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(150px, 0.9fr) minmax(0, 1.1fr);
  padding: 8px 12px;
}

.result-list dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.result-list dd {
  font-size: clamp(14px, 1.5vw, 17px);
  font-weight: 700;
  margin: 0;
  overflow-wrap: anywhere;
  text-align: right;
}

.result-list .total-row {
  background: var(--success-soft);
  border-color: rgba(16, 184, 166, 0.38);
}

.result-list .total-row dd {
  color: var(--primary-dark);
  font-size: clamp(15px, 1.7vw, 18px);
}

.result-list .words-row {
  align-items: start;
  background: var(--accent-soft);
  border-color: rgba(217, 119, 6, 0.28);
  grid-template-columns: 1fr;
  padding: 9px 12px;
}

.result-list .words-row dd {
  color: #6b3a04;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
  text-align: left;
}

.copy-status {
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 600;
  margin: 6px 0 0;
  min-height: 16px;
}

.content-section {
  margin: 0 auto;
  max-width: 900px;
  padding: 10px 18px;
}

.section-header {
  max-width: 680px;
}

.section-header h2 {
  font-size: clamp(18px, 2.4vw, 22px);
  line-height: 1.16;
  margin-bottom: 10px;
}

.info-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, 1fr);
}

.info-grid article {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}

.info-grid h3 {
  font-size: 13px;
  margin-bottom: 4px;
}

.info-grid p {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 7px;
}

.info-grid code {
  background: #eefbf8;
  border-radius: 6px;
  color: var(--primary-dark);
  display: block;
  font-size: 12px;
  font-weight: 600;
  padding: 8px;
  white-space: normal;
}

.faq-section {
  padding-top: 6px;
}

details {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 7px;
  padding: 9px 12px;
}

summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

details p {
  color: var(--muted);
  font-size: 12px;
  margin: 7px 0 0;
}

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  margin-top: 8px;
  padding: 10px max(18px, calc((100vw - 900px) / 2));
  text-align: center;
}

.site-footer p {
  margin: 0 auto;
  max-width: 860px;
}

@media (max-width: 860px) {
  .tool-hero {
    padding-top: 14px;
  }

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

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

@media (max-width: 560px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .header-actions {
    width: 100%;
  }

  .rate-options {
    grid-template-columns: repeat(2, 1fr);
  }

  .custom-rate,
  .result-list,
  .result-list div {
    grid-template-columns: 1fr;
  }

  .form-actions {
    grid-template-columns: 1fr 92px;
  }

  .result-list dd {
    text-align: left;
  }

  .money-input input {
    font-size: 16px;
  }
}
