:root {
  --bg: #eef1f5; --panel: #ffffff; --panel-2: #f6f8fb; --ink: #131c28; --muted: #5d6b7c; --line: #d9dfe7;
  --dc: #5560e0; --dc-soft: #e8eafd; --fx: #0c8f7d; --fx-soft: #dcf3ef;
  --ok: #23814f; --warn: #a96a0c; --err: #c0392b; --focus: #1d4ed8;
  --font: ui-sans-serif, "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d131a; --panel: #151d27; --panel-2: #1a2430; --ink: #e7edf4; --muted: #93a1b3; --line: #263241;
    --dc: #8d96ff; --dc-soft: #232a52; --fx: #36cbb4; --fx-soft: #123a35;
    --ok: #4cc384; --warn: #e0a64a; --err: #ff7b6b; --focus: #7aa2ff;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.015em; margin: 0; }
h1 { font-size: 1.65rem; font-weight: 680; }
h2 { font-size: 1.15rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0 0 .75rem; max-width: 68ch; }
a { color: var(--dc); }
code, .mono { font-family: var(--mono); font-size: .88em; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: .9rem; }
.grow { flex: 1; min-width: 0; }
.hidden { display: none !important; }

/* Shell */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.rail { background: var(--panel); border-right: 1px solid var(--line); padding: 1.1rem .9rem; display: flex; flex-direction: column; gap: 1.2rem; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; font-size: 1.15rem; letter-spacing: -.02em; padding: .2rem .5rem; }
.brand .pair { display: inline-flex; }
.brand .pair i { width: 16px; height: 16px; border-radius: 50%; display: block; }
.brand .pair i:first-child { background: var(--dc); }
.brand .pair i:last-child { background: var(--fx); margin-left: -6px; mix-blend-mode: multiply; }
@media (prefers-color-scheme: dark) { .brand .pair i:last-child { mix-blend-mode: screen; } }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: .65rem; padding: .55rem .6rem; border-radius: 8px; color: var(--ink); text-decoration: none; font-weight: 520; }
.nav a svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.nav a:hover { background: var(--panel-2); }
.nav a[aria-current="page"] { background: var(--ink); color: var(--bg); }
.nav a[aria-current="page"] svg { color: var(--bg); }
.rail .foot { margin-top: auto; font-size: .85rem; }
.main { padding: 1.6rem clamp(1rem, 3vw, 2.4rem) 4rem; max-width: 1180px; width: 100%; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.3rem; }
.page-head p { color: var(--muted); margin: .3rem 0 0; }
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: .6rem; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav a span { display: none; }
  .rail .foot { margin: 0 0 0 auto; }
}

/* Panels */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 1.1rem 1.2rem; }
.panel.flat { background: transparent; border-style: dashed; }
.panel > h2 + * { margin-top: .8rem; }
.grid { display: grid; gap: 1rem; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.list { display: flex; flex-direction: column; }
.list > .item { display: flex; gap: .8rem; align-items: center; padding: .75rem 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.list > .item:first-child { border-top: 0; }
.stat b { display: block; font-size: 1.7rem; font-weight: 680; letter-spacing: -.02em; line-height: 1.1; }

/* Forms */
label.f { display: flex; flex-direction: column; gap: .3rem; font-weight: 560; font-size: .9rem; }
label.f .hint { font-weight: 400; color: var(--muted); font-size: .82rem; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=datetime-local], input[type=date], select, textarea {
  font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: .55rem .7rem; width: 100%; min-height: 40px;
}
input:focus, select:focus, textarea:focus { border-color: var(--focus); }
.check { display: flex; gap: .6rem; align-items: flex-start; cursor: pointer; font-weight: 500; }
.check input { margin-top: .22rem; width: 17px; height: 17px; accent-color: var(--dc); flex: none; }
.check .hint { display: block; font-weight: 400; color: var(--muted); font-size: .84rem; }
.btn { font: inherit; font-weight: 600; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: .5rem .95rem; min-height: 40px; cursor: pointer; display: inline-flex; align-items: center; gap: .45rem; text-decoration: none; }
.btn:hover { background: var(--panel-2); }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.primary:hover { opacity: .88; }
.btn.dc { background: var(--dc); border-color: var(--dc); color: #fff; }
.btn.fx { background: var(--fx); border-color: var(--fx); color: #fff; }
.btn.danger { color: var(--err); }
.btn.sm { min-height: 32px; padding: .25rem .65rem; font-size: .88rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { font: inherit; border: 0; background: var(--panel); color: var(--ink); padding: .3rem .7rem; cursor: pointer; border-left: 1px solid var(--line); }
.seg button:first-child { border-left: 0; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; font-weight: 600; padding: .12rem .55rem; border-radius: 99px; border: 1px solid var(--line); background: var(--panel-2); }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.badge.ok::before, .badge.done::before, .badge.ready::before { background: var(--ok); }
.badge.running::before, .badge.queued::before, .badge.connecting::before { background: var(--dc); animation: pulse 1.2s infinite; }
.badge.failed::before, .badge.error::before { background: var(--err); }
.badge.cancelled::before, .badge.planned::before, .badge.stopped::before { background: var(--warn); }
.tag { font-size: .78rem; padding: .08rem .5rem; border-radius: 6px; font-weight: 600; }
.tag.dc { background: var(--dc-soft); color: var(--dc); }
.tag.fx { background: var(--fx-soft); color: var(--fx); }
@keyframes pulse { 50% { opacity: .35; } }

/* Notices */
.notice { border-radius: 10px; padding: .7rem .9rem; border: 1px solid var(--line); background: var(--panel-2); display: flex; gap: .6rem; }
.notice.warn { border-color: color-mix(in srgb, var(--warn) 50%, var(--line)); background: color-mix(in srgb, var(--warn) 10%, var(--panel)); }
.notice.err { border-color: color-mix(in srgb, var(--err) 50%, var(--line)); background: color-mix(in srgb, var(--err) 9%, var(--panel)); }
.notice.ok { border-color: color-mix(in srgb, var(--ok) 50%, var(--line)); background: color-mix(in srgb, var(--ok) 9%, var(--panel)); }
.notice ul { margin: .2rem 0 0; padding-left: 1.1rem; }

/* Transfer lane: source -> target (the signature element) */
.lane { display: grid; grid-template-columns: 1fr minmax(70px, 180px) 1fr; align-items: stretch; }
.lane .end { padding: .9rem 1.1rem; border: 1px solid var(--line); background: var(--panel); min-width: 0; }
.lane .end.src { border-radius: 12px 0 0 12px; border-left: 5px solid var(--dc); }
.lane .end.dst { border-radius: 0 12px 12px 0; border-right: 5px solid var(--fx); text-align: right; }
.lane .end b { display: block; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lane .wire { position: relative; background: linear-gradient(90deg, var(--dc), var(--fx)); height: 6px; align-self: center; border-radius: 3px; overflow: hidden; }
.lane .wire.live::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 14px, rgba(255,255,255,.75) 14px 22px); animation: flow 1s linear infinite; }
.lane .wire.idle { opacity: .35; }
@keyframes flow { to { background-position: 22px 0; } }
progress { width: 100%; height: 8px; accent-color: var(--fx); border-radius: 4px; }

/* Log */
.log { background: #0c1218; color: #cfe0ee; border-radius: 10px; padding: .7rem .9rem; font: 12.5px/1.55 var(--mono); max-height: 360px; overflow: auto; }
.log div { white-space: pre-wrap; word-break: break-word; }
.log .warn { color: #f3c36b; }
.log .error { color: #ff8a7a; }
.log time { color: #6f8396; margin-right: .6rem; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-weight: 600; color: var(--muted); font-size: .85rem; }
.scroll-x { overflow-x: auto; }

/* Tabs */
.tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; flex-wrap: wrap; }
.tabs button { font: inherit; font-weight: 600; border: 0; background: none; color: var(--muted); padding: .55rem .9rem; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }

/* Wizard */
.steps { display: flex; gap: .4rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.steps li { list-style: none; padding: .3rem .8rem; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); font-weight: 600; font-size: .88rem; }
.steps li.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.steps li.done { color: var(--ok); }
.steps { padding: 0; }

/* Auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1.2rem; }
.auth .box { width: min(440px, 100%); }
.auth .lane { margin: 1.2rem 0 1.4rem; }
.auth .lane .end { padding: .5rem .8rem; font-weight: 650; }
.auth h1 { margin-bottom: .3rem; }
.code-input { font: 600 1.6rem var(--mono); letter-spacing: .5em; text-align: center; }
.qr { background: #fff; padding: .6rem; border-radius: 10px; width: max-content; max-width: 100%; }
.qr svg { display: block; width: 190px; height: 190px; }
.codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .3rem .8rem; font-family: var(--mono); padding: .8rem; background: var(--panel-2); border-radius: 8px; border: 1px dashed var(--line); }

/* Modal & toast */
.overlay { position: fixed; inset: 0; background: rgba(8,12,18,.55); display: grid; place-items: center; padding: 1rem; z-index: 50; }
.modal { background: var(--panel); border-radius: 14px; padding: 1.3rem; width: min(560px, 100%); max-height: 90vh; overflow: auto; border: 1px solid var(--line); }
.modal h2 { margin-bottom: .8rem; }
#toasts { position: fixed; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 60; max-width: min(420px, calc(100vw - 2rem)); }
.toast { background: var(--ink); color: var(--bg); padding: .65rem .9rem; border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.25); }
.toast.err { background: var(--err); color: #fff; }
.empty { text-align: center; padding: 2rem 1rem; color: var(--muted); }
.empty p { margin-inline: auto; }
.copybox { display: flex; gap: .5rem; }
.copybox input { font-family: var(--mono); font-size: .85rem; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Korrekturen */
.btn svg { width: 16px; height: 16px; flex: none; }
.stack > .btn, .stack > button.btn, .stack > a.btn { align-self: flex-start; }
.panel.stack > .row.between + * { margin-top: 0; }
a.panel { color: inherit; text-decoration: none; }
a.panel:hover { border-color: var(--muted); }
td .badge { margin-left: .5rem; }
td:first-child { max-width: 360px; overflow: hidden; text-overflow: ellipsis; }

.mini-lane { display: flex; align-items: center; margin: .4rem 0 .6rem; }
.mini-lane i { width: 18px; height: 18px; border-radius: 50%; flex: none; }
.mini-lane i:first-child { background: var(--dc); }
.mini-lane i:last-child { background: var(--fx); }
.mini-lane span { flex: 1; height: 5px; background: linear-gradient(90deg, var(--dc), var(--fx)); }
.auth .box > .btn { align-self: stretch; justify-content: center; }
.auth form .btn { justify-content: center; }
progress { appearance: none; -webkit-appearance: none; border: 0; background: var(--line); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--line); border-radius: 4px; }
progress::-webkit-progress-value { background: linear-gradient(90deg, var(--dc), var(--fx)); border-radius: 4px; }
progress::-moz-progress-bar { background: linear-gradient(90deg, var(--dc), var(--fx)); border-radius: 4px; }
@media (max-width: 600px) {
  .lane { grid-template-columns: 1fr; }
  .lane .end.src { border-radius: 12px 12px 0 0; border-left: 1px solid var(--line); border-top: 5px solid var(--dc); }
  .lane .end.dst { border-radius: 0 0 12px 12px; text-align: left; border-right: 1px solid var(--line); border-bottom: 5px solid var(--fx); }
  .lane .wire { width: 6px; height: 22px; margin: 0 auto; background: linear-gradient(var(--dc), var(--fx)); }
}
.auth form .btn.primary { align-self: stretch; }

.center { text-align: center; }
.fxlogin { justify-content: center; text-decoration: none; }
