/* JuraToolKit — shared base. Load AFTER theme.css.
   Layout, components, dark-mode-friendly overrides.
   No color literals here — every color reads from theme.css tokens. */

/* ---------- Self-hosted fonts (no third-party calls, GDPR-clean) ---------- */
@font-face {
  font-family: 'Instrument Serif';
  font-style: normal; font-weight: 400; font-display: swap;
  src: url('../fonts/instrument-serif-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Instrument Serif';
  font-style: italic; font-weight: 400; font-display: swap;
  src: url('../fonts/instrument-serif-400-italic.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal; font-weight: 400; font-display: swap;
  src: url('../fonts/jetbrains-mono-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal; font-weight: 500; font-display: swap;
  src: url('../fonts/jetbrains-mono-500-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal; font-weight: 600; font-display: swap;
  src: url('../fonts/jetbrains-mono-600-normal.woff2') format('woff2');
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: var(--paper); }

body {
  font-family: var(--sans);
  color: var(--ink);
  background: radial-gradient(ellipse at top, var(--hero-wash), transparent 60%), var(--paper);
  background-attachment: fixed;
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  position: relative;
  display: grid;
  grid-template-rows: 1fr auto;
}
body > .page { width: 100%; }
body > .site-footer { margin-top: 48px; }
body::before {
  content: "";
  position: fixed; inset: 0;
  background-image: radial-gradient(var(--dot) 1px, transparent 1px);
  background-size: 22px 22px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
}

.page {
  position: relative; z-index: 1;
  max-width: 1100px; margin: 0 auto;
  padding: 28px 32px 80px;
}
.page.wide   { max-width: 1280px; }
.page.narrow { max-width: 720px; }

/* ---------- Tool header ---------- */
.tool-head {
  display: flex; align-items: baseline; gap: 18px;
  padding-bottom: 18px; border-bottom: 1px solid var(--line);
  margin-bottom: 32px; flex-wrap: wrap;
}
.back {
  font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.08em; text-transform: uppercase;
  text-decoration: none; color: var(--muted); transition: color .15s;
}
.back:hover { color: var(--accent); }
.tool-title { display: flex; align-items: baseline; gap: 14px; }
.tool-title .num {
  font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.1em; color: var(--accent); font-weight: 500;
}
.tool-title h1 {
  font-family: var(--serif); font-weight: 400; font-size: 38px;
  margin: 0; letter-spacing: -0.01em; line-height: 1;
}
.tool-meta {
  margin-left: auto;
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted);
}

/* ---------- Drop zone ---------- */
.drop {
  display: block;
  border: 1.5px dashed var(--line);
  background: var(--paper);
  padding: 44px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
  margin-bottom: 16px;
  color: var(--ink-soft);
}
.drop.over { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.drop.loaded {
  padding: 16px 20px;
  display: flex; justify-content: space-between; align-items: center;
  text-align: left;
}
.drop.loaded .big { font-size: 16px; margin: 0; }
.drop .big {
  font-family: var(--serif); font-size: 22px;
  margin-bottom: 4px; line-height: 1.15;
}
.drop .small {
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted);
}
.drop .change {
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); border: 1px solid var(--line); padding: 6px 12px;
}
.drop:not(.loaded) .change { display: none; }
/* Visually hidden but kept in layout — `display: none` on a file input makes
   programmatic `.click()` unreliable in some browsers (intermittent „nothing
   happens on first click"). This pattern keeps the input live and hits open
   the picker every time. */
.drop input[type=file] {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
  opacity: 0;
  pointer-events: none;
}

/* ---------- Panels + fields ---------- */
.panel {
  background: var(--paper); border: 1px solid var(--line);
  padding: 20px; margin-bottom: 16px;
}
.panel h3 {
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 12px; font-weight: 600;
}

.row { display: flex; flex-wrap: wrap; gap: 14px 18px; align-items: flex-end; }
.row.grow > .field { flex: 1 1 160px; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label {
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.1em; color: var(--muted);
  text-transform: uppercase; font-weight: 500;
}
.field .hint {
  font-family: var(--mono); font-size: 10px;
  color: var(--muted); letter-spacing: 0.04em; line-height: 1.5;
}
.field select,
.field input[type=text],
.field input[type=number],
.field input[type=password] {
  font: inherit; font-size: 14px; padding: 8px 10px;
  border: 1px solid var(--line); background: var(--paper-3);
  color: var(--ink); border-radius: 0; outline: none;
  transition: border-color .12s;
  width: 100%;
}
.field select:focus,
.field input:focus,
.field textarea:focus { border-color: var(--ink); }
.field textarea {
  font-family: var(--mono); font-size: 13px; line-height: 1.55;
  padding: 12px; border: 1px solid var(--line); background: var(--paper-3);
  color: var(--ink); border-radius: 0; outline: none;
  resize: vertical; min-height: 130px;
  transition: border-color .12s; width: 100%;
}

.srow { display: flex; align-items: center; gap: 10px; }
.srow input[type=range] { flex: 1; min-width: 0; accent-color: var(--accent); }
.srow .sval {
  font-family: var(--mono); font-size: 12px; color: var(--muted);
  min-width: 28px; text-align: right;
}

.checkbox {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: 13px; cursor: pointer; user-select: none; color: var(--ink);
}
.checkbox input { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }

/* ---------- Buttons ---------- */
button.primary, button.secondary, button.chip {
  font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 10px 20px;
  border: 1px solid var(--ink); cursor: pointer;
  border-radius: 0; transition: all .12s;
}
button.primary { background: var(--ink); color: var(--paper); }
button.primary:hover:not(:disabled) {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
button.primary:disabled { opacity: 0.3; cursor: not-allowed; }
button.secondary { background: transparent; color: var(--ink); }
button.secondary:hover { background: var(--ink); color: var(--paper); }
button.secondary:disabled { opacity: 0.3; cursor: not-allowed; }
button.chip {
  font-size: 10px; padding: 5px 9px;
  border-color: var(--line);
  background: transparent; color: var(--muted);
}
button.chip:hover { color: var(--ink); border-color: var(--ink); }
button.chip.copied { color: var(--live); border-color: var(--live); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 0; margin-bottom: 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tab {
  font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 10px 16px; background: transparent; border: none;
  cursor: pointer; color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px; transition: color .15s, border-color .15s;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }
.section { display: none; }
.section.active { display: block; }

/* ---------- Hints + warnings ---------- */
.hint {
  background: var(--paper); border: 1px solid var(--line);
  padding: 14px 16px; margin-bottom: 16px;
  font-family: var(--mono); font-size: 11px;
  color: var(--ink-soft); line-height: 1.6; letter-spacing: 0.02em;
}
.hint b {
  color: var(--ink); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em; font-size: 10px;
}
.warn {
  background: var(--warn-bg); border: 1px solid var(--warn-border);
  padding: 12px 14px; margin-bottom: 16px;
  font-family: var(--mono); font-size: 11px;
  color: var(--ink-soft); line-height: 1.55;
}
.warn b {
  color: var(--accent); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em; font-size: 10px;
  display: block; margin-bottom: 2px;
}

/* ---------- Theme toggle button ---------- */
.theme-toggle {
  border: 1px solid var(--line); background: var(--paper);
  width: 32px; height: 32px; padding: 0;
  cursor: pointer; transition: all .12s;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 14px;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--ink); }

/* ---------- Cmd+K launcher (injected by utils.js) ---------- */
.utils-launcher {
  position: fixed; inset: 0; z-index: 9999;
  display: none; align-items: flex-start; justify-content: center;
  padding: 12vh 20px 20px;
  background: rgba(20,18,16,0.45);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  animation: utils-launcher-fade .15s ease-out;
}
:root[data-theme="dark"] .utils-launcher { background: rgba(0,0,0,0.62); }
.utils-launcher.active { display: flex; }
@keyframes utils-launcher-fade { from { opacity: 0; } to { opacity: 1; } }

.utils-launcher-modal {
  width: 100%; max-width: 640px;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow:
    0 24px 60px rgba(0,0,0,0.18),
    0 4px 14px rgba(0,0,0,0.08),
    inset 0 1px 0 rgba(255,255,255,0.04);
  display: flex; flex-direction: column;
  max-height: 70vh;
  animation: utils-launcher-rise .22s cubic-bezier(.2,.7,.3,1);
  position: relative;
}
:root[data-theme="dark"] .utils-launcher-modal {
  background: var(--paper-2);
  box-shadow: 0 24px 60px rgba(0,0,0,0.55), 0 4px 14px rgba(0,0,0,0.4);
}
.utils-launcher-modal::before {
  content: ""; position: absolute; left: 0; top: -1px;
  width: 64px; height: 1px; background: var(--accent);
}
@keyframes utils-launcher-rise {
  from { opacity: 0; transform: translateY(-8px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.utils-launcher-input-wrap {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px; border-bottom: 1px solid var(--line);
}
.utils-launcher-input-wrap .icon {
  font-size: 18px; color: var(--accent);
  line-height: 1; transform: translateY(-1px);
}
.utils-launcher .utils-launcher-input,
:root[data-theme="dark"] .utils-launcher .utils-launcher-input,
:root[data-theme="dark"] input.utils-launcher-input {
  flex: 1; min-width: 0;
  font-family: var(--serif); font-size: 22px !important; line-height: 1.2;
  background: transparent !important; border: none !important; outline: none;
  color: var(--ink) !important; padding: 0; letter-spacing: -0.005em;
}
.utils-launcher-input::placeholder { color: var(--muted) !important; font-style: italic; }
.utils-launcher-input-wrap .kbd {
  font-family: var(--mono); font-size: 9px;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line); padding: 3px 7px;
  border-radius: 2px; background: var(--paper-2);
}

.utils-launcher-results {
  flex: 1; overflow-y: auto;
  padding: 8px 0;
  scrollbar-width: thin;
}
.utils-launcher-results::-webkit-scrollbar { width: 6px; }
.utils-launcher-results::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }

.utils-launcher-section {
  font-family: var(--mono); font-size: 9px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted);
  padding: 14px 22px 6px; font-weight: 600;
}
.utils-launcher-section:first-child { padding-top: 8px; }

.utils-launcher-item {
  display: grid;
  grid-template-columns: 14px 1fr auto 16px;
  grid-template-areas:
    "dot name cat arrow"
    ".   desc desc arrow";
  align-items: center;
  gap: 4px 12px;
  padding: 10px 22px 10px 18px;
  text-decoration: none; color: inherit;
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: background .08s, border-color .08s;
}
.utils-launcher-item .dot {
  grid-area: dot;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--line); transition: background .12s;
  align-self: center;
}
.utils-launcher-item .name {
  grid-area: name;
  font-family: var(--serif); font-size: 18px; line-height: 1.15;
  color: var(--ink); letter-spacing: -0.005em;
}
.utils-launcher-item .cat {
  grid-area: cat;
  font-family: var(--mono); font-size: 9px;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line); padding: 2px 6px;
  background: transparent;
}
.utils-launcher-item .desc {
  grid-area: desc;
  font-size: 12.5px; color: var(--ink-soft); line-height: 1.4;
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical;
}
.utils-launcher-item .arrow {
  grid-area: arrow;
  font-family: var(--mono); font-size: 14px; color: transparent;
  transition: color .12s, transform .12s;
}
.utils-launcher-item.selected {
  background: var(--accent-soft);
  border-left-color: var(--accent);
}
.utils-launcher-item.selected .dot { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.utils-launcher-item.selected .name { color: var(--accent); }
.utils-launcher-item.selected .cat { border-color: var(--accent); color: var(--accent); }
.utils-launcher-item.selected .arrow { color: var(--accent); transform: translateX(2px); }

.utils-launcher-empty {
  padding: 36px 22px; text-align: center;
  font-family: var(--serif); font-size: 18px;
  color: var(--muted); font-style: italic;
}
.utils-launcher-empty::before {
  content: "·  ·  ·"; display: block;
  font-family: var(--mono); font-style: normal;
  font-size: 14px; letter-spacing: 0.4em;
  margin-bottom: 10px; color: var(--line);
}

.utils-launcher-footer {
  display: flex; gap: 18px; flex-wrap: wrap;
  padding: 10px 18px;
  border-top: 1px solid var(--line);
  background: var(--paper-2);
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.06em; color: var(--muted);
}
.utils-launcher-footer kbd {
  font-family: var(--mono); font-size: 9px;
  background: var(--paper); color: var(--ink-soft);
  border: 1px solid var(--line); border-bottom-width: 2px;
  padding: 1px 5px; margin: 0 4px 0 0; border-radius: 2px;
  min-width: 14px; display: inline-block; text-align: center;
}

/* Launcher trigger button (next to theme-toggle) */
.launcher-trigger {
  border: 1px solid var(--line); background: var(--paper);
  height: 32px; padding: 0 9px;
  cursor: pointer; transition: all .12s;
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--muted);
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.08em; text-transform: uppercase;
}
.launcher-trigger:hover { color: var(--ink); border-color: var(--ink); }
.launcher-trigger .lt-icon { font-size: 13px; color: var(--accent); }
.launcher-trigger .lt-kbd {
  font-size: 9px; padding: 1px 4px;
  border: 1px solid var(--line); border-radius: 2px;
  background: var(--paper-2);
}

@media (max-width: 720px) {
  .utils-launcher { padding: 8vh 12px 12px; }
  .utils-launcher-modal { max-height: 80vh; }
  .utils-launcher-input { font-size: 18px !important; }
  .utils-launcher-input-wrap { padding: 12px 14px; }
  .utils-launcher-item { padding: 10px 14px 10px 12px; gap: 4px 10px; }
  .utils-launcher-item .name { font-size: 16px; }
  .utils-launcher-item .cat { font-size: 8.5px; padding: 2px 5px; }
  .utils-launcher-item .desc { font-size: 12px; }
  .utils-launcher-section { padding: 12px 16px 4px; }
  .utils-launcher-footer { font-size: 9px; gap: 12px; padding: 9px 14px; }
  .launcher-trigger .lt-kbd { display: none; }
  .launcher-trigger { padding: 0 8px; }
}

/* ---------- Legal pages (Impressum / Datenschutz) ----------
   Full-page-width 2-col layout: §-number marginalia on the left,
   heading + body on the right. Mirrors the editorial feel of the
   dashboard's group-head pattern. */
.legal {
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink-soft);
}

/* ---- Hero ---- */
.legal-hero {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 48px;
  padding-bottom: 40px;
  margin-bottom: 8px;
  border-bottom: 1px dashed var(--line);
  position: relative;
  align-items: start;
}
.legal-hero::after {
  content: ""; position: absolute; left: 0; bottom: -1px;
  width: 64px; height: 1px; background: var(--accent);
}
.legal-hero-aside {
  display: flex; flex-direction: column; gap: 6px;
  padding-top: 14px;
}
.legal-hero-aside .eyebrow {
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent); font-weight: 500;
}
.legal-hero-aside .sub {
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted);
}
.legal-hero-body { max-width: 64ch; }
.legal-title {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(40px, 6.4vw, 64px);
  line-height: 1.0; letter-spacing: -0.018em;
  margin: 0 0 18px; color: var(--ink);
}
.legal-title em { font-style: italic; color: var(--accent); }
.legal-lead {
  margin: 0; font-size: 17px; line-height: 1.55;
  color: var(--ink-soft);
}
.legal-stamp {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted);
  padding: 6px 10px; border: 1px solid var(--line);
  background: var(--paper-2); margin-top: 18px;
}
.legal-stamp strong { color: var(--ink); font-weight: 600; }

/* ---- Sections (2-col: §number | body) ---- */
.legal-section {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 48px;
  padding: 36px 0;
  border-bottom: 1px solid var(--line-soft);
  align-items: start;
}
.legal-section:last-of-type {
  border-bottom: none; padding-bottom: 16px;
}
.legal-section-num {
  font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent); font-weight: 500;
  padding-top: 12px;
}
.legal-section-body { max-width: 64ch; }
.legal-section-body h2 {
  font-family: var(--serif); font-weight: 400;
  font-size: 28px; line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 18px; color: var(--ink);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  position: relative;
}
.legal-section-body h2::after {
  content: ""; position: absolute; left: 0; bottom: -1px;
  width: 36px; height: 1px; background: var(--accent);
}
.legal-section-body h3 {
  font-family: var(--serif); font-weight: 400;
  font-size: 19px; color: var(--ink);
  margin: 24px 0 8px; letter-spacing: -0.005em;
  display: flex; align-items: baseline; gap: 12px;
}
.legal-sub-num {
  font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent); font-weight: 500;
  flex-shrink: 0; min-width: 14px;
}
.legal-attribution {
  margin-top: 32px; padding-top: 16px;
  border-top: 1px dashed var(--line);
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.04em; color: var(--muted);
  line-height: 1.6; max-width: 64ch;
}
.legal-attribution a { color: var(--muted); border-bottom-color: transparent; }
.legal-attribution a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.legal-section-body p,
.legal-section-body li { margin: 0 0 12px; }
.legal-section-body ul {
  padding-left: 18px; margin: 0 0 14px;
  list-style: none;
}
.legal-section-body ul li {
  position: relative; padding-left: 14px;
}
.legal-section-body ul li::before {
  content: "—"; position: absolute; left: -4px; top: 0;
  color: var(--accent); font-family: var(--mono);
}
.legal-section-body strong { color: var(--ink); font-weight: 600; }
.legal-section-body address {
  font-style: normal; color: var(--ink); line-height: 1.7;
}
.legal-section-body address + dl,
.legal-section-body address + p { margin-top: 14px; }
.legal-section-body a {
  color: var(--accent); text-decoration: none;
  border-bottom: 1px solid var(--accent-soft);
  transition: border-color .12s;
}
.legal-section-body a:hover { border-bottom-color: var(--accent); }
.legal-section-body code {
  font-family: var(--mono); font-size: 13px;
  background: var(--paper-2); padding: 1px 6px;
  color: var(--ink); border: 1px solid var(--line-soft);
}
.legal-section-body dl {
  margin: 0; display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px; align-items: baseline;
}
.legal-section-body dt {
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); padding-top: 2px;
}
.legal-section-body dd {
  margin: 0; color: var(--ink);
}

/* ---- Inline elements ---- */
.legal-placeholder {
  font-family: var(--mono); font-size: 12px;
  font-style: normal; color: var(--accent);
  background: var(--accent-soft); padding: 1px 7px;
  letter-spacing: 0;
}
.legal-button {
  font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 10px 18px; margin-top: 4px;
  background: transparent; color: var(--ink-soft);
  border: 1px solid var(--line); cursor: pointer;
  transition: color .12s, border-color .12s, background .12s;
  border-radius: 0;
}
.legal-button:hover {
  color: var(--accent); border-color: var(--accent);
  background: var(--accent-soft);
}

/* ---- Meta footer (inside article) ---- */
.legal-meta {
  margin-top: 0;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted);
  display: flex; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.legal-meta strong { color: var(--ink); font-weight: 600; }
.legal-meta a {
  color: var(--ink-soft); text-decoration: none;
  border-bottom: 1px solid transparent; transition: color .12s, border-color .12s;
}
.legal-meta a:hover { color: var(--accent); border-bottom-color: var(--accent); }

@media (max-width: 720px) {
  .legal { font-size: 14.5px; line-height: 1.65; }
  .legal-hero,
  .legal-section {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .legal-hero {
    padding-bottom: 24px; margin-bottom: 14px;
  }
  .legal-hero-aside { padding-top: 0; flex-direction: row; gap: 10px; flex-wrap: wrap; }
  .legal-section { padding: 24px 0; }
  .legal-section-num { padding-top: 0; padding-bottom: 4px; }
  .legal-title { font-size: clamp(32px, 9vw, 44px); margin-bottom: 14px; }
  .legal-lead { font-size: 15px; }
  .legal-section-body h2 { font-size: 22px; margin-bottom: 14px; padding-bottom: 10px; }
  .legal-section-body dl { grid-template-columns: 1fr; gap: 2px 0; }
  .legal-section-body dt { padding-top: 6px; }
  .legal-meta { font-size: 10px; }
}

/* ---------- Tool page (long-form content) ----------
   Vertical hierarchy on every tool page:
     1. tool-intro     — 2-3 sentences, prominent
     2. tool-ui        — the actual interactive panel (focal point)
     3. tool-content   — wraps explainer + faq + related, visually subordinate

   The tool always sits at the top in a 760px-wide centered column. The
   long-form sections below sit in a slightly narrower 680px column and
   render in a softer typographic register so the tool stays the focal
   point — without hiding the SEO body from crawlers. */

.tool-intro {
  margin: 0 0 24px;
  font-family: var(--sans);
  font-size: 17px; line-height: 1.6;
  color: var(--ink-soft);
}
.tool-intro strong { color: var(--ink); }

.tool-ui {
  margin: 0 0 12px;
}

/* Placeholder hint text inside .tool-ui blocks in TEMPLATE.tool.html */
.tool-todo {
  font-family: var(--mono); font-size: 11px;
  color: var(--muted); letter-spacing: 0.05em;
  text-transform: uppercase; margin: 0;
}

/* Small mono caption that visually marks the start of each below-the-tool
   section — gives the page a clear "tool above / context below" split. */
.tool-section-label {
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent); font-weight: 500;
  margin: 0 0 12px;
}

.tool-explainer {
  margin: 72px 0 0;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}
.tool-explainer p,
.tool-explainer li {
  max-width: 72ch;
  /* Long German compound words break instead of forcing horizontal scroll. */
  overflow-wrap: anywhere;
}
.tool-explainer h2 {
  font-family: var(--serif); font-weight: 400;
  font-size: 24px; line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0 0 14px; color: var(--ink);
}
.tool-explainer h3 {
  font-family: var(--serif); font-weight: 400;
  font-size: 17px; color: var(--ink);
  margin: 22px 0 6px; letter-spacing: -0.005em;
}
.tool-explainer p,
.tool-explainer li {
  font-family: var(--serif);
  font-size: 18px; line-height: 1.55;
  color: var(--ink-soft); margin: 0 0 12px;
}
.tool-explainer ul {
  padding-left: 16px; margin: 0 0 12px;
  list-style: none;
}
.tool-explainer ul li {
  position: relative; padding-left: 14px;
}
.tool-explainer ul li::before {
  content: "—"; position: absolute; left: -4px; top: 0;
  color: var(--accent); font-family: var(--mono);
}
.tool-explainer strong { color: var(--ink); font-weight: 600; }
.tool-explainer a {
  color: var(--accent); text-decoration: none;
  border-bottom: 1px solid var(--accent-soft);
  transition: border-color .12s;
}
.tool-explainer a:hover { border-bottom-color: var(--accent); }
.tool-explainer code {
  font-family: var(--mono); font-size: 13px;
  background: var(--paper-2); padding: 1px 6px;
  color: var(--ink); border: 1px solid var(--line-soft);
}

.tool-faq {
  margin: 40px 0 0;
}
.tool-faq details > *:not(summary) {
  max-width: 72ch;
  overflow-wrap: anywhere;
}
.tool-faq summary { overflow-wrap: anywhere; }
.tool-faq h2 {
  font-family: var(--serif); font-weight: 400;
  font-size: 24px; margin: 0 0 14px; color: var(--ink);
}
.tool-faq details {
  border-bottom: 1px solid var(--line-soft);
  padding: 14px 0;
}
.tool-faq details:first-of-type {
  border-top: 1px solid var(--line-soft);
}
.tool-faq summary {
  cursor: pointer; user-select: none;
  font-family: var(--serif); font-weight: 400;
  font-size: 19px; color: var(--ink);
  list-style: none;
  padding-right: 32px; position: relative;
}
.tool-faq summary::-webkit-details-marker { display: none; }
.tool-faq summary::after {
  content: "+"; position: absolute; right: 0; top: 50%;
  transform: translateY(-50%);
  font-family: var(--mono); font-size: 18px;
  color: var(--accent); line-height: 1;
  transition: transform .15s;
}
.tool-faq details[open] summary::after { content: "−"; }
.tool-faq details > *:not(summary) {
  margin-top: 10px;
  font-family: var(--serif);
  font-size: 17px; line-height: 1.55;
  color: var(--ink-soft);
}
.tool-faq details > *:not(summary) a {
  color: var(--accent); text-decoration: none;
  border-bottom: 1px solid var(--accent-soft);
}

.tool-related {
  margin: 56px 0 0;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}
.tool-related h2 {
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent); font-weight: 500;
  margin: 0 0 14px;
}
.tool-related-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line-soft);
  border: 1px solid var(--line-soft);
}
/* Tablet: drop to 3 columns, hide the 4th card so the section stays one row. */
@media (max-width: 1023px) {
  .tool-related-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tool-related-card:nth-child(4) { display: none; }
}
.tool-related-card {
  background: var(--paper); padding: 16px 18px;
  text-decoration: none; color: inherit;
  display: flex; flex-direction: column; gap: 6px;
  position: relative;
  transition: background .15s;
  min-height: 96px;
}
.tool-related-card::after {
  content: "→"; position: absolute; right: 14px; bottom: 14px;
  font-family: var(--mono); font-size: 13px; color: var(--muted);
  transition: transform .18s ease, color .18s;
}
.tool-related-card:hover { background: var(--paper-3); }
.tool-related-card:hover::after { transform: translateX(3px); color: var(--accent); }
.tool-related-card .name {
  font-family: var(--serif); font-size: 18px; color: var(--ink);
  letter-spacing: -0.005em; transition: color .15s;
  padding-right: 18px;
}
.tool-related-card:hover .name { color: var(--accent); }
.tool-related-card .desc {
  font-family: var(--sans); font-size: 13px; color: var(--muted);
  line-height: 1.5; padding-right: 18px;
}

@media (max-width: 720px) {
  .tool-intro { font-size: 15.5px; }
  .tool-ui { max-width: 100%; }
  .tool-explainer,
  .tool-faq,
  .tool-related {
    margin-top: 36px;
  }
  .tool-explainer,
  .tool-related { padding-top: 24px; }
  .tool-explainer h2,
  .tool-faq h2 { font-size: 20px; }
  .tool-explainer h3 { font-size: 16px; }
  .tool-explainer p,
  .tool-explainer li,
  .tool-faq details > *:not(summary) { font-size: 14px; }
  .tool-faq summary { font-size: 14.5px; }
  .tool-related-grid { grid-template-columns: 1fr; }
}

/* ---------- Shared site footer (injected on every page) ---------- */
.site-footer {
  margin-top: 48px;
  border-top: 1px solid var(--line);
  background: var(--paper-2);
  position: relative; z-index: 1;
}
.site-footer-inner {
  max-width: 1100px; margin: 0 auto;
  padding: 28px 32px 18px;
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr;
  gap: 28px;
}
.site-footer.wide   .site-footer-inner { max-width: 1280px; }
.site-footer.narrow .site-footer-inner { max-width: 720px; }
.site-footer-brand .site-footer-name {
  font-family: var(--mono); font-size: 13px;
  letter-spacing: 0.04em; font-weight: 600;
  color: var(--ink); margin-bottom: 6px;
}
.site-footer-brand .site-footer-name .mark { color: var(--accent); }
.site-footer-brand .site-footer-name a {
  color: var(--ink); text-decoration: none; transition: color .12s;
}
.site-footer-brand .site-footer-name a:hover { color: var(--accent); }
.site-footer-brand p {
  font-family: var(--sans); font-size: 13px; color: var(--ink-soft);
  margin: 0; max-width: 38ch; line-height: 1.5;
}
.site-footer-col {
  display: flex; flex-direction: column; gap: 4px;
}
.site-footer-label {
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-soft); margin-bottom: 4px; font-weight: 600;
}
.site-footer-col a, .site-footer-col button.linklike {
  font-family: var(--sans); font-size: 13px;
  color: var(--ink-soft); text-decoration: none;
  transition: color .12s;
  background: none; border: none; padding: 6px 0; text-align: left; cursor: pointer;
  min-height: 24px; line-height: 1.4;
}
.site-footer-col a:hover, .site-footer-col button.linklike:hover { color: var(--accent); }
.site-footer-bottom {
  max-width: 1100px; margin: 0 auto;
  padding: 14px 32px 18px;
  padding-bottom: calc(18px + env(safe-area-inset-bottom));
  display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.site-footer.wide   .site-footer-bottom { max-width: 1280px; }
.site-footer.narrow .site-footer-bottom { max-width: 720px; }
.site-footer-bottom span:first-child { font-weight: 600; color: var(--ink); }

/* ---------- Consent banner (injected by analytics.js) ---------- */
.consent-banner {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 9998;
  background: var(--paper);
  border-top: 1px solid var(--line);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.06);
  padding: 14px 20px calc(14px + env(safe-area-inset-bottom));
  display: none;
  animation: consent-rise .25s cubic-bezier(.2,.7,.3,1);
}
.consent-banner.active { display: block; }
@keyframes consent-rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.consent-banner-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.consent-banner p {
  margin: 0; flex: 1 1 280px;
  font-size: 13px; color: var(--ink-soft); line-height: 1.5;
}
.consent-banner p a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.consent-banner p a:hover { text-decoration-thickness: 2px; }
.consent-banner .cb-actions {
  display: flex; gap: 10px; align-items: center;
}
.consent-banner button {
  font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 9px 18px;
  border: 1px solid var(--ink); border-radius: 0; cursor: pointer;
  transition: all .12s;
}
.consent-banner button.cb-accept {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.consent-banner button.cb-accept:hover { filter: brightness(1.08); }
.consent-banner button.cb-deny {
  background: transparent; color: var(--ink-soft); border-color: var(--line);
}
.consent-banner button.cb-deny:hover { color: var(--ink); border-color: var(--ink); }

@media (max-width: 720px) {
  .consent-banner { padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); }
  .consent-banner-inner { gap: 12px; }
  .consent-banner p { font-size: 13px; flex-basis: 100%; }
  .consent-banner .cb-actions { width: 100%; justify-content: flex-end; }
  .consent-banner button { padding: 10px 16px; min-height: 40px; }
}

/* ---------- Mobile touch UX (applies everywhere) ---------- */
* { -webkit-tap-highlight-color: var(--accent-soft); }
button, a, label, select, input, textarea { touch-action: manipulation; }
html, body { overflow-x: hidden; }
body { padding-bottom: env(safe-area-inset-bottom); }

/* Reorder ghost — floating clone of a tile while user drags it. The ghost
   is positioned via inline styles by reorder.js; this rule just hardens
   the look so e.g. text selection + transitions don't leak in. */
.reorder-ghost {
  user-select: none;
  -webkit-user-select: none;
}

/* Drag handle — visible affordance on every reorderable tile. Pointer-down
   on this element starts a drag immediately; touch-action: none ensures the
   browser doesn't try to scroll out from under us. */
.tile-handle {
  position: absolute; top: 4px; left: 4px;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 12px;
  letter-spacing: 0.04em; line-height: 1;
  color: var(--muted);
  background: var(--paper-3);
  border: 1px solid var(--line);
  cursor: grab;
  touch-action: none;
  -webkit-user-select: none; user-select: none;
  transition: color .12s, border-color .12s, background .12s;
  z-index: 2;
}
.tile-handle:hover {
  color: var(--accent); border-color: var(--accent);
}
.tile-handle:active { cursor: grabbing; }
@media (max-width: 720px) {
  .tile-handle {
    width: 36px; height: 36px;
    font-size: 14px;
    top: 6px; left: 6px;
  }
}

/* Reorderable tile grids — bump the × delete button on touch screens so
   it clears the 36px tap target (default is 22-24px for desktop precision). */
@media (max-width: 720px) {
  .pages-tile-remove,
  .merge-tile-remove,
  .img-tile-remove {
    width: 36px; height: 36px;
    font-size: 18px;
    top: 6px; right: 6px;
  }
}

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .site-footer { margin-top: 36px; }
  .site-footer-inner {
    grid-template-columns: 1fr;
    gap: 22px;
    padding: 22px 18px 14px;
  }
  .site-footer-bottom {
    padding: 12px 18px 18px;
    font-size: 9px;
    flex-direction: column; align-items: flex-start; gap: 6px;
  }
  .tool-head { position: relative; padding-right: 44px; }
  .tool-head .theme-toggle {
    position: absolute; top: 0; right: 0;
    width: 36px; height: 36px;
  }
}

@media (max-width: 720px) {
  .page {
    padding: 18px 14px calc(60px + env(safe-area-inset-bottom));
    max-width: 100%;
  }
  .tool-head {
    gap: 10px 14px;
    padding-bottom: 14px;
    margin-bottom: 22px;
  }
  .tool-title { gap: 10px; }
  .tool-title h1 { font-size: 26px; }
  .tool-title .num { font-size: 10px; }
  .tool-meta { font-size: 9px; margin-left: 0; width: 100%; }
  .back { padding: 6px 0; font-size: 12px; }

  /* Prevent iOS zoom-on-focus: inputs must be ≥ 16px. */
  input[type=text], input[type=number], input[type=password],
  input[type=email], input[type=url], input[type=search], input[type=tel],
  input:not([type]), select, textarea {
    font-size: 16px !important;
  }

  .drop { padding: 32px 16px; }
  .drop.loaded { padding: 14px 16px; flex-wrap: wrap; }
  .drop .big { font-size: 18px; }
  .drop.loaded .big { font-size: 14px; }

  button.primary, button.secondary { min-height: 44px; padding: 11px 18px; }
  button.chip { min-height: 32px; }
  .panel { padding: 16px; }

  .tabs { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; -ms-overflow-style: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { white-space: nowrap; flex-shrink: 0; }

  .theme-toggle { width: 40px; height: 40px; }
  textarea { min-height: 100px; }
}

@media (max-width: 380px) {
  .page { padding: 14px 12px calc(48px + env(safe-area-inset-bottom)); }
  .tool-title h1 { font-size: 22px; }
  .drop .big { font-size: 16px; }
}

/* ====== Print styles =================================================
   Targets: jurists printing a calculation result (Frist, Verzugszinsen,
   Kosten, Aktenzeichen) for an Akte or Klausurmappe. Hides UI chrome and
   long-form context, keeps the title and the result block. Other tool
   categories (Schreibtisch editor, Pomodoro, PDF tools) print rarely,
   but the rules below degrade gracefully — they hide form chrome and
   show whatever text content remains.
   ===================================================================== */
@media print {
  /* Reset background gradient + dot pattern that would waste ink */
  html, body { background: #fff !important; color: #000 !important; }
  body::before { display: none !important; }

  /* Site chrome — header back / meta / footer / consent */
  .site-footer, .consent-banner { display: none !important; }
  .tool-head { border-bottom: 1px solid #000; padding-bottom: 8px; margin-bottom: 16px; }
  .tool-head .back, .tool-head .tool-meta { display: none !important; }
  .tool-head .tool-title h1 { font-size: 22pt; color: #000 !important; }
  .tool-head .tool-title .num { color: #555 !important; }

  /* Hide all interactive controls — values are echoed in the result */
  .drop,
  button,
  input:not([type="hidden"]),
  select,
  textarea,
  [hidden] { display: none !important; }

  /* Hide long-form context — not useful in print */
  .tool-explainer, .tool-faq, .tool-related { display: none !important; }

  /* Make headlines + accents black + visible */
  h1, h2, h3, h4, h5, h6 { color: #000 !important; }
  strong, b { color: #000 !important; }

  /* Tighter page setup */
  @page { margin: 1.5cm; size: A4 portrait; }
  .page { padding: 0 !important; max-width: none; }

  /* Panels + result blocks: clean borders, avoid page-breaks inside */
  .panel {
    border: 1px solid #000 !important; background: #fff !important;
    padding: 14px !important; box-shadow: none !important;
  }
  [class*="-result"],
  [class*="-explanation"],
  [class*="-breakdown"],
  [class*="-periods"],
  [class*="-steps"] {
    break-inside: avoid; page-break-inside: avoid;
  }

  /* Links — printed black with underline, no border-bottom decoration */
  a { color: #000 !important; text-decoration: underline !important; border-bottom: 0 !important; }
}
