/* ============================================================================
   SBOM Extractor — design tokens & global layer
   ----------------------------------------------------------------------------
   Design system: indigo→violet accent on cool-grey surface tiers, generous
   spacing, glass cards, soft layered shadows, dark-mode first-class.
   ========================================================================= */

:root {
  color-scheme: light dark;

  /* ---- Surface palette (light) ---- */
  --bg-0: #f6f7fb;          /* page background */
  --bg-1: #ffffff;          /* card surface */
  --bg-2: #f1f3f9;          /* nested surface */
  --bg-3: #e7eaf4;          /* deeply nested / inactive */
  --surface-glass: rgba(255, 255, 255, 0.78);
  --surface-glass-border: rgba(231, 234, 244, 0.9);

  /* ---- Foreground ---- */
  --fg: #0e1320;
  --fg-soft: #2c3144;
  --muted: #6a7184;
  --muted-strong: #4f5667;

  /* ---- Lines ---- */
  --border: #e3e7f1;
  --border-strong: #c9cfdf;
  --border-emphasis: #aab3c8;

  /* ---- Brand: Navy- und Cobaltblau ---- */
  --accent: #002b7f;
  --accent-2: #1a4fb0;
  --accent-hover: #001e5c;
  --accent-soft: #e6ecf6;
  --accent-ring: rgba(0, 43, 127, 0.35);
  --accent-glow: rgba(0, 43, 127, 0.22);

  /* ---- Semantic ---- */
  --ok: #10b981;
  --ok-soft: rgba(16, 185, 129, 0.12);
  --ok-border: rgba(16, 185, 129, 0.32);
  --warn: #d97706;
  --warn-soft: rgba(217, 119, 6, 0.12);
  --warn-border: rgba(217, 119, 6, 0.32);
  --error: #dc2626;
  --error-soft: rgba(220, 38, 38, 0.12);
  --error-border: rgba(220, 38, 38, 0.32);

  /* ---- Shadows (layered) ---- */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, .05), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, .06), 0 2px 6px rgba(15, 23, 42, .04);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, .08), 0 4px 14px rgba(15, 23, 42, .05);
  --shadow-accent: 0 8px 24px var(--accent-glow);

  /* ---- Geometry ---- */
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --radius-pill: 999px;

  /* ---- Fonts ---- */
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono",
    Menlo, "Consolas", monospace;

  /* ---- Motion ---- */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-0: #07090f;
    --bg-1: #10131c;
    --bg-2: #161a26;
    --bg-3: #1d2230;
    --surface-glass: rgba(16, 19, 28, 0.66);
    --surface-glass-border: rgba(46, 53, 73, 0.8);

    --fg: #ecf0f6;
    --fg-soft: #c6cddc;
    --muted: #8a93a8;
    --muted-strong: #aab2c5;

    --border: #232a3a;
    --border-strong: #2e3650;
    --border-emphasis: #3a425f;

    --accent: #6c8dd9;
    --accent-2: #8aa9ea;
    --accent-hover: #94b1ec;
    --accent-soft: #0e1a35;
    --accent-ring: rgba(108, 141, 217, 0.5);
    --accent-glow: rgba(108, 141, 217, 0.30);

    --ok: #34d399;
    --ok-soft: rgba(52, 211, 153, 0.12);
    --ok-border: rgba(52, 211, 153, 0.32);
    --warn: #f59e0b;
    --warn-soft: rgba(245, 158, 11, 0.12);
    --warn-border: rgba(245, 158, 11, 0.32);
    --error: #f87171;
    --error-soft: rgba(248, 113, 113, 0.12);
    --error-border: rgba(248, 113, 113, 0.32);

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .4), 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-md: 0 6px 16px rgba(0, 0, 0, .45), 0 2px 6px rgba(0, 0, 0, .3);
    --shadow-lg: 0 24px 48px rgba(0, 0, 0, .5), 0 8px 20px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-0);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11", "ss01";
}

::selection { background: var(--accent-soft); color: var(--accent-hover); }

/* ============================================================================
   Aurora background — multi-layer radial mesh + subtle grain
   ========================================================================= */
.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(900px 580px at 8% -8%, rgba(0, 43, 127, .22), transparent 62%),
    radial-gradient(800px 520px at 110% 6%, rgba(26, 79, 176, .18), transparent 60%),
    radial-gradient(700px 460px at 50% 110%, rgba(0, 87, 184, .14), transparent 60%);
}
.bg::after {
  content: "";
  position: absolute; inset: 0;
  background-image:
    radial-gradient(rgba(15, 23, 42, .04) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: .35;
  mix-blend-mode: multiply;
}
@media (prefers-color-scheme: dark) {
  .bg::after {
    background-image: radial-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px);
    mix-blend-mode: screen;
    opacity: .6;
  }
}

/* ============================================================================
   Top bar — sticky, glassy on scroll
   ========================================================================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  background: linear-gradient(to bottom, var(--surface-glass), transparent);
  border-bottom: 1px solid transparent;
  transition: border-color .2s var(--ease), background .2s var(--ease);
}
.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.topbar.is-scrolled { border-bottom-color: var(--border); }

.brand { display: flex; align-items: center; gap: .9rem; }
.logo {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: grid; place-items: center;
  color: white;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  box-shadow: var(--shadow-accent), inset 0 1px 0 rgba(255, 255, 255, .18);
  position: relative;
}
.logo::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  background: radial-gradient(ellipse at 30% 20%, rgba(255, 255, 255, .25), transparent 60%);
  pointer-events: none;
}
.title {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.015em;
  line-height: 1.1;
}
.subtitle {
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.2;
  margin-top: 2px;
}
.topbar-meta { display: flex; align-items: center; gap: .55rem; }

/* ============================================================================
   Pills & badges
   ========================================================================= */
.pill {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .3rem .7rem;
  border-radius: var(--radius-pill);
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--fg-soft);
  font-size: .76rem;
  font-family: var(--font-mono);
  letter-spacing: .01em;
}
.pill::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px var(--ok-soft);
  flex-shrink: 0;
}
/* Versions-Pill: kein Status-Dot, dafür Brand-Akzent */
.pill.version-pill::before {
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.pill.version-pill {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: rgba(0, 43, 127, .25);
}

.state-badge {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .25rem .65rem;
  border-radius: var(--radius-pill);
  font-size: .73rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--muted-strong);
  line-height: 1.4;
  white-space: nowrap;
}
.state-badge::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: .85;
  flex-shrink: 0;
}
.state-badge.is-queued    { background: var(--bg-2);     color: var(--muted-strong); border-color: var(--border-strong); }
.state-badge.is-running   { background: var(--warn-soft); color: var(--warn);  border-color: var(--warn-border); }
.state-badge.is-running::before { animation: pulse-dot 1.4s ease-in-out infinite; }
.state-badge.is-done      { background: var(--ok-soft);   color: var(--ok);    border-color: var(--ok-border); }
.state-badge.is-failed    { background: var(--error-soft); color: var(--error); border-color: var(--error-border); }
.state-badge.is-cancelled { background: transparent;       color: var(--error); border-color: var(--error-border); }

@keyframes pulse-dot {
  0%, 100% { transform: scale(1);   opacity: .85; }
  50%      { transform: scale(1.35); opacity: 1;   }
}

/* Legacy `.state-pill` (still set by the app for uploads) — keep working */
.state-pill { text-transform: capitalize; letter-spacing: .02em; }
.state-pill.is-uploading { background: var(--accent-soft); color: var(--accent); border-color: rgba(99, 102, 241, .3); }
.state-pill.is-running   { background: var(--warn-soft);   color: var(--warn);   border-color: var(--warn-border); }
.state-pill.is-done      { background: var(--ok-soft);     color: var(--ok);     border-color: var(--ok-border); }
.state-pill.is-failed,
.state-pill.is-cancelled { background: var(--error-soft);  color: var(--error);  border-color: var(--error-border); }

/* ============================================================================
   Main layout & cards
   ========================================================================= */
main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.4rem 1.5rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.4rem 1.5rem;
  position: relative;
  animation: card-in .35s var(--ease-out) both;
}
.card:hover { box-shadow: var(--shadow-md); transition: box-shadow .2s var(--ease); }

@keyframes card-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
  flex-wrap: wrap;
}
.card-head h2 {
  margin: 0;
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .12em;
  color: var(--muted);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: .6rem;
}
.card-head h2::before {
  content: "";
  width: 4px;
  height: 16px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-2) 100%);
}

.muted { color: var(--muted); }
.small { font-size: .82rem; }
.mono  { font-family: var(--font-mono); font-feature-settings: "calt" 0, "liga" 0; }

/* ============================================================================
   Dropzone — invitation-first, lively on drag
   ========================================================================= */
.dropzone {
  position: relative;
  border: 1.5px dashed var(--border-strong);
  background:
    linear-gradient(180deg, var(--bg-2) 0%, var(--bg-1) 100%);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  transition: border-color .18s var(--ease), background .18s var(--ease),
              transform .18s var(--ease), box-shadow .18s var(--ease);
  outline: none;
  min-height: 160px;
  overflow: hidden;
}
.dropzone::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1.5px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  opacity: 0;
  transition: opacity .18s var(--ease);
  pointer-events: none;
}
.dropzone:hover,
.dropzone:focus-visible {
  border-color: transparent;
  background: linear-gradient(180deg, var(--accent-soft) 0%, var(--bg-1) 100%);
  box-shadow: var(--shadow-accent);
}
.dropzone:hover::before,
.dropzone:focus-visible::before,
.dropzone.is-dragging::before { opacity: 1; }
.dropzone.is-dragging {
  border-color: transparent;
  background: linear-gradient(180deg, var(--accent-soft) 0%, var(--bg-1) 100%);
  transform: scale(1.005);
  box-shadow: var(--shadow-accent);
}
.dropzone.has-file { cursor: default; padding: 1.1rem 1.25rem; min-height: 0; }
.dropzone.has-file:hover {
  border-color: var(--border-strong);
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-1) 100%);
  box-shadow: var(--shadow-xs);
}
.dropzone.has-file:hover::before { opacity: 0; }

.dz-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .6rem;
  color: var(--fg-soft);
}
.dz-empty svg {
  color: var(--accent);
  filter: drop-shadow(0 4px 12px var(--accent-glow));
}
.dz-empty a { color: var(--accent); text-decoration: none; font-weight: 600; }
.dz-empty a:hover { text-decoration: underline; }
.dz-empty strong { color: var(--fg); font-weight: 600; }

.dz-filled {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 1rem;
  text-align: left;
}
.file-icon {
  width: 48px; height: 48px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: white;
  flex-shrink: 0;
  box-shadow: var(--shadow-accent), inset 0 1px 0 rgba(255, 255, 255, .15);
}
.file-meta { flex: 1; min-width: 0; }
.file-name {
  font-weight: 600;
  word-break: break-all;
  color: var(--fg);
  line-height: 1.3;
}

.icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  cursor: pointer;
  color: var(--muted);
  transition: background .15s var(--ease), border-color .15s var(--ease),
              color .15s var(--ease);
  flex-shrink: 0;
}
.icon-btn:hover {
  background: var(--error-soft);
  color: var(--error);
  border-color: var(--error-border);
}
.icon-btn:focus-visible {
  outline: 2px solid var(--accent-ring);
  outline-offset: 2px;
}

/* ============================================================================
   Passwords details panel
   ========================================================================= */
.passwords {
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  overflow: hidden;
  transition: border-color .15s var(--ease);
}
.passwords:hover { border-color: var(--border-strong); }
.passwords > summary {
  list-style: none;
  cursor: pointer;
  padding: .65rem .9rem;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
  font-weight: 500;
  color: var(--fg-soft);
  transition: background .12s var(--ease);
}
.passwords > summary:hover { background: var(--bg-3); }
.passwords > summary::-webkit-details-marker { display: none; }
.passwords > summary::before {
  content: "▸";
  color: var(--muted);
  font-size: .7rem;
  margin-right: -.2rem;
  transition: transform .18s var(--ease);
  display: inline-block;
}
.passwords[open] > summary::before { transform: rotate(90deg); }
.passwords[open] > summary { border-bottom: 1px solid var(--border); background: var(--bg-3); }
.passwords p { margin: .9rem .9rem .5rem; }
.passwords code {
  background: var(--bg-3);
  padding: .08rem .35rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: .82em;
}
.passwords textarea {
  width: calc(100% - 1.8rem);
  margin: 0 .9rem .9rem;
  padding: .65rem .8rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-1);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: .85rem;
  resize: vertical;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.passwords textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

/* ============================================================================
   Buttons
   ========================================================================= */
.actions {
  display: flex;
  gap: .65rem;
  align-items: center;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}
button {
  font: inherit;
  font-weight: 600;
  border-radius: 10px;
  border: 1px solid transparent;
  padding: .55rem 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  letter-spacing: -0.005em;
  transition: background .15s var(--ease), color .15s var(--ease),
              border-color .15s var(--ease), transform .08s var(--ease),
              box-shadow .15s var(--ease);
  position: relative;
}
button:focus-visible {
  outline: 2px solid var(--accent-ring);
  outline-offset: 2px;
}
button:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: not-allowed; transform: none; }

button.primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: white;
  box-shadow: var(--shadow-sm), 0 6px 16px var(--accent-glow),
              inset 0 1px 0 rgba(255, 255, 255, .2);
}
button.primary:hover:not(:disabled) {
  box-shadow: var(--shadow-md), 0 10px 24px var(--accent-glow),
              inset 0 1px 0 rgba(255, 255, 255, .25);
  transform: translateY(-1px);
}
button.primary:active { transform: translateY(0); }

button.ghost {
  background: transparent;
  color: var(--fg-soft);
  border-color: var(--border);
}
button.ghost:hover:not(:disabled) {
  background: var(--bg-2);
  color: var(--fg);
  border-color: var(--border-strong);
}

button.danger {
  background: transparent;
  color: var(--error);
  border-color: var(--error-border);
}
button.danger:hover:not(:disabled) {
  background: var(--error-soft);
  border-color: var(--error);
}

/* ============================================================================
   Key/value grid for active job
   ========================================================================= */
.kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem 1.4rem;
  margin-bottom: 1.2rem;
  padding: 1rem 1.1rem;
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.kv-label {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: .3rem;
}
.kv-value {
  font-size: .9rem;
  word-break: break-all;
  color: var(--fg);
  line-height: 1.45;
}

/* ============================================================================
   Phase row + progress bar
   ========================================================================= */
.phase-row {
  margin: 0 0 1.2rem;
  padding: .9rem 1.1rem;
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.phase-label {
  display: block;
  font-size: .72rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .12em;
  margin-bottom: .55rem;
  min-height: 1em;
}
.phase-label:empty::before {
  content: "Awaiting first log line…";
  color: var(--muted);
}

.progress-block { margin-top: .8rem; }
.progress-row {
  display: flex;
  align-items: center;
  gap: .8rem;
}
.progress-track {
  flex: 1;
  height: 10px;
  border-radius: var(--radius-pill);
  background: var(--bg-3);
  overflow: hidden;
  border: 1px solid var(--border);
  position: relative;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) 60%, #4a7ecf 100%);
  background-size: 200% 100%;
  border-radius: var(--radius-pill);
  transition: width .25s var(--ease-out);
  position: relative;
  box-shadow: 0 0 12px var(--accent-glow);
}
.progress-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, .35) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: shimmer 2s linear infinite;
}
@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

.progress-pct {
  font-family: var(--font-mono);
  font-size: .82rem;
  font-weight: 600;
  width: 52px;
  text-align: right;
  color: var(--fg-soft);
  font-variant-numeric: tabular-nums;
}

/* Indeterminate variant (when we don't have a % yet) */
.progress-track.indeterminate {
  background:
    linear-gradient(90deg, var(--accent-soft) 0%, var(--bg-3) 50%, var(--accent-soft) 100%);
  background-size: 200% 100%;
  animation: indeterminate 1.6s linear infinite;
}
.progress-track.indeterminate .progress-bar { display: none; }
@keyframes indeterminate {
  from { background-position: -100% 0; }
  to   { background-position: 100% 0; }
}

/* ============================================================================
   Live log panel — terminal aesthetic
   ========================================================================= */
.log-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  overflow: hidden;
}
.log-wrap > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .55rem .9rem;
  font-weight: 600;
  color: var(--fg-soft);
  font-size: .85rem;
}
.log-wrap > summary::-webkit-details-marker { display: none; }
.log-wrap > summary::before {
  content: "▸";
  color: var(--muted);
  font-size: .7rem;
  margin-right: .5rem;
  display: inline-block;
  transition: transform .18s var(--ease);
}
.log-wrap[open] > summary::before { transform: rotate(90deg); }
.log-wrap[open] > summary { border-bottom: 1px solid var(--border); background: var(--bg-3); }

.log {
  background: #0a0c14;
  color: #d4dbe6;
  padding: 1rem 1.1rem;
  border-radius: 0;
  max-height: 360px;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: .78rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  scrollbar-color: #2c3242 #0a0c14;
  scrollbar-width: thin;
  position: relative;
}
.log::-webkit-scrollbar { width: 10px; height: 10px; }
.log::-webkit-scrollbar-track { background: #0a0c14; }
.log::-webkit-scrollbar-thumb { background: #2c3242; border-radius: 5px; border: 2px solid #0a0c14; }
.log::-webkit-scrollbar-thumb:hover { background: #3a4256; }
.log:empty::before {
  content: "(no log output yet)";
  color: #6a7184;
  font-style: italic;
}
.log .err { color: #f87171; }
.log .meta { color: #71809a; }

/* ============================================================================
   Downloads
   ========================================================================= */
.downloads {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.downloads li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .7rem .9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  gap: 1rem;
  transition: border-color .12s var(--ease), background .12s var(--ease),
              transform .12s var(--ease);
}
.downloads li:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateX(2px);
}
.downloads .dl-name { font-weight: 600; word-break: break-all; }
.downloads .filesize {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: .82rem;
  font-variant-numeric: tabular-nums;
}
.downloads a.dl-btn {
  text-decoration: none;
  color: var(--accent);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .4rem .75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-1);
  font-size: .82rem;
  transition: background .12s var(--ease), border-color .12s var(--ease),
              color .12s var(--ease);
}
.downloads a.dl-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

footer {
  color: var(--muted);
  font-size: .8rem;
  text-align: center;
  padding-top: 1.5rem;
  line-height: 1.6;
}

/* ============================================================================
   Inline-Viewer-Modal
   ========================================================================= */
.viewer-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(7, 9, 15, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  animation: fadeIn .15s var(--ease-out);
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }

.viewer-modal-box {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-width: 1100px;
  width: 100%;
  height: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.viewer-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .9rem 1.1rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
  flex-wrap: wrap;
}
.viewer-modal-title {
  font-family: var(--font-mono);
  font-size: .9rem;
  color: var(--fg);
  word-break: break-all;
  flex: 1;
  min-width: 0;
}
.viewer-modal-actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}
.viewer-modal-body {
  flex: 1;
  min-height: 0;
  background: var(--bg-2);
  display: flex;
  align-items: stretch;
  justify-content: stretch;
}
.viewer-modal-iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--bg-1);
}
.viewer-modal-loading {
  margin: auto;
  color: var(--muted);
  font-size: .9rem;
}

/* Drei Buttons pro Download-Eintrag nebeneinander */
.dl-item .dl-actions {
  display: flex;
  gap: .35rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* ============================================================================
   Primärer Output (summary.html) prominent über den anderen Dateien
   ========================================================================= */
.primary-output { margin-bottom: .7rem; }
.dl-item.primary {
  background: linear-gradient(135deg, var(--accent-soft) 0%, var(--bg-2) 100%);
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.dl-item.primary .dl-name {
  color: var(--accent);
  font-weight: 700;
}
.dl-btn.primary {
  background: var(--accent);
  color: white !important;
  border-color: var(--accent);
}
.dl-btn.primary:hover { background: var(--accent-hover); }

/* „Weitere Dateien"-Aufklapp-Block */
details.other-outputs {
  margin-top: .4rem;
  border-top: 1px dashed var(--border);
  padding-top: .55rem;
}
details.other-outputs > summary {
  list-style: none;
  cursor: pointer;
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted-strong);
  padding: .25rem 0;
  user-select: none;
}
details.other-outputs > summary::-webkit-details-marker { display: none; }
details.other-outputs > summary:hover { color: var(--accent); }
details.other-outputs .caret {
  display: inline-block;
  transition: transform .15s var(--ease);
  margin-right: .3rem;
  opacity: .6;
}
details.other-outputs[open] .caret { transform: rotate(90deg); }
details.other-outputs > ul { margin-top: .4rem; }

/* Footer der Job-Karte mit Bundle-Download */
.job-card-footer {
  margin-top: .8rem;
  padding-top: .7rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}
.dl-btn.bundle-btn {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(0, 43, 127, .3);
  font-weight: 600;
}
.dl-btn.bundle-btn:hover {
  background: var(--accent);
  color: white !important;
}

/* ============================================================================
   Print-Stylesheet
   ========================================================================= */
@media print {
  body { background: white; color: black; }
  .bg, .topbar, button, .actions, footer, .toast,
  #uploadCard, #activeJob, .viewer-modal,
  .job-card-toggle, .icon-btn { display: none !important; }
  main { padding: 0 !important; }
  .card {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    page-break-inside: avoid;
    background: white !important;
    color: black !important;
  }
  .job-card { page-break-inside: avoid; }
  .job-card .job-card-detail { display: block !important; }   /* alles aufklappen */
  details, details[open], details:not([open]) { display: block !important; }
  details > * { display: block !important; }
  .dl-item .dl-actions { display: none; }
}
footer em {
  font-style: normal;
  font-weight: 600;
  color: var(--fg-soft);
}
footer p { margin: 0 auto 1rem; max-width: 720px; }

/* Transparenz-Streifen: welche Open-Source-Tools die App benutzt */
.tools-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .3rem .35rem;
  font-size: .73rem;
  padding: .5rem 0;
  line-height: 1.4;
}
.tools-strip .tools-label {
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: .3rem;
  font-size: .68rem;
}
.tools-strip a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  padding: .15rem .45rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-1);
  transition: background .12s var(--ease), border-color .12s var(--ease);
}
.tools-strip a:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.tools-strip .tools-sep {
  color: var(--muted);
  opacity: .5;
  font-size: .7rem;
  user-select: none;
}
.tools-strip.muted a {
  color: var(--muted);
  border-style: dashed;
  background: transparent;
}
.tools-strip.muted a:hover {
  color: var(--accent);
  border-style: solid;
}

/* ============================================================================
   Toast
   ========================================================================= */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: var(--bg-1);
  border: 1px solid var(--border);
  padding: .7rem 1.2rem;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  max-width: calc(100% - 2rem);
  animation: toast-in .25s var(--ease-out);
  font-weight: 500;
  font-size: .9rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.toast.is-error { border-color: var(--error-border); color: var(--error); }
.toast.is-ok    { border-color: var(--ok-border);    color: var(--ok);    }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ============================================================================
   Job history — timeline-style with left-edge state indicator
   ========================================================================= */
.job-history-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: .55rem;
}
.history-empty {
  margin: .4rem 0 0;
  padding: 1.2rem;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
}
#jobHistory:not(:empty) ~ .history-empty { display: none; }

.job-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-1);
  overflow: hidden;
  transition: border-color .15s var(--ease), background .15s var(--ease),
              box-shadow .15s var(--ease), transform .15s var(--ease);
  position: relative;
}
.job-card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--border-strong);
  transition: background .15s var(--ease);
}
.job-card.has-state-queued::before    { background: var(--muted); }
.job-card.has-state-running::before   { background: var(--warn); }
.job-card.has-state-done::before      { background: var(--ok); }
.job-card.has-state-failed::before    { background: var(--error); }
.job-card.has-state-cancelled::before { background: var(--error); opacity: .6; }

.job-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.job-card.is-expanded {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.job-card-summary {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .8rem 1rem .8rem 1.1rem;
  flex-wrap: wrap;
  cursor: pointer;
}
.job-card-name {
  font-weight: 600;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--fg);
}
.job-card-size {
  white-space: nowrap;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: .8rem;
  font-variant-numeric: tabular-nums;
}
.job-card-runtime {
  margin-left: auto;
  white-space: nowrap;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: .8rem;
  font-variant-numeric: tabular-nums;
}
.job-card-toggle {
  color: var(--muted);
  font-size: .75rem;
  flex-shrink: 0;
  transition: transform .18s var(--ease);
  user-select: none;
}
.job-card.is-expanded .job-card-toggle { transform: rotate(90deg); color: var(--accent); }

.job-card-detail {
  display: none;
  padding: 1rem 1.1rem 1.1rem;
  border-top: 1px solid var(--border);
  background: var(--bg-2);
}
.job-card.is-expanded .job-card-detail { display: block; }

.job-error {
  margin-bottom: .7rem;
  padding: .7rem .9rem;
  border-radius: 8px;
  background: var(--error-soft);
  border: 1px solid var(--error-border);
  color: var(--error);
  font-size: .85rem;
}

.job-downloads {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.dl-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-1);
  gap: 1rem;
  transition: border-color .12s var(--ease), background .12s var(--ease);
}
.dl-item:hover { border-color: var(--border-strong); background: var(--bg-2); }
.dl-name { font-weight: 600; word-break: break-all; flex: 1; }
.filesize {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: .8rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.dl-btn {
  text-decoration: none;
  color: var(--accent);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .35rem .65rem;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  font-size: .8rem;
  transition: all .12s var(--ease);
  white-space: nowrap;
}
.dl-btn:hover { background: var(--accent); border-color: var(--accent); color: white; }

/* ============================================================================
   Upload progress block (during tus upload)
   ========================================================================= */
#uploadProgressBlock {
  margin-top: 1.1rem;
  padding: .9rem 1.1rem;
  background: var(--accent-soft);
  border: 1px solid rgba(99, 102, 241, .25);
  border-radius: var(--radius-sm);
}
#uploadProgressBlock #uploadStats {
  margin-top: .5rem;
  font-family: var(--font-mono);
  font-size: .78rem;
  font-variant-numeric: tabular-nums;
}

/* ============================================================================
   Responsive
   ========================================================================= */
/* ============================================================================
   Tablet / mittleres Layout (Breakpoint: 720px)
   ========================================================================= */
@media (max-width: 720px) {
  main { padding: 1rem 1rem 3rem; gap: .9rem; }
  .topbar-inner { padding: .85rem 1rem; gap: .65rem; }
  .card { padding: 1.05rem 1.05rem; }
  .card-head {
    margin-bottom: .9rem;
    flex-direction: column;
    align-items: flex-start;
    gap: .4rem;
  }
  .card-head h2 { font-size: .78rem; }
  .kv-grid { padding: .85rem; gap: .8rem; grid-template-columns: 1fr 1fr; }
  .title { font-size: .98rem; }
  .subtitle { font-size: .78rem; }
  .dropzone { padding: 1.4rem 1rem; min-height: 140px; }
  .dz-empty svg { width: 28px; height: 28px; }
  .dz-empty { gap: .4rem; }

  /* Job-Karten kompakter + nicht-überlaufende Beschriftung */
  .job-card-summary {
    gap: .45rem;
    padding: .7rem .85rem .7rem .95rem;
    align-items: center;
  }
  .job-card-name {
    flex: 1 1 100%;
    order: 5;
    min-width: 0;
    font-size: .95rem;
  }
  .job-card-size, .job-card-runtime {
    font-size: .75rem;
  }
  .job-card-runtime { margin-left: auto; }
  .job-card-detail { padding: .8rem .85rem .9rem; }

  /* Download-Zeilen: drei Action-Buttons UNTER dem Dateinamen, voll breit */
  .dl-item, .downloads li {
    flex-wrap: wrap;
    gap: .35rem .6rem;
  }
  .dl-item .dl-name, .downloads .dl-name {
    flex: 1 1 100%;
    word-break: break-all;
    min-width: 0;
  }
  .dl-item .filesize, .downloads .filesize {
    flex: 0 0 auto;
    font-size: .75rem;
  }
  .dl-item .dl-actions {
    flex: 1 1 100%;
    justify-content: stretch;
    gap: .3rem;
  }
  .dl-item .dl-actions .dl-btn {
    flex: 1 1 auto;
    min-width: 0;
    justify-content: center;
    text-align: center;
    padding: .45rem .55rem;
    font-size: .8rem;
  }
  .dl-btn.bundle-btn {
    width: 100%;
    justify-content: center;
  }
  .job-card-footer {
    justify-content: stretch;
  }

  /* Process / kv-Werte umbrechen statt overflow */
  .kv-value {
    font-size: .85rem;
  }

  /* Logs: kleinere Schrift, niedriger */
  .log {
    font-size: .72rem;
    padding: .65rem .75rem;
    max-height: 260px;
  }

  /* Stepper kompakter */
  .stepper { gap: .2rem; }
  .stepper li { padding: .4rem .5rem; gap: .55rem; }
  .step-name { font-size: .92rem; }

  /* Progress-Row: Prozent unter dem Balken */
  .progress-row { flex-wrap: wrap; }
  .progress-track { flex: 1 1 100%; }
  .progress-pct { width: auto; text-align: left; }

  /* Modal-Viewer: full viewport auf Mobile */
  .viewer-modal {
    padding: 0;
    /* Box oben verankern statt zentrieren — sonst verschiebt die kleinere
       dvh-Box gegenüber dem lvh-Overlay den Inhalt unter die Statusleiste. */
    align-items: stretch;
  }
  .viewer-modal-box {
    height: 100vh;            /* Fallback für Browser ohne dvh-Unterstützung */
    height: 100dvh;           /* dynamische Viewport-Höhe — Inhalt bleibt sichtbar,
                                 nicht hinter der ein-/ausfahrenden Browserleiste */
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }
  .viewer-modal-head {
    padding: .7rem .85rem;
    /* Notch / Statusleiste: Kopf nicht unter die Aussparung schieben. */
    padding-top: calc(.7rem + env(safe-area-inset-top));
    flex-direction: column;
    align-items: flex-start;
    gap: .55rem;
  }
  .viewer-modal-actions {
    width: 100%;
    justify-content: stretch;
  }
  .viewer-modal-actions .dl-btn {
    flex: 1 1 auto;
    justify-content: center;
  }
}

/* ============================================================================
   Phone (Breakpoint: 480px) — kompaktestes Layout
   ========================================================================= */
@media (max-width: 480px) {
  body { font-size: 14px; }
  html, body { line-height: 1.45; }

  /* Versions-Pill auf engstem Layout ausblenden — Topbar bleibt einzeilig */
  .topbar-meta .version-pill,
  .topbar-meta .pill { display: none; }
  .topbar-meta { gap: .4rem; }
  .topbar-inner { padding: .7rem .85rem; }
  .logo { width: 32px; height: 32px; }
  .logo svg { width: 18px; height: 18px; }
  .title { font-size: .9rem; }
  .subtitle { font-size: .72rem; }

  main { padding: .8rem .75rem 2.5rem; gap: .75rem; }

  .card { padding: .9rem .9rem; border-radius: 12px; }
  .card-head h2 { font-size: .72rem; letter-spacing: .1em; }

  /* KV-Grid auf eine Spalte */
  .kv-grid {
    grid-template-columns: 1fr;
    padding: .7rem .8rem;
    gap: .6rem .8rem;
  }

  /* Dropzone: kompakt */
  .dropzone { padding: 1.1rem .8rem; min-height: 110px; }
  .dz-empty svg { width: 24px; height: 24px; }
  .dz-empty strong { font-size: .9rem; }
  .dz-empty .small { font-size: .72rem; }

  .file-icon { width: 38px; height: 38px; }
  .file-icon svg { width: 22px; height: 22px; }

  /* Buttons: minimum 44px Höhe für Touch (WCAG 2.5.5) */
  button, .dl-btn, .icon-btn {
    min-height: 40px;
    padding: .55rem .8rem;
  }
  button.primary, button.ghost, button.danger {
    padding: .6rem .9rem;
    font-size: .92rem;
  }

  /* Job-Karten noch kompakter */
  .job-card-summary {
    padding: .65rem .75rem .65rem .85rem;
    gap: .35rem;
  }
  .state-badge {
    font-size: .65rem;
    padding: .15rem .5rem;
  }

  /* Footer schmaler */
  footer { padding-top: 1rem; font-size: .75rem; }

  /* Passwords-Textarea kleiner */
  .passwords textarea {
    font-size: .8rem;
    rows: 4;
  }

  /* Active Job: Phase/Progress kompakter */
  .phase-row { padding: .7rem .85rem; }
  .phase-label { font-size: .68rem; }

  /* Toast: vollbreit am unteren Rand */
  .toast {
    bottom: .8rem;
    left: .8rem;
    right: .8rem;
    transform: none;
    max-width: none;
    font-size: .85rem;
    padding: .6rem .9rem;
    border-radius: 12px;
  }
  @keyframes toast-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
  }
}

/* ============================================================================
   Reduced motion / accessibility
   ========================================================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .progress-bar::after { display: none; }
  .progress-track.indeterminate { animation: none; background: var(--accent-soft); }
  .state-badge.is-running::before { animation: none; }
}
