/* =========================================================================
   lohnverlust.de – Design-Leitfaden (hell, freundlich, Grün/Teal)
   Tokens → Layout → Komponenten. Konsistent über Rechner, Blog und Admin.
   ========================================================================= */
:root {
  /* Farben */
  --bg:        #eef3f1;   /* Seitenhintergrund, leicht grünlich */
  --surface:   #ffffff;   /* Karten */
  --surface-2: #f3f7f5;   /* eingebettete Flächen */
  --border:    #dbe6e1;
  --text:      #17322c;   /* dunkles Tannengrün-Slate */
  --muted:     #5f736c;
  --accent:    #12a594;   /* Teal-Grün */
  --accent-strong: #0e8a7b;
  --accent-soft: #e3f5f1;
  --pos:  #1f9d63;
  --neg:  #e5484d;
  --shadow: 0 4px 16px rgba(18, 60, 52, .07);
  --shadow-sm: 0 2px 8px rgba(18, 60, 52, .06);
  --radius: 14px;
  --radius-sm: 10px;
  --maxw: 1180px;
  font-synthesis: none;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55; -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-strong); }
h1, h2, h3 { letter-spacing: -.01em; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; width: 100%; }
.num { font-variant-numeric: tabular-nums; }

/* ---- Werbeflächen ---- */
.ad { display: flex; align-items: center; justify-content: center; }
.ad-top, .ad-bottom {
  min-height: 90px; margin: 0; padding: 10px 20px; background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.ad-bottom { border-bottom: 0; border-top: 1px solid var(--border); margin-top: 30px; }
.ad-ph {
  width: 100%; max-width: var(--maxw); min-height: 70px; border: 1px dashed #c4d4ce; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; color: #9db3ab; font-size: .82rem;
  letter-spacing: .08em; text-transform: uppercase;
}
.ad-side { width: 160px; flex: 0 0 160px; min-height: 300px; align-self: flex-start;
  position: sticky; top: 20px; background: var(--surface-2); border: 1px dashed #c4d4ce;
  border-radius: var(--radius-sm); }

/* ---- Topbar / Menü ---- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 62px; }
.brand { font-weight: 800; font-size: 1.25rem; text-decoration: none; color: var(--text); letter-spacing: -.02em; display: inline-flex; align-items: center; gap: 9px; }
.brand-hl { color: var(--accent); }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; display: block; flex: 0 0 auto; }
.mainnav { display: flex; gap: 6px; }
.mainnav a {
  text-decoration: none; color: var(--muted); font-weight: 600; font-size: .95rem;
  padding: 8px 14px; border-radius: 999px; transition: background .15s, color .15s;
}
.mainnav a:hover { color: var(--text); background: var(--surface-2); }
.mainnav a.active { color: var(--accent-strong); background: var(--accent-soft); }

/* ---- Grundgerüst mit Seiten-Rails ---- */
.shell { display: flex; gap: 22px; align-items: flex-start; justify-content: center; padding: 26px 20px; }
.main-col { flex: 1 1 auto; min-width: 0; max-width: var(--maxw); }
@media (max-width: 1120px) { .ad-side { display: none; } }

.page-intro { margin: 0 0 20px; }
.page-intro h1 { font-size: clamp(1.7rem, 3.6vw, 2.5rem); margin: 0 0 8px; }
.subtitle { color: var(--muted); margin: 0; max-width: none; }
.subtitle strong { color: var(--text); }

/* ---- Karten ---- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow); margin-bottom: 20px;
}
.card h2 { margin: 0 0 16px; font-size: 1.05rem; }

/* ---- Rechner-Layout ---- */
.layout { display: grid; grid-template-columns: 360px 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }
.form-card { position: sticky; top: 84px; margin-bottom: 0; }
@media (max-width: 900px) { .form-card { position: static; } }

/* ---- Formular ---- */
.field { margin-bottom: 16px; }
.field > label { display: block; font-size: .82rem; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: end; }
.field-grid > .field > label { min-height: 1.1em; }

input[type=number], input[type=text], input[type=password], input[type=date], select, textarea {
  width: 100%; background: var(--surface); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-sm); padding: 11px 12px; font-size: 1rem; outline: none;
  transition: border-color .15s, box-shadow .15s; font-family: inherit;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; line-height: 1.5; }

.input-row { display: flex; gap: 8px; }
.input-row input { flex: 1; }
.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; }
.segmented button { border: 0; background: transparent; color: var(--muted); padding: 7px 10px; border-radius: 7px; cursor: pointer; font-size: .82rem; white-space: nowrap; }
.segmented button.active { background: var(--accent); color: #fff; font-weight: 600; }
.input-suffix { position: relative; display: flex; align-items: center; }
.input-suffix span { position: absolute; right: 12px; color: var(--muted); pointer-events: none; }
.input-suffix input { padding-right: 30px; }

.check { display: flex; align-items: flex-start; gap: 9px; font-size: .9rem; padding: 8px 0; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); flex: 0 0 auto; margin-top: 1px; }
.check > span { flex: 1; }
/* Info-Tooltip (?) */
.check-with-info { display: flex; align-items: center; gap: 6px; }
.check-with-info .check { padding: 8px 0; }
.info {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; flex: 0 0 auto; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
  font-size: 11px; font-weight: 700; cursor: help; user-select: none; line-height: 1;
}
.info:hover, .info:focus-visible { background: var(--accent-soft); color: var(--accent-strong); border-color: var(--accent); outline: none; }
.info-tip {
  position: absolute; bottom: calc(100% + 9px); right: -4px; width: 268px; max-width: 76vw;
  background: var(--text); color: #fff; font-size: .78rem; font-weight: 400; line-height: 1.5;
  padding: 11px 13px; border-radius: 9px; box-shadow: 0 8px 22px rgba(18,60,52,.28);
  opacity: 0; visibility: hidden; transform: translateY(4px); transition: opacity .13s, transform .13s;
  z-index: 40; text-align: left; pointer-events: none;
}
.info-tip strong { color: #bff2e8; font-weight: 700; }
.info-tip::after { content: ""; position: absolute; top: 100%; right: 9px; border: 6px solid transparent; border-top-color: var(--text); }
.info:hover .info-tip, .info:focus .info-tip, .info:focus-within .info-tip { opacity: 1; visibility: visible; transform: translateY(0); }

.hint { color: var(--muted); font-size: .78rem; display: block; margin-top: 5px; }
.hint.inline { display: inline; margin: 0; }
.disclaimer { color: var(--muted); font-size: .75rem; margin: 14px 0 0; border-top: 1px solid var(--border); padding-top: 12px; }

/* ---- Jahres-Karten ---- */
.year-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 22px; }
@media (max-width: 560px) { .year-cards { grid-template-columns: 1fr; } }
.year-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 15px 16px; }
.year-card .yc-year { font-size: .8rem; color: var(--muted); letter-spacing: .03em; }
.year-card .yc-net { font-size: 1.5rem; font-weight: 800; margin: 4px 0 2px; }
.year-card .yc-sub { font-size: .78rem; color: var(--muted); }
.year-card .yc-delta { font-size: .82rem; margin-top: 8px; font-weight: 700; }
.year-card.base { outline: 2px solid var(--accent); outline-offset: -2px; }
.delta-pos { color: var(--pos); }
.delta-neg { color: var(--neg); }
.delta-zero { color: var(--muted); }

/* ---- Diagramme ---- */
.chart-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px 12px; }
.chart-head { display: flex; justify-content: space-between; align-items: center; font-size: .82rem; color: var(--muted); margin-bottom: 12px; gap: 12px; flex-wrap: wrap; }
.legend { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.chart { overflow-x: auto; }
#chart svg { width: 100%; height: auto; display: block; min-width: 340px; }
.dv-zero { stroke: var(--muted); stroke-width: 1.5; }
.dv-zerolabel { fill: var(--muted); font-size: 11px; }
.dv-year { fill: var(--text); font-size: 13px; font-weight: 600; }
.dv-abs { fill: var(--muted); font-size: 11px; }
.dv-val { font-size: 13px; font-weight: 700; }

/* ---- Tabelle ---- */
.table-scroll { overflow-x: auto; }
table.breakdown { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.breakdown th, table.breakdown td { text-align: right; padding: 9px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.breakdown th:first-child, table.breakdown td:first-child { text-align: left; color: var(--muted); }
table.breakdown thead th { color: var(--muted); font-weight: 600; font-size: .8rem; }
table.breakdown tr.sum td { font-weight: 700; border-top: 2px solid var(--border); }
table.breakdown tr.net td { font-weight: 800; color: var(--accent-strong); font-size: 1rem; }
table.breakdown tr.group td { color: var(--muted); font-size: .74rem; letter-spacing: .04em; padding-top: 14px; border: 0; }
.table-note { color: var(--muted); font-size: .76rem; margin: 12px 0 0; }

/* ---- Differenz-Boxen ---- */
.diff-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .diff-grid { grid-template-columns: 1fr; } }
.diff-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.diff-box h3 { margin: 0 0 10px; font-size: .95rem; }
.diff-line { display: flex; justify-content: space-between; font-size: .86rem; padding: 5px 0; border-bottom: 1px dashed var(--border); }
.diff-line:last-child { border-bottom: 0; }
.diff-line span:last-child { font-weight: 600; font-variant-numeric: tabular-nums; }
.diff-line.total { margin-top: 6px; padding-top: 10px; border-top: 2px solid var(--border); border-bottom: 0; font-size: 1rem; }

/* ---- Grenzsteuersatz-Kurve ---- */
.chart-intro { color: var(--muted); font-size: .85rem; margin: 0 0 14px; }
.chart-intro em { color: var(--text); font-style: normal; font-weight: 600; }
.grenz-legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: .82rem; color: var(--muted); margin-bottom: 8px; }
.grenz-legend .item { display: inline-flex; align-items: center; gap: 7px; }
.grenz-legend .ln { width: 18px; height: 3px; border-radius: 2px; display: inline-block; }
.grenz-chart-wrap { overflow-x: auto; }
#grenz-chart svg { width: 100%; height: auto; min-width: 480px; display: block; }
.grenz-axis { stroke: var(--border); stroke-width: 1; }
.grenz-grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 4; opacity: .7; }
.grenz-tick { fill: var(--muted); font-size: 11px; }
.grenz-line { fill: none; stroke-width: 2.5; }
.grenz-marker { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 4; }

/* ---- Blog ---- */
.blog-list { display: grid; gap: 16px; }
.post-card .post-date, .post-full .post-date { font-size: .78rem; color: var(--muted); }
.post-card h2 { margin: 6px 0 8px; }
.post-card h2 a { color: var(--text); text-decoration: none; }
.post-card h2 a:hover { color: var(--accent-strong); }
.post-summary { color: var(--muted); margin: 0 0 10px; }
.readmore { font-weight: 600; text-decoration: none; }
.post-full h1 { margin: 6px 0 16px; font-size: clamp(1.6rem, 3.4vw, 2.2rem); }
.post-body { line-height: 1.7; }
.post-body p { margin: 0 0 14px; }
.post-back { margin-top: 22px; }
.badge-draft { color: var(--neg); font-weight: 600; }

/* ---- Rechtsseiten ---- */
.legal { line-height: 1.65; }
.legal h2 { font-size: 1rem; margin: 22px 0 6px; }
.legal p { margin: 0 0 4px; }
.legal-note { border-left: 3px solid var(--accent); font-size: .88rem; color: var(--muted); }
.legal-note code, .hint code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.legal-note-small { color: var(--muted); font-size: .78rem; margin-top: 18px; }

/* ---- Footer ---- */
.site-footer { padding: 6px 20px 40px; color: var(--muted); font-size: .78rem; }
.footer-links { margin: 0 0 8px; }
.footer-links a { color: var(--accent-strong); text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }

/* ---- Buttons ---- */
.btn-primary {
  background: var(--accent); color: #fff; border: 0; border-radius: var(--radius-sm);
  padding: 11px 18px; font-size: .95rem; font-weight: 700; cursor: pointer; transition: background .15s;
}
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost {
  background: transparent; color: var(--muted); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 9px 14px; font-size: .9rem; cursor: pointer;
}
.btn-ghost:hover { color: var(--text); border-color: var(--muted); }

/* ---- Admin ---- */
body.admin { background: var(--bg); }
.admin-top { background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 20px; height: 60px; position: sticky; top: 0; z-index: 10; }
.admin-top .brand { font-size: 1.05rem; }
.admin-top nav { display: flex; align-items: center; gap: 14px; }
.admin-top nav a { color: var(--muted); text-decoration: none; font-size: .9rem; font-weight: 600; }
.admin-top form { margin: 0; }
.admin-wrap { max-width: 860px; margin: 0 auto; padding: 26px 20px 60px; }
.admin-login { max-width: 400px; margin: 8vh auto; padding: 0 20px; }
.admin-login h1 { margin: 0 0 18px; font-size: 1.4rem; }
.admin-login .btn-primary { width: 100%; margin-top: 4px; }
.admin-back { margin: 16px 0 0; font-size: .85rem; }
.form-error { background: #fdecec; color: var(--neg); border: 1px solid #f6c9ca; border-radius: var(--radius-sm); padding: 9px 12px; font-size: .88rem; margin: 0 0 14px; }

.ads-form .ad-slot { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 12px; background: var(--surface-2); }
.ads-form textarea { margin-top: 8px; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .82rem; }
.post-form .form-actions { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.admin-table th, .admin-table td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--border); }
.admin-table thead th { color: var(--muted); font-weight: 600; font-size: .8rem; }
.row-actions { display: flex; gap: 12px; align-items: center; white-space: nowrap; }
.row-actions form { margin: 0; }
.link-danger { background: none; border: 0; color: var(--neg); cursor: pointer; font-size: .9rem; padding: 0; }
.link-danger:hover { text-decoration: underline; }
