:root {
  --ink: #0f0f0f;
  --paper: #f5f2ed;
  --paper-soft: #ede9e2;
  --muted: #6b655d;
  --accent: #1a3a2a;
  --accent-dot: #4a9e6e;
  --line: rgba(15, 15, 15, 0.12);
  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --sans: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --gron: #2f6f4e;
  --gron-bg: #e6f0e9;
  --gul: #8a6d1f;
  --gul-bg: #f5eed9;
  --rod: #8a3324;
  --rod-bg: #f5e6e2;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 500;
  margin: 0 0 0.5em;
}

a {
  color: var(--accent);
}

.wrap {
  max-width: 42rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}

header.site {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 2rem;
}

.breadcrumb {
  font-size: 0.95rem;
  color: var(--muted);
}

.breadcrumb::before {
  content: '';
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--accent-dot);
  margin-right: 0.5rem;
}

.lang-switch {
  font-size: 0.9rem;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 3rem;
  padding: 0.35rem 0.9rem;
}

.lang-switch:hover {
  border-color: var(--accent);
}

section.intro {
  margin-bottom: 2.5rem;
}

section.intro p {
  color: var(--muted);
  max-width: 34rem;
}

.card {
  background: var(--paper-soft);
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 1.75rem;
  margin-bottom: 1.5rem;
}

.card h3 {
  font-size: 1rem;
  margin-bottom: 1rem;
}

.card-divider {
  border: none;
  border-top: 1px solid var(--line);
  margin: 1.5rem 0;
}

.field {
  margin-bottom: 1.25rem;
}

.field-compact label {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--muted);
}

.field:last-child {
  margin-bottom: 0;
}

.field label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.field .help {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.35rem;
}

.field input[type='text'],
.field input[type='number'] {
  width: 100%;
  font: inherit;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  background: var(--paper);
  color: var(--ink);
}

.field input:focus {
  outline: 2px solid var(--accent-dot);
  outline-offset: 1px;
}

.field-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.field-row input[type='checkbox'] {
  width: 1.1rem;
  height: 1.1rem;
}

.field-row label {
  margin-bottom: 0;
}

.percent-field {
  max-width: 10rem;
}

.optional-tag {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.85rem;
}

.card .field {
  margin-top: 1rem;
  margin-bottom: 0;
}

.card .field:first-child {
  margin-top: 0;
}

section.result {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 1.75rem;
  margin-bottom: 1.5rem;
}

.result-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--line);
}

.result-row:last-of-type {
  border-bottom: none;
}

.result-row.total {
  font-weight: 700;
  font-size: 1.1rem;
  padding-top: 0.85rem;
}

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

.result-row.total .label {
  color: var(--ink);
}

.context-note {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.75rem;
}

.simplification {
  background: var(--paper-soft);
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.simplification h3 {
  color: var(--ink);
  font-size: 1rem;
}

.affordability {
  border-radius: 1rem;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--line);
}

.affordability[data-level='gron'] {
  background: var(--gron-bg);
  color: var(--gron);
}

.affordability[data-level='gul'] {
  background: var(--gul-bg);
  color: var(--gul);
}

.affordability[data-level='rod'] {
  background: var(--rod-bg);
  color: var(--rod);
}

.affordability h3 {
  color: inherit;
  font-size: 1rem;
}

.affordability .disclaimer {
  font-size: 0.8rem;
  opacity: 0.8;
  margin-top: 0.5rem;
}

section.share {
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.share-link-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.share-link-row input {
  flex: 1;
  min-width: 12rem;
  font: inherit;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 3rem;
  background: var(--paper);
  color: var(--muted);
}

button {
  font: inherit;
  cursor: pointer;
  border: none;
  border-radius: 3rem;
  padding: 0.6rem 1.4rem;
  background: var(--accent);
  color: var(--paper);
}

button:hover {
  opacity: 0.92;
}

button.secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--line);
}

.link-button {
  background: none;
  border: none;
  color: var(--accent);
  padding: 0;
  font-size: 0.85rem;
  text-decoration: underline;
}

.link-button:hover {
  opacity: 0.8;
}

.save-status {
  font-size: 0.85rem;
  color: var(--muted);
  min-height: 1.2em;
  margin-top: 0.75rem;
}

.save-status[data-state='error'] {
  color: var(--rod);
}

.save-status[data-state='saved'] {
  color: var(--gron);
}

.token-notice {
  background: var(--gul-bg);
  color: var(--gul);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  display: none;
}

.token-notice.visible {
  display: block;
}

.print-row {
  margin-bottom: 2rem;
}

footer.site {
  border-top: 1px solid var(--line);
  padding-top: 1.5rem;
  margin-top: 3rem;
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  align-items: center;
  color: var(--muted);
  font-size: 0.85rem;
}

footer.site a {
  color: var(--muted);
  text-decoration: none;
}

footer.site a:hover {
  color: var(--accent);
  text-decoration: underline;
}

@media print {
  header.site, footer.site, section.share, .print-row, .save-status, .token-notice {
    display: none !important;
  }
  body {
    background: white;
  }
  form, section.result, .simplification, .affordability {
    border: 1px solid #ccc;
  }
}
