/* KUKANILEA Webtools — JSON-Formatter/Validator & JSON-CSV-Konverter. Eigenständige Subdomain,
   eigenes Mini-Design-System (Brand-Werte aus sites/kukanilea-www/styles.css :root übernommen,
   nicht importiert — volle Unabhängigkeit der Subdomain; identische Tokens wie andere Themen). */

:root {
  --cream: #ffffff;
  --ink: #0f172a;
  --ink-2: #1e293b;
  --ink-3: #475569;
  --ink-4: #5a6678;
  --line: #e6ebf1;
  --line-2: #cbd5e1;
  --white: #ffffff;
  --paper: #f4f6f9;
  --blue: #1B4965;
  --blue-2: #123449;
  --blue-soft: #d7e3ea;
  --blue-tint: #eef3f6;
  --green: #18553a;
  --green-soft: #e4f1e9;
  --warn-ink: #97491a;
  --warn-soft: #fde9d4;

  --radius: 14px;
  --radius-lg: 20px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 0 rgba(15,23,42,.04), 0 1px 2px rgba(15,23,42,.05);
  --shadow: 0 1px 0 rgba(15,23,42,.04), 0 12px 28px -16px rgba(15,23,42,.16);

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SFMono-Regular", "SF Mono", "IBM Plex Mono", monospace;
  --maxw: 880px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
html body [hidden] { display: none; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.wide { max-width: 1080px; }

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

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--blue); color: var(--white); padding: 10px 16px; z-index: 100;
}
.skip-link:focus { left: 12px; top: 12px; }

/* ── Header ── */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 40;
}
.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 20px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark { display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: .01em; }
.brand-sub { font-size: 11px; color: var(--ink-4); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.brand-sub.tool-suite { color: var(--blue); }

.site-nav { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.site-nav a { color: var(--ink-3); font-size: 14px; font-weight: 600; text-decoration: none; }
.site-nav a:hover, .site-nav a[aria-current] { color: var(--blue); }

.header-actions a.text-link { font-size: 14px; font-weight: 600; text-decoration: none; }

@media (max-width: 720px) {
  .header-row { flex-wrap: wrap; }
  .site-nav { order: 3; width: 100%; padding-top: 8px; border-top: 1px solid var(--line); }
}

/* ── Hero / intro ── */
.tool-hero { padding: 44px 0 8px; }
.tool-kicker {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--blue); margin-bottom: 10px;
}
.tool-hero h1 { font-size: clamp(28px, 4vw, 38px); line-height: 1.15; margin: 0 0 12px; letter-spacing: -0.01em; }
.tool-hero p.lede { font-size: 17px; color: var(--ink-3); max-width: 60ch; margin: 0 0 0; }

.privacy-note {
  display: flex; align-items: flex-start; gap: 10px;
  margin: 22px 0 0;
  padding: 14px 16px;
  background: var(--blue-tint);
  border: 1px solid var(--blue-soft);
  border-radius: var(--radius);
  font-size: 14px; color: var(--blue-2);
}
.privacy-note svg { flex: none; margin-top: 2px; }

/* ── Tool card / workspace ── */
.tool-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 28px;
  margin: 28px 0 40px;
}
.tool-card-title { margin: 0 0 4px; font-size: 17px; }
.tool-card-hint { margin: 0 0 14px; font-size: 14px; color: var(--ink-3); }

.tool-actions { display: flex; align-items: center; gap: 14px; margin-top: 20px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 14px; font-weight: 700;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary { background: var(--blue); color: var(--white); }
.btn-primary:hover:not(:disabled) { background: var(--blue-2); }
.btn-primary:disabled { background: var(--line-2); color: var(--ink-4); cursor: not-allowed; }
.btn-ghost { background: var(--white); color: var(--ink-2); border-color: var(--line-2); }
.btn-ghost:hover { border-color: var(--blue); color: var(--blue); }
.btn-ghost:disabled { opacity: .45; cursor: not-allowed; border-color: var(--line-2); color: var(--ink-2); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }

.tool-status { font-size: 14px; color: var(--ink-3); }
.tool-status[data-state="error"] { color: var(--warn-ink); }
.tool-status[data-state="done"] { color: var(--green); font-weight: 600; }

.result-panel {
  margin-top: 20px;
  padding: 18px;
  background: var(--green-soft);
  border: 1px solid #bfe0cd;
  border-radius: var(--radius);
  display: none;
}
.result-panel.is-visible { display: block; }
.result-panel h3 { margin: 0 0 6px; font-size: 15px; color: var(--green); }

/* ── Landing: tool grid ── */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin: 28px 0 48px;
}
.tool-tile {
  display: block;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.tool-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--blue-soft); }
.tool-tile .tt-icon { color: var(--blue); margin-bottom: 12px; }
.tool-tile h2 { font-size: 16px; margin: 0 0 6px; }
.tool-tile p { font-size: 13.5px; color: var(--ink-3); margin: 0; }

/* ── Footer ── */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 32px 0 40px;
  margin-top: 40px;
}
.ft-row {
  display: flex; flex-wrap: wrap; gap: 10px 24px;
  align-items: center; justify-content: space-between;
  font-size: 13px; color: var(--ink-4);
}
.ft-links { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.ft-links a { color: var(--ink-4); text-decoration: none; }
.ft-links a:hover { color: var(--blue); }

/* ── Formular (Rechnungs-/Angebotsgenerator) ── */
.job-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 20px;
  margin-top: 20px;
}
.job-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.job-field.full { grid-column: 1 / -1; }
.job-field label { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.job-field input[type="text"],
.job-field input[type="number"],
.job-field input[type="date"],
.job-field input[type="email"],
.job-field input[type="tel"],
.job-field textarea,
.job-field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--white);
}
.job-field textarea { resize: vertical; min-height: 70px; line-height: 1.5; }
.job-field input:focus, .job-field textarea:focus, .job-field select:focus {
  outline: 2px solid var(--blue-soft); border-color: var(--blue);
}
.job-field .field-hint { font-size: 12px; color: var(--ink-4); }
@media (max-width: 640px) {
  .job-form { grid-template-columns: 1fr; }
}

.form-section-title {
  margin: 32px 0 4px; font-size: 13px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--ink-4);
}
.form-section-title:first-child { margin-top: 0; }

.toggle-row { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.toggle-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--blue); cursor: pointer; }
.toggle-row label { font-size: 14px; color: var(--ink-2); cursor: pointer; }
.toggle-hint { font-size: 12.5px; color: var(--ink-4); margin: 4px 0 0 28px; }

/* ── Positionstabelle ── */
.item-table-wrap { overflow-x: auto; margin-top: 18px; }
table.item-table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 640px; }
table.item-table th {
  text-align: left; padding: 6px 8px; color: var(--ink-4); font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .03em; border-bottom: 1px solid var(--line-2);
}
table.item-table td { padding: 5px 8px; vertical-align: top; }
table.item-table input[type="text"], table.item-table input[type="number"], table.item-table select {
  width: 100%; padding: 7px 9px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  font-size: 13.5px; font-family: var(--font-sans); color: var(--ink); background: var(--white);
}
table.item-table td.col-desc { min-width: 220px; }
table.item-table td.col-qty, table.item-table td.col-price, table.item-table td.col-tax { width: 90px; }
table.item-table td.col-sum { width: 100px; text-align: right; font-variant-numeric: tabular-nums; padding-top: 10px; color: var(--ink-2); font-weight: 600; }
table.item-table td.col-del { width: 36px; text-align: center; }
.item-del-btn {
  border: 0; background: none; color: var(--ink-4); cursor: pointer; font-size: 18px; line-height: 1;
  padding: 6px; border-radius: 6px;
}
.item-del-btn:hover { color: var(--warn-ink); background: var(--warn-soft); }

.summary-box {
  margin: 18px 0 0; margin-left: auto; max-width: 340px;
  display: flex; flex-direction: column; gap: 6px;
}
.summary-row { display: flex; justify-content: space-between; font-size: 14px; color: var(--ink-2); }
.summary-row.total { font-size: 16px; font-weight: 700; color: var(--ink); border-top: 1px solid var(--line-2); padding-top: 8px; margin-top: 4px; }
.summary-note { font-size: 12px; color: var(--ink-4); margin-top: 2px; }

.json-toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; align-items: center; }
.json-split { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.json-col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.json-col label { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.json-editor {
  width: 100%; min-height: 340px; padding: 12px 14px;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  font: 13px/1.55 ui-monospace, "SF Mono", Consolas, monospace;
  color: var(--ink); background: var(--white); resize: vertical; tab-size: 2;
}
.json-editor:focus { outline: 2px solid var(--blue-soft); border-color: var(--blue); }
.json-editor[readonly] { background: var(--paper); color: var(--ink-2); }
.json-editor.has-error { border-color: var(--warn-ink); }
.json-error-loc { font-size: 13px; color: var(--warn-ink); min-height: 18px; }
.json-file-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.json-file-row input[type="file"] { font-size: 13px; }

.dropzone {
  border: 2px dashed var(--line-2);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  background: var(--paper);
  transition: border-color .15s ease, background .15s ease;
}
.dropzone:hover, .dropzone.is-dragover { border-color: var(--blue); background: var(--blue-tint); }
.dropzone svg { color: var(--ink-4); margin-bottom: 8px; }
.dropzone .dz-title { font-weight: 700; font-size: 15px; color: var(--ink-2); }
.dropzone .dz-sub { font-size: 13px; color: var(--ink-4); margin-top: 4px; }
.dropzone input[type="file"] { display: none; }

.csv-preview-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); max-height: 320px; }
.csv-preview { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.csv-preview th, .csv-preview td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.csv-preview th { background: var(--paper); color: var(--ink-2); position: sticky; top: 0; }

.md-toolbar-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.md-toolbar-row .btn-icon { padding: 6px 10px; font-size: 13px; font-weight: 700; min-width: 34px; }
.md-preview {
  width: 100%; min-height: 340px; max-height: 620px; overflow-y: auto;
  padding: 12px 16px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--white); color: var(--ink); font-size: 14.5px; line-height: 1.6;
}
.md-preview h1, .md-preview h2, .md-preview h3 { line-height: 1.25; margin: 0.9em 0 0.4em; }
.md-preview h1:first-child, .md-preview h2:first-child, .md-preview h3:first-child { margin-top: 0; }
.md-preview p { margin: 0.6em 0; }
.md-preview ul, .md-preview ol { padding-left: 1.4em; margin: 0.6em 0; }
.md-preview blockquote {
  margin: 0.8em 0; padding: 4px 14px; border-left: 3px solid var(--blue);
  color: var(--ink-2); background: var(--paper);
}
.md-preview pre {
  background: var(--ink); color: #f4f6f8; padding: 12px 14px; border-radius: var(--radius-sm);
  overflow-x: auto; font: 12.5px/1.5 ui-monospace, "SF Mono", Consolas, monospace;
}
.md-preview code {
  font: 12.5px/1.4 ui-monospace, "SF Mono", Consolas, monospace;
  background: var(--paper); padding: 1px 5px; border-radius: 4px;
}
.md-preview pre code { background: none; padding: 0; }
.md-preview table { border-collapse: collapse; width: 100%; margin: 0.6em 0; font-size: 13px; }
.md-preview th, .md-preview td { border: 1px solid var(--line); padding: 5px 9px; }
.md-preview img { max-width: 100%; }
.md-preview a { color: var(--blue); }
.md-preview hr { border: none; border-top: 1px solid var(--line-2); margin: 1em 0; }

@media (max-width: 760px) {
  .json-split { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .tool-card { padding: 20px; }
  .summary-box { max-width: 100%; }
}
