:root {
    --bg: #0f1115;
    --bg-elev: #161a22;
    --bg-elev-2: #1d2230;
    --border: #262c3a;
    --text: #e6e9ef;
    --text-dim: #9aa3b2;
    --accent: #5b8def;
    --accent-2: #7c5cff;
    --ok: #3ddc97;
    --warn: #ffb454;
    --danger: #ff6b6b;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 28px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(91, 141, 239, 0.06), transparent);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 { font-size: 18px; margin: 0; font-weight: 600; letter-spacing: 0.2px; }
.logo {
    width: 28px; height: 28px; border-radius: 8px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: var(--shadow);
}
.meta { display: flex; gap: 8px; }
.badge {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    color: var(--text-dim);
}

.container {
    max-width: 980px;
    margin: 28px auto;
    padding: 0 20px;
    display: grid;
    gap: 20px;
}

.dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    background: var(--bg-elev);
    padding: 48px 24px;
    text-align: center;
    transition: border-color .15s ease, background .15s ease, transform .15s ease;
    cursor: pointer;
}
.dropzone:hover { border-color: var(--accent); }
.dropzone.drag {
    border-color: var(--accent);
    background: linear-gradient(180deg, rgba(91, 141, 239, 0.10), rgba(124, 92, 255, 0.06));
    transform: scale(1.005);
}
.drop-inner h2 { margin: 8px 0 6px; font-size: 20px; font-weight: 600; }
.drop-inner p { margin: 4px 0; color: var(--text-dim); }
.drop-inner .hint { font-size: 12px; }
.drop-icon {
    width: 56px; height: 56px; border-radius: 50%;
    margin: 0 auto 8px;
    background:
      radial-gradient(circle at center, rgba(91, 141, 239, 0.25), transparent 70%),
      var(--bg-elev-2);
    position: relative;
}
.drop-icon::after {
    content: "";
    position: absolute; inset: 0;
    background: conic-gradient(from 90deg, var(--accent), var(--accent-2), var(--accent));
    -webkit-mask: radial-gradient(circle at center, transparent 18px, black 19px, black 22px, transparent 23px);
            mask: radial-gradient(circle at center, transparent 18px, black 19px, black 22px, transparent 23px);
    border-radius: 50%;
}

.link {
    color: var(--accent);
    background: none;
    border: none;
    cursor: pointer;
    font: inherit;
    padding: 0;
    text-decoration: underline;
}

.panel {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-elev-2);
}
.panel-head h3 { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: 0.3px; color: var(--text-dim); text-transform: uppercase; }
.actions { display: flex; gap: 8px; }

.list { list-style: none; margin: 0; padding: 0; }
.list li {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 8px 14px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
}
.list li:last-child { border-bottom: none; }

.item-main { min-width: 0; display: grid; gap: 6px; }
.item-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 14px;
}
.item-sub {
    font-size: 12px;
    color: var(--text-dim);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.item-sub .status-tag {
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--bg-elev-2);
    border: 1px solid var(--border);
}
.item-sub .status-tag.ok { color: var(--ok); border-color: rgba(61, 220, 151, 0.4); }
.item-sub .status-tag.warn { color: var(--warn); border-color: rgba(255, 180, 84, 0.4); }
.item-sub .status-tag.err { color: var(--danger); border-color: rgba(255, 107, 107, 0.4); }

.bar {
    height: 8px;
    background: var(--bg-elev-2);
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    transition: width .2s ease;
}

.item-actions { display: flex; gap: 6px; }

.btn {
    background: var(--bg-elev-2);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 7px 12px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: background .12s ease, border-color .12s ease, transform .05s ease;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.icon-btn {
    background: transparent;
    color: var(--text-dim);
    border: none;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
}
.icon-btn:hover { color: var(--text); background: var(--bg-elev-2); }

.modal {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex; align-items: center; justify-content: center;
    z-index: 50;
    backdrop-filter: blur(4px);
}
.modal[hidden] { display: none !important; }
.modal-card {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: min(520px, calc(100% - 32px));
    overflow: hidden;
    box-shadow: var(--shadow);
}
.modal-card header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-elev-2);
}
.modal-card header h3 { margin: 0; font-size: 15px; }
.modal-body { padding: 18px; display: grid; gap: 12px; }
.status { margin: 0; color: var(--text-dim); font-size: 13px; }
.current {
    margin: 0;
    font-size: 12px;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.timeline {
    display: flex;
    align-items: stretch;
    gap: 0;
    margin-top: 10px;
    flex-wrap: nowrap;
    overflow-x: auto;
}
.timeline .step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 64px;
    flex: 0 0 auto;
    font-size: 11px;
    color: var(--text-dim);
}
.timeline .step .label {
    transition: color .2s ease;
    white-space: nowrap;
}
.timeline .step .dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--bg-elev-2);
    border: 2px solid var(--border);
    transition: background .2s ease, border-color .2s ease, transform .15s ease;
    position: relative;
}
.timeline .step.done .dot {
    background: var(--ok);
    border-color: var(--ok);
}
.timeline .step.done .dot::after {
    content: "";
    position: absolute;
    left: 3px;
    top: 1px;
    width: 4px;
    height: 8px;
    border: solid #0f1115;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.timeline .step.run .dot {
    background: var(--accent);
    border-color: var(--accent);
    animation: ut-pulse 1.1s ease-in-out infinite;
}
.timeline .step.err .dot {
    background: var(--danger);
    border-color: var(--danger);
}
.timeline .step.done .label { color: var(--ok); }
.timeline .step.run .label  { color: var(--accent); }
.timeline .step.err .label  { color: var(--danger); }

.timeline .line {
    flex: 1 1 24px;
    min-width: 24px;
    height: 2px;
    background: var(--border);
    margin-top: 8px;
    transition: background .2s ease;
}
.timeline .line.done { background: var(--ok); }
.timeline .line.run {
    background: linear-gradient(90deg, var(--ok), var(--accent));
}

.mini-bar {
    height: 4px;
    margin-top: 6px;
    background: var(--bg-elev-2);
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.mini-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    transition: width .2s ease;
}

.status-toggle {
    align-self: start;
    background: transparent;
    color: var(--text-dim);
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 11px;
    font-family: inherit;
    cursor: pointer;
    margin-top: 6px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color .12s ease, background .12s ease, border-color .12s ease;
}
.status-toggle:hover { color: var(--text); background: var(--bg-elev-2); border-color: var(--border); }
.status-toggle .chev { display: inline-block; width: 10px; text-align: center; color: var(--accent); }
.status-toggle[aria-expanded="true"] { color: var(--text); background: var(--bg-elev-2); border-color: var(--border); }

.status-detail {
    margin-top: 6px;
    padding: 12px 14px;
    background: var(--bg-elev-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    display: grid;
    gap: 14px;
}
.status-detail-stage { display: grid; gap: 6px; min-width: 0; }
.status-detail-head {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--accent);
    font-weight: 600;
}
.status-detail-file {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    direction: rtl;
    text-align: left;
}
.status-detail-stats {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--text-dim);
}
.status-detail-stats span {
    font-variant-numeric: tabular-nums;
}
.status-detail-error {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
    color: var(--danger);
    white-space: pre-wrap;
    word-break: break-word;
}

.status-detail-phase {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}
.phase-pill {
    font-size: 11px;
    padding: 2px 10px;
    border-radius: 999px;
    background: rgba(91, 141, 239, 0.15);
    border: 1px solid rgba(91, 141, 239, 0.35);
    color: var(--accent);
    font-weight: 500;
}
.phase-pill.phase-auth_failed,
.phase-pill.phase-server_error,
.phase-pill.phase-server_disconnect,
.phase-pill.phase-error {
    background: rgba(255, 107, 107, 0.12);
    border-color: rgba(255, 107, 107, 0.4);
    color: var(--danger);
}
.phase-pill.phase-authenticated,
.phase-pill.phase-transfer_done,
.phase-pill.phase-mkdir_ok {
    background: rgba(61, 220, 151, 0.12);
    border-color: rgba(61, 220, 151, 0.4);
    color: var(--ok);
}
.idle-pill {
    font-size: 11px;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    color: var(--text-dim);
    font-variant-numeric: tabular-nums;
}
.idle-pill.warn {
    color: var(--warn);
    border-color: rgba(255, 180, 84, 0.4);
}

.status-detail-log {
    margin-top: 4px;
    max-height: 180px;
    overflow-y: auto;
    background: #0a0c11;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
    line-height: 1.45;
}
.status-detail-log .log-line {
    white-space: pre-wrap;
    word-break: break-all;
    color: var(--text-dim);
}
.status-detail-log .log-line.out  { color: #82b1ff; }   /* gesendete Kommandos */
.status-detail-log .log-line.in   { color: #a5e8b9; }   /* Server-Antworten   */
.status-detail-log .log-line.meta { color: #8893a7; }   /* curl-Hinweise      */

@keyframes ut-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(91, 141, 239, 0.5); }
    50%      { transform: scale(1.15); box-shadow: 0 0 0 6px rgba(91, 141, 239, 0); }
}

@media (max-width: 640px) {
    .topbar { padding: 14px 16px; }
    .meta { display: none; }
    .container { padding: 0 12px; margin-top: 18px; }
    .dropzone { padding: 32px 16px; }
}
