:root {
  --bg: #0a0c0f;
  --panel: #11151a;
  --panel-2: #151a21;
  --border: #212933;
  --border-soft: #1a2129;
  --text: #e7ebf0;
  --muted: #8a94a2;
  --dim: #6b7683;
  --accent: #4fd1a5;
  --accent-dim: #2c7a63;
  --danger: #ff7a7a;
  --warn: #e8b34b;
  --mono: ui-monospace, SFMono-Regular, "JetBrains Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --radius: 14px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Inter, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image:
    radial-gradient(900px 420px at 12% -12%, rgba(79, 209, 165, .07), transparent 70%),
    radial-gradient(700px 380px at 92% 0%, rgba(90, 130, 220, .06), transparent 70%);
}

/* ---------- Kopfzeile ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border-soft);
}

.brand { display: flex; align-items: center; gap: 14px; }

.mark {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: linear-gradient(160deg, #63e2b7, #35a888);
  color: #06110d;
  font: 700 14px/1 var(--mono);
  letter-spacing: -.5px;
  box-shadow: 0 6px 18px rgba(79, 209, 165, .22);
}

.brand h1 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -.2px; }
.brand p { margin: 1px 0 0; font-size: 12.5px; color: var(--muted); }

.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  font-size: 12px;
  color: var(--muted);
}

.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(79,209,165,.14); }
.pill.busy .dot { background: var(--warn); box-shadow: 0 0 0 3px rgba(232,179,75,.16); }
.pill.err .dot { background: var(--danger); box-shadow: 0 0 0 3px rgba(255,122,122,.16); }

/* ---------- Layout ---------- */

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(330px, 400px) minmax(0, 1fr);
  gap: 20px;
  padding: 22px 28px;
  align-items: start;
  max-width: 1680px;
  width: 100%;
  margin: 0 auto;
}

.panel {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 18px 40px -28px rgba(0,0,0,.9), inset 0 1px 0 rgba(255,255,255,.025);
}

.input-panel { padding: 18px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 22px; }

.output-panel {
  padding: 0;
  min-height: 520px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---------- Dropzone ---------- */

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 30px 18px;
  text-align: center;
  border: 1.5px dashed var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,.012);
  cursor: pointer;
  transition: border-color .18s, background .18s, transform .18s;
}

.dropzone svg { width: 30px; height: 30px; color: var(--accent); opacity: .85; margin-bottom: 4px; }
.dropzone strong { font-size: 14.5px; font-weight: 600; }
.dropzone span { font-size: 12.5px; color: var(--muted); }
.dropzone:hover, .dropzone:focus-visible { border-color: var(--accent-dim); background: rgba(79,209,165,.05); outline: none; }
.dropzone.drag { border-color: var(--accent); background: rgba(79,209,165,.09); transform: scale(1.01); }

/* ---------- Dateiinfo ---------- */

.fileinfo {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--panel);
}

.fileinfo-main { display: flex; align-items: center; gap: 11px; min-width: 0; }
.fileinfo strong { display: block; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 250px; }
.fileicon {
  flex: none;
  font: 700 10px/1 var(--mono);
  letter-spacing: .5px;
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  border-radius: 6px;
  padding: 6px 5px;
}

.icon-btn {
  flex: none;
  background: none; border: 1px solid transparent; border-radius: 8px;
  color: var(--dim); font-size: 13px; cursor: pointer; padding: 5px 8px;
}
.icon-btn:hover { color: var(--text); border-color: var(--border); }

/* ---------- Felder ---------- */

.field { display: flex; flex-direction: column; gap: 8px; }
.field > label {
  font-size: 11.5px; font-weight: 600; letter-spacing: .55px;
  text-transform: uppercase; color: var(--dim);
}

.field input[type=text] {
  width: 100%;
  padding: 11px 13px;
  font: 500 13.5px/1.4 var(--mono);
  letter-spacing: .3px;
  color: var(--text);
  background: #0c1014;
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color .16s, box-shadow .16s;
}
.field input[type=text]:focus {
  outline: none; border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px rgba(79,209,165,.12);
}
.field input.invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(255,122,122,.1); }

.hint, .muted { color: var(--muted); font-size: 12px; }
.hint { margin: 0; }

.options { display: flex; flex-direction: column; gap: 4px; }

.check {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 9px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  transition: background .15s;
}
.check:hover { background: rgba(255,255,255,.025); }
.check input {
  appearance: none;
  flex: none;
  margin: 2px 0 0;
  width: 16px; height: 16px;
  border: 1.5px solid var(--border);
  border-radius: 5px;
  background: #0c1014;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  position: relative;
}
.check input:checked { background: var(--accent); border-color: var(--accent); }
.check input:checked::after {
  content: "";
  position: absolute; inset: 0;
  background: no-repeat center/9px 7px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 8'%3E%3Cpath d='M1 4l2.6 2.6L9 1.2' stroke='%2306110d' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.check span { display: flex; flex-direction: column; gap: 2px; }
.check em { font-style: normal; font-size: 11.5px; color: var(--muted); line-height: 1.45; }

/* ---------- Buttons ---------- */

.primary {
  padding: 12px 16px;
  font: 600 14px/1 inherit;
  color: #06110d;
  background: linear-gradient(180deg, #63e2b7, #43c398);
  border: none;
  border-radius: 11px;
  cursor: pointer;
  transition: filter .16s, transform .06s;
}
.primary:hover:not(:disabled) { filter: brightness(1.06); }
.primary:active:not(:disabled) { transform: translateY(1px); }
.primary:disabled { background: #1b222a; color: var(--dim); cursor: not-allowed; }

.ghost {
  padding: 7px 12px;
  font: 500 12.5px/1 inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.ghost:hover { border-color: var(--accent-dim); background: rgba(79,209,165,.07); }

/* ---------- Demo ---------- */

.demo { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--border-soft); padding-top: 14px; }
.demo-list { display: flex; flex-wrap: wrap; gap: 7px; }
.demo-list button {
  padding: 6px 11px;
  font: 500 12px/1 var(--mono);
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.demo-list button:hover { color: var(--accent); border-color: var(--accent-dim); }

/* ---------- Leerzustand ---------- */

.empty {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 48px 32px; text-align: center;
}
.empty-art {
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;
  font: 500 12px/1 var(--mono);
  color: var(--dim);
  margin-bottom: 8px;
}
.empty-art span {
  padding: 7px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 7px;
  background: var(--panel);
}
.empty h2 { margin: 0; font-size: 16px; font-weight: 600; }
.empty p { margin: 0; max-width: 380px; font-size: 13.5px; color: var(--muted); }

/* ---------- Ergebnis ---------- */

.result { display: flex; flex-direction: column; min-height: 0; flex: 1; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(126px, 1fr));
  gap: 1px;
  background: var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
}
.stat { background: var(--panel); padding: 14px 16px; min-width: 0; }
.stat .k { display: block; font-size: 10.5px; letter-spacing: .6px; text-transform: uppercase; color: var(--dim); margin-bottom: 5px; }
.stat .v { font: 600 17px/1.15 var(--mono); letter-spacing: -.3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .v.dates { font-size: 13.5px; letter-spacing: 0; }
.stat .v small { font-size: 11px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.stat .v.pos { color: var(--accent); }
.stat .v.neg { color: var(--danger); }

.alerts { display: flex; flex-direction: column; gap: 0; }
.alert {
  display: flex; gap: 10px;
  padding: 11px 18px;
  font-size: 12.5px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(232,179,75,.05);
  color: #e9d3a5;
}
.alert b { color: var(--warn); font-weight: 600; }

.preview-head, .downloads-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 18px 9px;
  gap: 10px;
}
.preview-head .muted { margin-left: auto; }

.mini-select {
  font: 500 12px/1 var(--mono);
  color: var(--text);
  background: #0c1014;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 7px;
  cursor: pointer;
}
.mini-select:focus { outline: none; border-color: var(--accent-dim); }
.label { font-size: 11px; letter-spacing: .6px; text-transform: uppercase; color: var(--dim); font-weight: 600; }

.preview {
  margin: 0 18px;
  padding: 14px 16px;
  max-height: 340px;
  overflow: auto;
  background: #080a0d;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  font: 12px/1.75 var(--mono);
  color: #c3ccd8;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  tab-size: 4;
}
.preview .tag { color: #6ea8fe; }
.preview .amt { color: var(--accent); }
.preview .neg { color: var(--danger); }
.preview .bal { color: #e8b34b; }

.downloads { padding: 4px 18px 18px; margin-top: 6px; }
.file-list {
  display: flex; flex-direction: column; gap: 7px;
  margin-top: 6px; max-height: 235px; overflow: auto;
  mask-image: linear-gradient(to bottom, #000 calc(100% - 16px), transparent);
}
.file-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  transition: border-color .15s;
}
.file-row:hover { border-color: var(--accent-dim); }
.file-row.active { border-color: var(--accent-dim); background: rgba(79, 209, 165, .05); }
.file-row .fname { font: 500 12.5px/1.3 var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .fmeta { font-size: 11px; color: var(--dim); }
.file-row button { flex: none; }

.error {
  margin: 25px 18px;
  padding: 16px 18px;
  border: 1px solid rgba(255,122,122,.28);
  border-radius: 12px;
  background: rgba(255,122,122,.07);
  color: #ffc9c9;
  font-size: 13.5px;
}
.error b { display: block; color: var(--danger); margin-bottom: 4px; font-size: 12px; letter-spacing: .5px; text-transform: uppercase; }

/* ---------- Fußzeile ---------- */

.foot {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 14px 28px 20px;
  border-top: 1px solid var(--border-soft);
  font-size: 12px;
  color: var(--dim);
}
.foot code { font-family: var(--mono); color: var(--muted); }

/* ---------- Responsiv ---------- */

@media (max-width: 620px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats .stat:last-child { grid-column: 1 / -1; }
  .stat .v { white-space: normal; }
  .stat .v.dates { font-size: 12.5px; }
  .preview { margin: 0 12px; font-size: 11.5px; }
  .downloads { padding: 4px 12px 14px; }
  .preview-head, .downloads-head { padding: 13px 12px 9px; }
}

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; padding: 16px; }
  .output-panel { min-height: 420px; }
  .topbar { padding: 14px 16px; }
  .foot { flex-direction: column; padding: 14px 16px 18px; }
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #232b35; border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #2f3a46; }
::-webkit-scrollbar-corner { background: transparent; }

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