:root {
  color-scheme:light;
  --bg:#f8f9fb;
  --surface:#fff;
  --text:#171b26;
  --text-muted:#687080;
  --border:#e5e8ef;
  --accent:#5147d9;
  --accent-light:#f0efff;
  --warning:#925017;
  --warning-bg:#fff6e9;
  --success:#18745a;
  --danger:#b33140;
  --surface-2:#f5f6f9;
  --radius:16px;
}

.not-found { padding-top: clamp(64px, 14vh, 144px); padding-bottom: 64px; }
.error-code { margin: 0 0 12px; color: var(--accent); font-size: 14px; font-weight: 650; letter-spacing: .08em; }
.not-found h1 { margin: 0 0 16px; font-size: clamp(30px, 6vw, 48px); line-height: 1.15; letter-spacing: -.04em; }
.not-found > p:last-of-type { color: var(--text-muted); margin: 0; }
.error-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 24px; margin-top: 32px; }
.error-actions a { min-height: 44px; display: inline-flex; align-items: center; gap: 20px; font-weight: 550; }
.error-actions .error-primary { padding: 12px 18px; border-radius: 10px; background: var(--accent); color: white; }
.error-actions .error-primary:hover { background: #4036bb; }

* {
  box-sizing:border-box;
}

body {
  margin:0;
  background:var(--bg);
  color:var(--text);
  font:15px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  -webkit-font-smoothing:antialiased;
}

button,input,select {
  font:inherit;
  color:inherit;
}

button,a,summary,input,select {
  -webkit-tap-highlight-color:transparent;
}

button,summary,select {
  cursor:pointer;
}

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

button {
  border:0;
  background:none;
}

button:hover,a:hover {
  color:var(--accent);
}

[hidden] {
  display:none!important;
}

button:focus-visible,a:focus-visible,summary:focus-visible,input:focus-visible,select:focus-visible {
  outline:3px solid #aba4ff;
  outline-offset:3px;
}

.sr-only {
  position:absolute;
  width:1px;
  height:1px;
  padding:0;
  margin:-1px;
  overflow:hidden;
  clip:rect(0,0,0,0);
  white-space:nowrap;
  border:0;
}

.top-nav {
  background:var(--surface);
  border-bottom:1px solid var(--border);
}

.nav-container {
  max-width:1120px;
  margin:auto;
  height:76px;
  padding:0 32px;
  display:flex;
  align-items:center;
  justify-content:space-between;
}

.brand {
  display:flex;
  align-items:center;
  gap:10px;
  font-weight:650;
  letter-spacing:-.025em;
  font-size:17px;
}

.nav-link {
  color:var(--text-muted);
  font-size:13px;
  padding:12px 0;
}

.nav-link span {
  margin-left:8px;
}

.container {
  max-width:1120px;
  margin:auto;
  padding:48px 32px 24px;
}

.page-head {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:16px;
  margin-bottom:28px;
}

.page-head h1 {
  font-size:34px;
  line-height:1.2;
  font-weight:650;
  letter-spacing:-.045em;
  margin:0;
}

.toolbar {
  display:flex;
  align-items:center;
  gap:8px;
}

.toolbar select {
  width:94px;
  background:white;
  padding:9px 12px;
  border:1px solid var(--border);
  border-radius:9px;
}

.year-badge,.status {
  font-size:11px;
  font-weight:550;
  padding:4px 8px;
  border-radius:6px;
  background:var(--accent-light);
  color:var(--accent);
  white-space:nowrap;
}

.tabs {
  display:flex;
  gap:4px;
  padding:5px;
  background:#edeff4;
  border:1px solid #e9ebf0;
  border-radius:12px;
  width:100%;
  margin-bottom:28px;
}

.tab {
  flex:1;
  font-size:13px;
  font-weight:550;
  white-space:nowrap;
  min-height:42px;
  border-radius:8px;
  color:var(--text-muted);
  padding:10px 16px;
}

.tab.active {
  background:white;
  color:var(--text);
  box-shadow:0 1px 4px #18224312;
}

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

.input-panel,.result-panel {
  min-width:0;
  border:1px solid var(--border);
  border-radius:20px;
  background:var(--surface);
}

.input-panel {
  padding:30px;
  display:flex;
  flex-direction:column;
  gap:24px;
}

.field {
  display:flex;
  flex-direction:column;
  gap:9px;
  min-width:0;
}

.field label,.check-row {
  font-size:13px;
  font-weight:550;
}

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

.amount-input {
  display:flex;
  align-items:center;
  border:1px solid #dfe3eb;
  border-radius:10px;
  background:white;
  min-width:0;
  transition:border-color .15s,box-shadow .15s;
}

.amount-input:focus-within {
  border-color:#8b83eb;
  box-shadow:0 0 0 3px #5147d90c;
}

.amount-input input {
  padding:13px 14px;
  min-width:0;
  width:100%;
  border:0;
  background:none;
  outline:none;
  font-variant-numeric:tabular-nums;
  font-size:17px;
}

.amount-input input:focus-visible {
  outline:none;
}

.amount-input span {
  font-size:12px;
  color:var(--text-muted);
  padding-right:14px;
  flex-shrink:0;
}

.revenue-field .amount-input input {
  font-size:27px;
  font-weight:550;
  padding:15px 16px;
  letter-spacing:-.035em;
}

input[type=number] {
  appearance:textfield;
  -moz-appearance:textfield;
}

input::-webkit-inner-spin-button,input::-webkit-outer-spin-button {
  -webkit-appearance:none;
  margin:0;
}

select {
  max-width:100%;
  width:100%;
  border:1px solid #dfe3eb;
  border-radius:10px;
  padding:13px 12px;
  background:white;
  font-size:14px;
  min-height:48px;
}

.mini-segment {
  display:flex;
  gap:2px;
  background:var(--surface-2);
  border-radius:7px;
  padding:3px;
}

.mini-segment button {
  border-radius:5px;
  color:var(--text-muted);
  padding:5px 9px;
  font-size:11px;
  font-weight:550;
  min-height:28px;
}

.mini-segment button[aria-pressed=true],.mini-segment button.active {
  background:white;
  box-shadow:0 1px 3px #18224316;
  color:var(--text);
}

.radio-group {
  display:flex;
  gap:8px;
}

.radio-btn {
  flex:1;
  min-height:46px;
  border:1px solid var(--border);
  border-radius:9px;
  font-size:14px;
  font-weight:550;
}

.radio-btn.active {
  color:var(--accent);
  border-color:#afa9ef;
  background:var(--accent-light);
}

.check-row {
  display:flex;
  align-items:flex-start;
  gap:9px;
  color:var(--text-muted);
  font-size:12px;
  font-weight:400;
  cursor:pointer;
}

.check-row input {
  accent-color:var(--accent);
  width:17px;
  height:17px;
  margin:0;
  flex-shrink:0;
}

.business-fields {
  display:flex;
  flex-direction:column;
  gap:22px;
  padding-top:4px;
}

.advanced {
  border-top:1px solid var(--border);
  padding-top:18px;
}

.advanced .field {
  margin-top:18px;
}

summary {
  font-size:13px;
  font-weight:550;
  list-style:none;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  min-height:30px;
}

summary::-webkit-details-marker {
  display:none;
}

summary::after {
  content:'+';
  font-size:19px;
  font-weight:400;
  color:var(--text-muted);
}

details[open]>summary::after {
  content:'−';
}

.result-panel {
  position:sticky;
  top:28px;
  padding:32px;
  background:linear-gradient(160deg,#fff 35%,#f8f8ff);
  box-shadow:0 12px 40px -25px #25234d30;
}

.result-top {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  color:var(--text-muted);
  font-size:13px;
}

.hero-value {
  font-size:clamp(32px,3.3vw,46px);
  font-weight:650;
  letter-spacing:-.055em;
  line-height:1.15;
  margin-top:30px;
  font-variant-numeric:tabular-nums;
  overflow-wrap:anywhere;
}

.hero-period {
  color:var(--text-muted);
  font-size:13px;
  margin-top:6px;
}

.annual-result {
  font-size:16px;
  font-weight:550;
  margin-top:22px;
  font-variant-numeric:tabular-nums;
}

.annual-result span {
  font-size:12px;
  color:var(--text-muted);
  font-weight:400;
}

.distribution {
  margin-top:26px;
  height:7px;
  background:#e4e1fa;
  border-radius:8px;
  overflow:hidden;
}

.distribution span {
  display:block;
  height:100%;
  border-radius:8px;
  background:var(--accent);
  transition:width .2s;
}

.result-lines {
  margin:22px 0 0;
  font-size:13px;
}

.result-lines>div {
  display:flex;
  justify-content:space-between;
  align-items:baseline;
  gap:16px;
  margin-top:14px;
}

.result-lines dt {
  color:var(--text-muted);
}

.result-lines dd {
  margin:0;
  font-weight:550;
  white-space:nowrap;
  font-variant-numeric:tabular-nums;
}

.rate {
  font-size:10px;
  color:#8b8d9d;
  margin-left:5px;
}

.result-note {
  font-size:11px;
  color:var(--text-muted);
  margin:22px 0 0;
}

.status-warning {
  background:var(--warning-bg);
  color:var(--warning);
}

.notice {
  font-size:12px;
  padding:12px 14px;
  border-radius:9px;
  line-height:1.6;
  background:var(--accent-light);
  color:var(--text-muted);
  margin:20px 0 0;
}

.notice:empty {
  display:none;
}

.warning {
  background:var(--warning-bg);
  color:var(--warning);
}

.breakdown-details {
  margin-top:26px;
  padding-top:18px;
  border-top:1px solid var(--border);
}

.breakdown {
  border-collapse:collapse;
  width:100%;
  margin-top:15px;
  font-size:11px;
}

.breakdown th {
  font-weight:400;
  text-align:left;
  overflow-wrap:anywhere;
}

.breakdown td {
  text-align:right;
  font-variant-numeric:tabular-nums;
  white-space:nowrap;
}

.breakdown th,.breakdown td {
  padding:10px 0;
  border-bottom:1px solid var(--border);
}

.breakdown th {
  padding-right:14px;
}

.breakdown .section th,.breakdown .total th,.breakdown .total td {
  font-weight:650;
}

.breakdown .section th {
  padding-top:18px;
  color:var(--text-muted);
}

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

.assumptions {
  margin:22px 0;
  padding:0 4px;
  max-width:720px;
  color:var(--text-muted);
}

.assumptions summary {
  font-size:12px;
  justify-content:flex-start;
  gap:12px;
}

.assumptions p,.assumptions a {
  font-size:12px;
}

.assumptions a {
  text-decoration:underline;
}

.page-foot {
  border-top:1px solid var(--border);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding-top:22px;
  margin-top:40px;
  font-size:12px;
  color:var(--text-muted);
}

.version {
  margin-left:5px;
  color:#979daa;
}

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

.fx-info {
  font-size:11px;
  display:flex;
  align-items:center;
  gap:8px;
}

.fx-info button {
  font-size:11px;
  padding:5px;
}

.fx-info input {
  width:80px;
  border:1px solid var(--border);
  border-radius:4px;
}

.fx-edit-panel {
  gap:6px;
}

.text-link {
  text-decoration:underline;
  padding:0;
  color:var(--accent);
}

/* Shared settings page */
.card {
  background:white;
  border:1px solid var(--border);
  border-radius:16px;
  padding:28px;
}

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

.settings-group h3 {
  font-size:15px;
  margin:0 0 16px;
}

.settings-field {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:16px;
  border-bottom:1px solid var(--border);
  padding:18px 0;
}

.sf-meta {
  min-width:0;
}

.sf-name {
  font-size:13px;
  font-weight:550;
}

.sf-desc {
  font-size:11px;
  color:var(--text-muted);
  margin-top:5px;
}

.sf-default {
  display:none;
}

.input-group {
  display:flex;
  align-items:center;
  border:1px solid var(--border);
  border-radius:8px;
  overflow:hidden;
}

.input-group input {
  width:90px;
  border:0;
  padding:12px 8px;
  text-align:right;
  background:none;
}

.input-addon {
  font-size:11px;
  color:var(--text-muted);
  padding:0 8px;
  white-space:nowrap;
}

.btn-secondary {
  border:1px solid var(--border);
  border-radius:8px;
  background:white;
  font-size:12px;
  padding:10px 14px;
}

.subtitle {
  display:none;
}

@media(max-width:800px) {
  .container {
    padding:32px 20px 24px;
  }

  .nav-container {
    padding:0 20px;
    height:64px;
  }

  .workspace {
    gap:18px;
  }

  .input-panel,.result-panel {
    padding:24px;
  }

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

  .hero-value {
    font-size:34px;
  }

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

}

@media(max-width:620px) {
  .container {
    padding:28px 16px 20px;
  }

  .page-head {
    margin-bottom:24px;
  }

  .page-head h1 {
    font-size:28px;
  }

  .nav-container {
    padding:0 16px;
  }

  .brand {
    font-size:15px;
  }

  .nav-link {
    font-size:12px;
  }

  .toolbar {
    gap:5px;
  }

  .year-badge {
    font-size:9px;
    padding:3px 5px;
  }

  .toolbar select {
    width:84px;
  }

  .tabs {
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:4px;
    margin-bottom:20px;
    padding:4px;
  }

  .tab {
    font-size:13px;
    padding:10px 8px;
    min-height:44px;
  }

  .workspace {
    grid-template-columns:1fr;
    gap:16px;
  }

  .input-panel {
    padding:22px;
    gap:22px;
    border-radius:16px;
  }

  .result-panel {
    position:static;
    padding:26px 22px;
    border-radius:16px;
  }

  .hero-value {
    font-size:40px;
    margin-top:24px;
  }

  .page-foot {
    align-items:flex-start;
    flex-direction:column;
    gap:18px;
    margin-top:28px;
  }

  .currency-switcher {
    justify-content:flex-start;
  }

  .mini-segment button {
    min-height:32px;
  }

  .assumptions {
    margin-top:18px;
  }

  .settings-field {
    gap:10px;
  }

  .card {
    padding:20px;
  }

  .page-head:has(.btn-secondary) {
    align-items:flex-start;
    flex-direction:column;
  }

}

@media(prefers-reduced-motion:reduce) {
  * {
    transition:none!important;
    scroll-behavior:auto!important;
  }

}

@media(max-width:620px) {
  .field select {
    font-size:16px;
  }

  .mini-segment button {
    min-height:36px;
  }

  .page-foot .mini-segment button {
    min-height:44px;
  }

}


/* Primary controls and result-level compliance notices. */
.toolbar #currency { width: 112px; }
.result-warning {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin: 20px 0;
  padding: 14px;
  border: 1px solid #eed9b7;
  border-radius: 11px;
  background: #fff7e9;
  color: #85501d;
}
.result-warning.danger { background: #fff0f1; border-color: #efcbd0; color: #a32d3c; }
.warning-icon {
  display: grid;
  place-items: center;
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  margin-top: 1px;
}
.result-warning strong { display: block; font-size: 12px; }
.result-warning p { font-size: 12px; line-height: 1.6; margin: 4px 0 0; }
@media (max-width: 620px) {
  .page-head { flex-wrap: wrap; gap: 18px; }
  .page-head h1 { width: 100%; }
  .toolbar { width: 100%; gap: 8px; }
  .toolbar #currency, .toolbar #taxYear { width: auto; flex: 1; font-size: 16px; }
  .toolbar .year-badge { flex-shrink: 0; }
}

/* The mode selector is also the comparison: keep one navigation surface. */
.tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 16px 18px;
  min-width: 0;
  text-align: left;
}
.tab-name { font-size: 12px; font-weight: 550; }
.tab-value {
  margin-top: 10px;
  font-size: clamp(18px, 2vw, 23px);
  font-weight: 650;
  letter-spacing: -.035em;
  font-variant-numeric: tabular-nums;
  white-space: normal;
  overflow-wrap: anywhere;
}
.tab-meta { margin-top: 2px; font-size: 10px; font-weight: 400; color: var(--text-muted); }
.tab.active .tab-value { color: var(--accent); }
.tab-unavailable .tab-value { color: var(--text-muted); }
.tab-unavailable .tab-meta, .tab-caution .tab-meta { color: var(--warning); }
@media (max-width: 620px) {
  .tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tab { padding: 13px 14px; }
  .tab-value { font-size: 20px; margin-top: 7px; }
}

/* Shared brand and project notice. */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: #202133;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 12px;
  background: #5147d9;
  color: #fff;
  box-shadow: inset 0 1px 0 #ffffff26, 0 2px 5px #5147d914;
}
.brand-mark { display: block; object-fit: contain; }
.brand-wordmark {
  font-size: 19px;
  line-height: 1;
  font-weight: 650;
  letter-spacing: -.045em;
}
.project-notice {
  border-bottom: 1px solid var(--border);
  background: #f1f2f7;
  color: #5e6475;
}
.project-notice-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px 32px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.project-notice-inner > svg { flex-shrink: 0; margin-top: 2px; color: #7a7e91; }
.project-notice p { margin: 0; font-size: 12px; line-height: 1.7; }
.project-notice strong { font-weight: 600; color: #454b5e; }
@media (max-width: 800px) {
  .project-notice-inner { padding: 12px 20px; }
}
@media (max-width: 620px) {
  .brand { gap: 9px; }
  .brand-mark { width: 32px; height: 32px; border-radius: 10px; }
  .brand-wordmark { font-size: 17px; }
  .project-notice-inner { padding: 11px 16px; gap: 9px; }
  .project-notice p { font-size: 11px; }
}

/* Familiar selection controls make the comparison cards visibly interactive. */
.tab {
  position: relative;
  border: 1px solid transparent;
  transition: border-color .15s, background-color .15s, box-shadow .15s;
}
.tab-name {
  width: 100%;
  min-height: 18px;
  padding-right: 25px;
  white-space: normal;
}
.tab::before {
  content: '';
  position: absolute;
  top: 16px;
  right: 18px;
  width: 16px;
  height: 16px;
  border: 1.5px solid #9ba2b3;
  border-radius: 50%;
  background: transparent;
  pointer-events: none;
}
.tab.active { border-color: #b7b1ed; }
.tab.active::before {
  border-color: var(--accent);
  background: radial-gradient(circle, var(--accent) 0 4px, transparent 4.5px);
}
.tab:active { background-color: #e7e5fb; }
@media (hover: hover) {
  .tab:not(.active):hover {
    background-color: #f8f8ff;
    border-color: #c6c2e7;
    box-shadow: 0 2px 6px #25234d0a;
  }
  .tab:not(.active):hover::before { border-color: var(--accent); }
}
@media (max-width: 620px) {
  .tab::before { top: 13px; right: 14px; }
}


/* Current conversion rate sits next to the primary controls. */
.page-head { margin-bottom: 10px; }
.currency-switcher { margin: 0 0 24px; min-height: 20px; }
.fx-info { justify-content: flex-end; flex-wrap: wrap; color: var(--text-muted); line-height: 1.6; }
.fx-info #fxRate { font-variant-numeric: tabular-nums; }
.fx-info button { text-decoration: underline; }
.fx-manual-tag { color: var(--warning); margin-left: 4px; }
.source-note { margin: 0; font-size: 11px; line-height: 1.6; }
.source-note a { text-decoration: underline; text-underline-offset: 2px; }
@media (max-width: 620px) {
  .currency-switcher, .fx-info { justify-content: flex-start; }
  .currency-switcher { margin-bottom: 20px; }
}
