/* =========================================================
   LohnCheck.ch — "Swiss Ledger" design system
   Display: Fraunces · UI: IBM Plex Sans · Numbers: IBM Plex Mono
   ========================================================= */

:root {
  --paper:      #F4F1EA;
  --surface:    #FFFFFF;
  --ink:        #1B1A17;
  --muted:      #6E6A61;
  --line:       #E4DFD4;
  --line-soft:  #EEEAE1;
  --red:        #D12E26;
  --red-deep:   #A21B17;
  --green:      #1F7A4D;
  --green-soft: #E9F1EC;

  --r-sm: 6px;
  --r-md: 12px;
  --r-lg: 20px;

  --shadow: 0 1px 2px rgba(27,26,23,.04), 0 12px 32px -16px rgba(27,26,23,.18);

  --font-display: "Fraunces", Georgia, serif;
  --font-ui: "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  --wrap: 1080px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: clamp(1.1rem, 4vw, 2.5rem);
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: .6rem 1rem;
  border-radius: 0 0 var(--r-sm) 0;
  z-index: 50;
}
.skip-link:focus { left: 0; }

/* ---------- Header ---------- */
.site-header {
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.1) blur(6px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  background: var(--red);
  color: #fff;
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1.25rem;
  line-height: 1;
  transform: translateY(-1px);
}
.brand-name { font-size: 1.12rem; }
.brand-tld { color: var(--muted); }
.header-year {
  font-family: var(--font-mono);
  font-size: .82rem;
  color: var(--muted);
  letter-spacing: .02em;
}

/* ---------- Hero ---------- */
.hero { padding: clamp(2.5rem, 7vw, 5rem) 0 clamp(1.5rem, 4vw, 2.5rem); }
.eyebrow {
  font-family: var(--font-mono);
  font-size: .8rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--red-deep);
  margin: 0 0 1.1rem;
}
.hero-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-optical-sizing: auto;
  font-size: clamp(2.6rem, 7vw, 5rem);
  line-height: 1.02;
  letter-spacing: -0.025em;
  margin: 0 0 1.3rem;
}
.hero-title em {
  font-style: italic;
  font-weight: 600;
  color: var(--red);
}
.hero-lede {
  max-width: 46ch;
  font-size: clamp(1.05rem, 2.2vw, 1.22rem);
  color: var(--muted);
  margin: 0;
}
.hero-lede strong { color: var(--ink); font-weight: 600; }

/* ---------- Calculator layout ---------- */
.calc {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  padding-bottom: clamp(2.5rem, 6vw, 4.5rem);
}
@media (min-width: 880px) {
  .calc {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: clamp(1.4rem, 3vw, 2rem);
  box-shadow: var(--shadow);
}
.panel-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.35rem;
  margin: 0 0 1.4rem;
  letter-spacing: -0.01em;
}

/* ---------- Form fields ---------- */
.field { margin-bottom: 1.25rem; }
.field:last-child { margin-bottom: 0; }
.field label,
.field-label {
  display: block;
  font-weight: 600;
  font-size: .95rem;
  margin-bottom: .5rem;
}
.hint-inline { font-weight: 400; color: var(--muted); font-size: .85em; }
.field-note {
  margin: .45rem 0 0;
  font-size: .82rem;
  color: var(--muted);
  line-height: 1.45;
}

.money-input,
.pct-input {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  background: var(--paper);
  overflow: hidden;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.money-input:focus-within,
.pct-input:focus-within {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 12%, transparent);
}
.money-input .prefix,
.pct-input .suffix {
  font-family: var(--font-mono);
  color: var(--muted);
  padding: 0 .85rem;
  font-size: .95rem;
  user-select: none;
}
.money-input input,
.pct-input input {
  flex: 1;
  width: 100%;
  border: 0;
  background: transparent;
  padding: .8rem .9rem .8rem 0;
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--ink);
  outline: none;
}
.pct-input { max-width: 160px; }
.pct-input input { padding-left: .9rem; text-align: right; }
.money-input .prefix { border-right: 1px solid var(--line); }

input[type="number"] {
  width: 110px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  background: var(--paper);
  padding: .7rem .85rem;
  font-family: var(--font-mono);
  font-size: 1.05rem;
  color: var(--ink);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input[type="number"]:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 12%, transparent);
}

select {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  background: var(--paper);
  padding: .75rem .85rem;
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 500;
  color: var(--ink);
  outline: none;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease;
}
select:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 12%, transparent);
}

.pct-input input.is-auto {
  color: var(--muted);
  background: color-mix(in srgb, var(--line) 22%, transparent);
}

/* Segmented control */
.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 4px;
  padding: 4px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
}
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label {
  display: inline-block;
  margin: 0;
  padding: .5rem 1rem;
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.segmented input:checked + label {
  background: var(--ink);
  color: var(--paper);
}
.segmented input:focus-visible + label {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* Switch */
.field-inline { display: flex; align-items: center; }
.switch {
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  cursor: pointer;
  font-weight: 600;
  font-size: .95rem;
  margin: 0;
}
.switch input { position: absolute; opacity: 0; }
.switch-track {
  position: relative;
  width: 44px;
  height: 26px;
  background: var(--line);
  border-radius: 999px;
  transition: background .18s ease;
  flex: none;
}
.switch-track::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,.2);
  transition: transform .18s ease;
}
.switch input:checked + .switch-track { background: var(--green); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.switch-text { font-weight: 600; }

/* Advanced disclosure */
.advanced {
  margin-top: 1.25rem;
  border-top: 1px solid var(--line-soft);
  padding-top: 1.1rem;
}
.advanced summary {
  cursor: pointer;
  font-weight: 600;
  font-size: .95rem;
  list-style: none;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary::before {
  content: "+";
  font-family: var(--font-mono);
  color: var(--red);
  font-size: 1.1rem;
  transition: transform .2s ease;
}
.advanced[open] summary::before { content: "–"; }
.summary-hint { font-weight: 400; color: var(--muted); font-size: .85em; }
.advanced[open] summary { margin-bottom: 1.1rem; }

/* ---------- Result panel ---------- */
.result {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
  position: sticky;
  top: 84px;
}
.result-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}
.result-label {
  font-family: var(--font-mono);
  font-size: .82rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--paper) 60%, transparent);
}
.result-period {
  font-size: .82rem;
  color: color-mix(in srgb, var(--paper) 55%, transparent);
}
.net-amount {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.6rem, 8vw, 3.6rem);
  line-height: 1;
  letter-spacing: -0.02em;
  margin: .6rem 0 .3rem;
  color: #fff;
}
.net-cur {
  font-size: .42em;
  color: color-mix(in srgb, var(--paper) 55%, transparent);
  font-family: var(--font-mono);
  vertical-align: middle;
  margin-right: .15em;
}
.net-sub {
  margin: 0 0 1.5rem;
  font-size: .9rem;
  color: color-mix(in srgb, var(--paper) 62%, transparent);
}
.net-sub span { font-family: var(--font-mono); color: var(--paper); }

.ledger {
  border-top: 1px solid color-mix(in srgb, var(--paper) 18%, transparent);
}
.ledger-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .62rem 0;
  border-bottom: 1px solid color-mix(in srgb, var(--paper) 10%, transparent);
  font-size: .92rem;
}
.ledger-row > span:first-child {
  color: color-mix(in srgb, var(--paper) 78%, transparent);
}
.ledger-row .num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: .95rem;
  white-space: nowrap;
}
.num.minus::before { content: "− "; opacity: .65; }
.num.plus::before { content: "+ "; color: var(--green); opacity: .9; }
.rate {
  font-family: var(--font-mono);
  font-size: .76rem;
  color: color-mix(in srgb, var(--paper) 45%, transparent);
  margin-left: .35rem;
}
.tag {
  font-size: .66rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: .1rem .4rem;
  border-radius: 4px;
  margin-left: .4rem;
  vertical-align: middle;
}
.tag.est {
  background: color-mix(in srgb, var(--paper) 16%, transparent);
  color: color-mix(in srgb, var(--paper) 80%, transparent);
}
.ledger-gross > span:first-child,
.ledger-gross .num { color: var(--paper); }
.ledger-total {
  border-bottom: none;
  margin-top: .25rem;
  padding-top: .8rem;
  border-top: 1px solid color-mix(in srgb, var(--paper) 22%, transparent);
  font-weight: 600;
}
.ledger-total > span:first-child { color: var(--paper) !important; }
.ledger-net {
  border-bottom: none;
  background: color-mix(in srgb, var(--green) 92%, #000);
  margin: .5rem -1.2rem -.4rem;
  padding: .9rem 1.2rem;
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  font-weight: 700;
}
.ledger-net > span:first-child { color: #fff !important; }
.ledger-net .num { color: #fff; font-size: 1.05rem; }

.disclaimer {
  margin: 1.4rem 0 0;
  font-size: .78rem;
  line-height: 1.5;
  color: color-mix(in srgb, var(--paper) 52%, transparent);
}

.result-actions {
  display: flex;
  gap: .6rem;
  margin-top: 1.2rem;
  flex-wrap: wrap;
}
.res-btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  background: color-mix(in srgb, var(--paper) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--paper) 22%, transparent);
  color: var(--paper);
  font-family: var(--font-ui);
  font-size: .85rem;
  font-weight: 600;
  padding: .55rem .85rem;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.res-btn:hover {
  background: color-mix(in srgb, var(--paper) 18%, transparent);
  border-color: color-mix(in srgb, var(--paper) 40%, transparent);
}
.res-btn:focus-visible { outline: 2px solid var(--paper); outline-offset: 2px; }
.res-btn svg { flex: none; }
.res-btn.copied {
  background: var(--green);
  border-color: var(--green);
}

/* ---------- Budget section ---------- */
.budget { padding: clamp(1rem, 3vw, 2rem) 0 clamp(2.5rem, 6vw, 4.5rem); }
.budget-head { max-width: 52ch; margin-bottom: 2rem; }
.eyebrow-dark { color: var(--red-deep); }
.budget-lede { color: var(--muted); font-size: 1.05rem; margin: .5rem 0 0; }

.budget-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  align-items: start;
}
@media (min-width: 880px) {
  .budget-grid { grid-template-columns: 1.05fr .95fr; }
  .budget-viz { position: sticky; top: 84px; }
}

/* rows */
.bud-rows { margin-top: 1.4rem; display: flex; flex-direction: column; gap: .55rem; }
.bud-row {
  display: grid;
  grid-template-columns: 14px 1fr 130px 42px;
  align-items: center;
  gap: .7rem;
}
.swatch {
  width: 14px; height: 14px;
  border-radius: 4px;
  flex: none;
  display: inline-block;
}
.bud-name { font-size: .92rem; font-weight: 500; }
.pct-input.small { max-width: none; }
.pct-input.small input {
  padding: .55rem .7rem;
  font-size: 1rem;
  text-align: right;
}
.pct-input.small .prefix { padding: 0 .55rem; font-size: .82rem; }
.bud-pct {
  font-family: var(--font-mono);
  font-size: .85rem;
  color: var(--muted);
  text-align: right;
}

.bud-reset {
  margin-top: 1.3rem;
  background: none;
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  padding: .6rem 1rem;
  font-family: var(--font-ui);
  font-size: .88rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease;
}
.bud-reset:hover { border-color: var(--ink); color: var(--ink); }
.bud-reset:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* visualization */
.bud-bar {
  display: flex;
  width: 100%;
  height: 22px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
}
.bud-seg { height: 100%; transition: width .25s ease; }
.bud-seg-rest { background: repeating-linear-gradient(45deg, var(--line-soft), var(--line-soft) 5px, var(--paper) 5px, var(--paper) 10px); }

.bud-legend {
  list-style: none;
  margin: 1.2rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.bud-legend li {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  align-items: center;
  gap: .6rem;
  font-size: .9rem;
}
.leg-name { color: var(--muted); }
.leg-amt { font-size: .88rem; font-variant-numeric: tabular-nums; }

.bud-summary {
  margin-top: 1.4rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}
.bud-sum-row {
  display: flex;
  justify-content: space-between;
  padding: .35rem 0;
  font-size: .95rem;
}
.bud-sum-row .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.bud-remaining {
  font-weight: 700;
  color: var(--green);
}
.bud-remaining.over { color: var(--red); }

.bud-share-btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  margin-top: 1.3rem;
  width: 100%;
  justify-content: center;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  border-radius: var(--r-md);
  padding: .75rem 1rem;
  font-family: var(--font-ui);
  font-size: .92rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease;
}
.bud-share-btn:hover { background: color-mix(in srgb, var(--ink) 85%, #fff); }
.bud-share-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.bud-share-btn svg { flex: none; }

/* ---------- Info section ---------- */
.info { padding-bottom: clamp(3rem, 7vw, 5rem); }
.section-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  letter-spacing: -0.02em;
  margin: 0 0 2rem;
}
.info-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 640px) {
  .info-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 980px) {
  .info-grid { grid-template-columns: repeat(4, 1fr); }
}
.info-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 1.4rem;
}
.info-card h3 {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: .95rem;
  margin: 0 0 .6rem;
  color: var(--red-deep);
}
.info-card p { margin: 0; font-size: .92rem; color: var(--muted); }

/* ---------- Employer view ---------- */
.employer { padding: clamp(1rem, 3vw, 2rem) 0 clamp(2.5rem, 6vw, 4.5rem); }
.emp-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  align-items: start;
}
@media (min-width: 880px) {
  .emp-grid { grid-template-columns: .9fr 1.1fr; }
  .emp-result { position: sticky; top: 84px; }
}
.emp-hint {
  margin-top: 1.4rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line-soft);
}
/* In der AG-Summenzeile ist das Total positiv (grün passt nicht) -> neutral */
.emp-result .ledger-net { background: color-mix(in srgb, var(--ink) 80%, #000); }

/* ---------- FAQ ---------- */
.faq { padding-bottom: clamp(3rem, 7vw, 5rem); }
.faq-list {
  max-width: 760px;
  border-top: 1px solid var(--line);
}
.faq-item {
  border-bottom: 1px solid var(--line);
}
.faq-item summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 0;
  font-weight: 600;
  font-size: 1.05rem;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  font-family: var(--font-mono);
  color: var(--red);
  font-size: 1.4rem;
  line-height: 1;
  transition: transform .2s ease;
  flex: none;
}
.faq-item[open] summary::after { content: "–"; }
.faq-item p {
  margin: 0 0 1.2rem;
  color: var(--muted);
  max-width: 68ch;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 2rem 0;
}
.footer-inner { color: var(--muted); font-size: .85rem; }
.footer-inner p { margin: 0 0 .3rem; }
.footer-sources { font-size: .8rem; }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- Print ---------- */
@media print {
  :root { --paper: #fff; }
  body { background: #fff; font-size: 12pt; }
  .site-header, .hero, .info, .faq, .site-footer,
  .advanced, .segmented, .switch, .bud-reset,
  .no-print, .skip-link, .field-note { display: none !important; }

  .wrap { max-width: none; padding: 0; }
  main { padding: 0; }

  .panel {
    border: 1px solid #ccc;
    box-shadow: none;
    border-radius: 0;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .calc, .budget-grid { display: block; }
  .calc .inputs { margin-bottom: 1rem; }

  /* dunkles Ergebnis-Panel hell drucken */
  .result {
    background: #fff !important;
    color: #000 !important;
    border: 1px solid #000;
    position: static;
  }
  .result-label, .result-period, .net-cur, .net-sub,
  .ledger-row > span:first-child, .disclaimer { color: #333 !important; }
  .net-amount { color: #000 !important; }
  .ledger, .ledger-row { border-color: #ccc !important; }
  .ledger-net {
    background: #f0f0f0 !important;
    color: #000 !important;
    margin: .5rem 0 0;
    border-radius: 0;
  }
  .ledger-net > span:first-child, .ledger-net .num { color: #000 !important; }

  .budget { padding-top: 1.5rem; }
  .budget-viz { position: static; }
  .bud-bar { border: 1px solid #999; }
  .bud-seg { print-color-adjust: exact; -webkit-print-color-adjust: exact; }

  a[href]::after { content: ""; } /* keine URL-Anhänge */
}
