/* ==========================================================================
   Ninja-TANSS Comparison — Dashboard Styles
   Dark-Mode als Standard, Light-Mode über :root[data-theme="light"]
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Design Tokens ───────────────────────────────────────────────── */
:root {
  color-scheme: dark;

  --bg: #0b0f16;
  --bg-elevated: #10151e;
  --bg-secondary: #151b26;
  --surface: #121824;
  --surface-raised: #18202e;
  --border: #232c3b;
  --border-strong: #32405a;

  --text: #e3e9f2;
  --text-dim: #97a3b6;
  --text-muted: #6b7688;

  --accent: #5b9dff;
  --accent-soft: rgba(91, 157, 255, 0.14);
  --accent-strong: #7db4ff;
  --green: #3fce8b;
  --green-soft: rgba(63, 206, 139, 0.13);
  --orange: #e5a13a;
  --red: #ff6b62;
  --purple: #b78cff;
  --yellow: #e5a13a;
  --on-accent: #08111f;

  --row-stripe: rgba(255, 255, 255, 0.018);
  --hover-bg: rgba(255, 255, 255, 0.045);

  --tag-ninja-bg: rgba(91, 157, 255, 0.16);
  --tag-tanss-bg: rgba(183, 140, 255, 0.16);
  --tag-both-bg: rgba(63, 206, 139, 0.16);
  --tag-none-bg: rgba(255, 107, 98, 0.16);
  --badge-1-bg: rgba(91, 157, 255, 0.16);
  --badge-2-bg: rgba(229, 161, 58, 0.16);
  --badge-3-bg: rgba(183, 140, 255, 0.16);

  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.5);
  --ring: 0 0 0 3px rgba(91, 157, 255, 0.28);

  --mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono",
    "Cascadia Mono", Menlo, Consolas, monospace;
}

:root[data-theme="light"] {
  color-scheme: light;

  --bg: #f4f6fa;
  --bg-elevated: #ffffff;
  --bg-secondary: #eef1f6;
  --surface: #ffffff;
  --surface-raised: #f7f9fc;
  --border: #e0e5ee;
  --border-strong: #c6cede;

  --text: #131a26;
  --text-dim: #57627a;
  --text-muted: #8791a5;

  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.1);
  --accent-strong: #1d4ed8;
  --green: #15864c;
  --green-soft: rgba(21, 134, 76, 0.1);
  --orange: #b06f00;
  --red: #d13b31;
  --purple: #7343d3;
  --yellow: #b06f00;
  --on-accent: #ffffff;

  --row-stripe: rgba(15, 23, 42, 0.018);
  --hover-bg: rgba(15, 23, 42, 0.04);

  --tag-ninja-bg: rgba(37, 99, 235, 0.1);
  --tag-tanss-bg: rgba(115, 67, 211, 0.1);
  --tag-both-bg: rgba(21, 134, 76, 0.1);
  --tag-none-bg: rgba(209, 59, 49, 0.1);
  --badge-1-bg: rgba(37, 99, 235, 0.1);
  --badge-2-bg: rgba(176, 111, 0, 0.12);
  --badge-3-bg: rgba(115, 67, 211, 0.1);

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 18px 48px rgba(15, 23, 42, 0.12);
  --ring: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

html {
  scrollbar-gutter: stable;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  background:
    radial-gradient(
      1100px 520px at 12% -8%,
      var(--accent-soft),
      transparent 60%
    ),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.55;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  padding: 0 0 4rem;
}

.app-shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

@media (max-width: 640px) {
  .app-shell {
    padding: 0 1rem;
  }
}

/* ── Topbar ──────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  /* Issue-Header pins below the topbar; JS reads the actual height for the
     pinned-while-closing scroll correction */
  --topbar-h: 60px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.75rem;
}

.topbar-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .topbar-inner {
    padding: 0.75rem 1rem;
  }
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.brand-mark {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(140deg, var(--accent), var(--purple));
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  box-shadow: var(--shadow-sm);
}

.brand-text {
  min-width: 0;
}

h1 {
  font-size: 1.02rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.25;
  white-space: nowrap;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.76rem;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Controls ────────────────────────────────────────────────────── */
.controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  flex-wrap: wrap;
}

.controls button {
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 0.48rem 0.95rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    transform 0.12s ease,
    box-shadow 0.15s ease;
}

.controls button:active:not(:disabled) {
  transform: translateY(1px);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: var(--radius-sm);
}

button#run-btn {
  background: var(--green);
  color: var(--on-accent);
  box-shadow: var(--shadow-sm);
}
button#run-btn:hover:not(:disabled) {
  filter: brightness(1.07);
}
button#run-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button#refresh-btn {
  background: var(--surface-raised);
  border-color: var(--border);
  color: var(--text);
}
button#refresh-btn:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: var(--hover-bg);
}
button#refresh-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button#theme-btn {
  background: var(--surface-raised);
  border-color: var(--border);
  color: var(--text-dim);
  padding: 0.48rem 0.6rem;
  line-height: 1;
}
button#theme-btn:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

/* ── Stat cards ──────────────────────────────────────────────────── */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  overflow: hidden;
  transition:
    border-color 0.15s ease,
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.stat-card::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(
    180deg,
    var(--accent),
    color-mix(in srgb, var(--purple) 70%, transparent)
  );
  opacity: 0.75;
}

.stat-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.stat-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 600;
  margin-top: 0.2rem;
}

/* ── Progress ────────────────────────────────────────────────────── */
.progress {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
  display: none;
}
.progress.visible {
  display: block;
  animation: progress-slide-in 0.3s ease-out;
}
@keyframes progress-slide-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.progress-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.7rem;
  font-size: 0.82rem;
}
.progress-title {
  font-weight: 650;
  letter-spacing: -0.01em;
}
.progress-timer {
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}
.progress-current {
  flex: 1;
  text-align: center;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.progress-percent {
  color: var(--accent);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.progress.done .progress-percent {
  color: var(--green);
}
.progress.error .progress-percent {
  color: var(--red);
}
.progress-error {
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid var(--red);
  border-radius: 8px;
  color: var(--red);
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 180px;
  overflow-y: auto;
}
.progress-track,
.progress-labels {
  display: grid;
  /* column count is set dynamically by buildProgress() (one per pipeline step) */
  grid-template-columns: repeat(var(--steps, 11), 1fr);
  gap: 4px;
}
.progress-track {
  height: 8px;
}
.progress-segment {
  position: relative;
  background: var(--bg-secondary);
  border-radius: var(--radius-pill);
  overflow: hidden;
  transition: box-shadow 0.3s;
}
.progress-segment::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
  transition:
    transform 0.6s cubic-bezier(0.4, 0, 0.2, 1),
    background 0.3s;
}
.progress-segment.done::before {
  transform: scaleX(1);
}
.progress-segment.active {
  box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 55%, transparent);
}
.progress-segment.active::before {
  transform: scaleX(1);
  background: color-mix(in srgb, var(--accent) 42%, transparent);
}
.progress-segment.active::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 45%;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(180, 214, 255, 0.35) 55%,
    rgba(234, 244, 255, 0.85) 90%,
    rgba(255, 255, 255, 0.95) 100%
  );
  transform: translateX(-100%);
  animation: progress-comet 1.4s linear infinite;
}
@keyframes progress-comet {
  to {
    transform: translateX(240%);
  }
}
.progress-segment.error {
  box-shadow: 0 0 10px color-mix(in srgb, var(--red) 60%, transparent);
  animation: progress-shake 0.4s ease;
}
.progress-segment.error::before {
  transform: scaleX(1);
  background: var(--red);
}
@keyframes progress-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-3px);
  }
  40% {
    transform: translateX(3px);
  }
  60% {
    transform: translateX(-2px);
  }
  80% {
    transform: translateX(2px);
  }
}
.progress.done .progress-segment {
  box-shadow: none;
}
.progress.done .progress-segment::before {
  background: var(--green);
  transform: scaleX(1);
  transition-delay: calc(var(--i) * 60ms);
}
.progress-labels {
  margin-top: 0.5rem;
}
.progress-step {
  font-size: 0.6rem;
  color: var(--text-muted);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition:
    color 0.3s,
    opacity 0.3s;
}
.progress-step.done {
  color: var(--text-dim);
}
.progress-step.active {
  color: var(--accent);
  font-weight: 600;
  animation: progress-label-pulse 1.4s ease-in-out infinite;
}
@keyframes progress-label-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}
.progress-step.error {
  color: var(--red);
}
.progress.done .progress-step {
  color: var(--green);
  transition-delay: calc(var(--i) * 60ms);
}
@media (max-width: 900px) {
  .progress-labels {
    display: none;
  }
}

/* ── Tabs ────────────────────────────────────────────────────────── */
.tab-nav {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.tab-nav::-webkit-scrollbar {
  display: none;
}
.tab-btn {
  position: relative;
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 0.6rem 0.95rem;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition:
    color 0.15s ease,
    background 0.15s ease;
}
.tab-btn::after {
  content: "";
  position: absolute;
  left: 0.6rem;
  right: 0.6rem;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform 0.18s ease;
}
.tab-btn:hover {
  color: var(--text);
  background: var(--hover-bg);
}
.tab-btn.active {
  color: var(--text);
}
.tab-btn.active::after {
  transform: scaleX(1);
}
.tab-count {
  display: inline-block;
  font-size: 0.7rem;
  font-family: var(--mono);
  color: var(--accent);
  margin-left: 0.3rem;
}
.tab-panel {
  display: none;
}
.tab-panel.active {
  display: block;
  animation: panel-fade 0.2s ease-out;
}
@keyframes panel-fade {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ── Filter bar ──────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  padding: 0.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  width: fit-content;
  max-width: 100%;
}
.filter-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
  padding: 0.3rem 0.85rem;
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease;
}
.filter-btn:hover {
  background: var(--hover-bg);
  color: var(--text);
}
.filter-btn.active {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  color: var(--accent);
}

/* ── Phase sections ──────────────────────────────────────────────── */
.phase-section {
  margin-bottom: 1.75rem;
}
.phase-header {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
  margin-bottom: 0.65rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.phase-badge {
  font-size: 0.65rem;
  padding: 0.1rem 0.5rem;
  border-radius: var(--radius-pill);
  font-weight: 700;
  letter-spacing: 0.04em;
}
.phase-1 .phase-badge {
  background: var(--badge-1-bg);
  color: var(--accent);
}
.phase-2 .phase-badge {
  background: var(--badge-2-bg);
  color: var(--orange);
}
.phase-3 .phase-badge {
  background: var(--badge-3-bg);
  color: var(--purple);
}

/* ── Issue cards ─────────────────────────────────────────────────── */
.issue-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  /* Kein overflow:hidden — würde position:sticky im .issue-header killen */
  margin-bottom: 0.5rem;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}
.issue-card:hover {
  border-color: var(--border-strong);
}
.issue-card.open {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.issue-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  z-index: 11;
}
.issue-card.priority-1::before {
  background: var(--red);
}
.issue-card.priority-2::before {
  background: var(--orange);
}
.issue-card.priority-3::before {
  background: var(--accent);
}
.issue-card.priority-4::before {
  background: var(--purple);
}
.issue-card.priority-5::before {
  background: var(--green);
}

.issue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 1rem 0.7rem 1.15rem;
  cursor: pointer;
  user-select: none;
  gap: 0.75rem;
  /* Angepinnt unterhalb der Topbar, solange man durch den offenen Body scrollt */
  position: sticky;
  top: var(--topbar-h, 60px);
  z-index: 10;
  background: var(--surface);
  /* Radius ersetzt den des Cards (overflow:hidden musste weg) */
  border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0;
  transition: background 0.15s ease;
}
.issue-header:hover {
  background: var(--surface-raised);
}
.issue-card.open .issue-header {
  background: var(--surface-raised);
  border-bottom: 1px solid var(--border);
}
/* Wirklich nur beim Ankleben: eckig + Schatten gegen das Darunter-Scrollende */
.issue-header.pinned {
  border-radius: 0;
  box-shadow: 0 6px 12px -8px rgba(0, 0, 0, 0.4);
}
.issue-card.open .issue-header:hover {
  background: var(--surface-raised);
}
.issue-header .issue-chevron {
  color: var(--text-muted);
  font-size: 0.7rem;
  transition: color 0.15s ease;
}
.issue-card.open .issue-header .issue-chevron {
  color: var(--accent);
}
.issue-title {
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--mono);
  letter-spacing: -0.01em;
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.issue-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.issue-body {
  display: none;
  padding: 0 1rem 1rem 1.15rem;
  background: var(--bg-elevated);
}
.issue-body.open {
  display: block;
}
.issue-card.open .issue-body {
  border-radius: 0 0 calc(var(--radius) - 1px) calc(var(--radius) - 1px);
}
.issue-desc {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin: 0.85rem 0;
}

/* ── Tables ──────────────────────────────────────────────────────── */
.entity-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.79rem;
}
.entity-table th {
  text-align: left;
  padding: 0.45rem 0.6rem;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.entity-table td {
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.entity-table tr:nth-child(even) {
  background: var(--row-stripe);
}
.entity-table tr {
  transition: background 0.12s ease;
}
.entity-table tr:hover {
  background: var(--hover-bg);
}
.entity-table tr:last-child td {
  border-bottom: none;
}
.entity-table .col-key {
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  white-space: nowrap;
  width: 1%;
}
.entity-table .col-val {
  overflow-wrap: anywhere;
  color: var(--text);
}
.entity-table .val-null {
  color: var(--text-muted);
  font-style: italic;
}
.entity-table .val-yes {
  color: var(--green);
  font-weight: 600;
}
.entity-table .val-no {
  color: var(--red);
  font-weight: 600;
}
/* tanss_device_updated: hervorgehobene „Geänderte Werte"-Spalte */
.entity-table .changed-cell {
  background: var(--green-soft);
}
.table-container {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 0.15rem 0.35rem;
}
.lazy-entity-table {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.lazy-entity-table > span {
  display: inline-block;
  padding: 0.75rem 0.5rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.data-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
}
.data-table td {
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
.data-table tr:hover td {
  background: var(--hover-bg);
}
.data-table .mono {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--accent);
}
.data-table .status-yes {
  color: var(--green);
}
.data-table .status-no {
  color: var(--red);
}
.data-table .status-null {
  color: var(--text-muted);
  font-style: italic;
}

/* ── KI-Vorschläge ───────────────────────────────────────────────── */
.llm-suggestions {
  margin-top: 0.75rem;
  padding: 0.8rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.llm-suggestions-title {
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  color: var(--text);
}
.llm-suggestion-card {
  padding: 0.7rem 0.8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease;
}
.llm-suggestion-card:hover {
  border-color: var(--border-strong);
}

/* ── Geänderte Werte ─────────────────────────────────────────────── */
.changed-values {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.6rem 0.7rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.changed-title {
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--green);
  margin-bottom: 0.15rem;
}
.changed-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.78rem;
  flex-wrap: wrap;
}
.changed-field {
  color: var(--text-muted);
  min-width: 9rem;
  font-weight: 600;
}
.changed-val {
  font-family: var(--mono);
}
.changed-val.old {
  color: var(--red);
  text-decoration: line-through;
}
.changed-arrow {
  color: var(--text-muted);
}
.changed-val.new {
  color: var(--green);
  font-weight: 600;
}

/* ── Empty / Loading states ──────────────────────────────────────── */
.empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-size: 0.86rem;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.empty-icon {
  font-size: 1.6rem;
  margin-bottom: 0.4rem;
  opacity: 0.8;
}

/* ── Mappings tab ────────────────────────────────────────────────── */
.map-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}
.map-section-header {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  padding-bottom: 0.75rem;
  margin-bottom: 0.9rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.map-section-title {
  font-size: 0.95rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text);
}
.map-section-desc {
  font-size: 0.74rem;
  color: var(--text-muted);
}
.map-ext-link {
  margin-left: auto;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}
.map-ext-link:hover {
  text-decoration: underline;
}
.map-pending {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.map-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(320px, 1.2fr);
  gap: 1rem;
  align-items: center;
  padding: 0.55rem 0.8rem;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
}
.map-row:hover {
  border-color: var(--border-strong);
}
@media (max-width: 720px) {
  .map-row {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
}
.map-row-name {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}
.map-name {
  font-weight: 600;
  font-size: 0.83rem;
  color: var(--text);
  font-family: var(--mono);
  word-break: break-word;
}
.map-pending-count {
  font-size: 0.7rem;
  color: var(--text-muted);
}
.map-row-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  justify-content: flex-end;
}
.map-name-input {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.38rem 0.6rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.78rem;
  flex: 1;
  min-width: 160px;
  max-width: 260px;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}
.map-name-input::placeholder {
  color: var(--text-muted);
}
.map-name-input:hover {
  border-color: var(--border-strong);
}
.map-name-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}
.map-os-dropdown {
  position: absolute;
  z-index: 1000;
  max-height: 280px;
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 0.25rem;
}
.map-os-dropdown-item {
  padding: 0.35rem 0.55rem;
  font-size: 0.78rem;
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}
.map-os-dropdown-item:hover,
.map-os-dropdown-item.active {
  background: var(--accent);
  color: #fff;
}
.map-os-dropdown-empty {
  padding: 0.45rem 0.55rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
}
.map-saved {
  margin-top: 1.25rem;
}
.map-saved-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.map-saved-table .map-arrow {
  color: var(--text-muted);
  width: 2rem;
  text-align: center;
}
.map-saved-id {
  font-size: 0.68rem;
  font-family: var(--mono);
  color: var(--text-muted);
  margin-left: 0.25rem;
}
.map-actions {
  text-align: right;
  white-space: nowrap;
}
.map-actions .btn {
  margin-left: 0.25rem;
}
.map-note {
  margin-top: 0.9rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}
.mapping-tab-link {
  background: none;
  border: none;
  padding: 0;
  margin-bottom: 0.75rem;
  color: var(--accent);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}
.mapping-tab-link:hover {
  text-decoration: underline;
}

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
  background: var(--accent);
  color: #fff;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.36rem 0.75rem;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition:
    filter 0.15s ease,
    background 0.15s ease,
    color 0.15s ease;
}
.btn:hover {
  filter: brightness(1.12);
}
.btn:active {
  filter: brightness(0.92);
}
.btn-warn {
  background: var(--yellow);
  color: var(--on-accent);
}
.btn-danger {
  background: transparent;
  color: var(--red);
  border-color: color-mix(in srgb, var(--red) 50%, transparent);
}
.btn-danger:hover {
  background: var(--red);
  color: #fff;
  filter: none;
}
.btn-small {
  padding: 0.26rem 0.6rem;
  font-size: 0.72rem;
}

.hide-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  margin-left: 0.35rem;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.hide-btn:hover {
  border-color: var(--orange);
  color: var(--orange);
}
.hide-btn.hidden {
  border-color: var(--red);
  color: var(--red);
}
.unhide-btn {
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--red) 50%, transparent);
  color: var(--red);
  padding: 0.22rem 0.7rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.unhide-btn:hover {
  background: var(--red);
  color: #fff;
}
.apply-suggestion-btn {
  font-family: inherit;
  font-weight: 600;
}
.create-tanss-btn {
  font-family: inherit;
  font-weight: 600;
}
.create-tanss-result {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  line-height: 1.35;
  word-break: break-word;
}
.pagination {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  justify-content: center;
}
.pagination button {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
}
.pagination button:hover {
  border-color: var(--border-strong);
}
.pagination button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.pagination span {
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* ── Tags & links ────────────────────────────────────────────────── */
.tag {
  display: inline-block;
  font-size: 0.65rem;
  padding: 0.12rem 0.5rem;
  border-radius: var(--radius-pill);
  font-weight: 700;
  letter-spacing: 0.02em;
  vertical-align: middle;
}
.tag-ninja {
  background: var(--tag-ninja-bg);
  color: var(--accent);
}
.tag-tanss {
  background: var(--tag-tanss-bg);
  color: var(--purple);
}
.tag-both {
  background: var(--tag-both-bg);
  color: var(--green);
}
.tag-none {
  background: var(--tag-none-bg);
  color: var(--red);
}
.tag-online {
  background: var(--tag-both-bg);
  color: var(--green);
}
.tag-offline {
  background: var(--tag-none-bg);
  color: var(--red);
}
a.tag.device-link,
a.device-link {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
a.tag.device-link:hover {
  filter: brightness(1.25);
  text-decoration: underline;
}
a.device-link:hover .tag {
  filter: brightness(1.25);
}

/* ── Hidden devices tab ──────────────────────────────────────────── */
.hidden-devices-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.hidden-devices-table th {
  text-align: left;
  padding: 0.6rem 0.9rem;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border-bottom: 1px solid var(--border);
  background: var(--surface-raised);
}
.hidden-devices-table td {
  padding: 0.55rem 0.9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.hidden-devices-table tr:last-child td {
  border-bottom: none;
}
.hidden-devices-table tr:hover td {
  background: var(--hover-bg);
}
.hidden-devices-table .mono {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--accent);
}
.hidden-devices-table .created {
  color: var(--text-muted);
  font-size: 0.75rem;
  white-space: nowrap;
}
.hidden-devices-section {
  margin-bottom: 2rem;
}
.hidden-devices-section h3 {
  font-size: 1rem;
  font-weight: 650;
  margin-bottom: 0.75rem;
}
.hidden-device-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 1rem;
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
}
.hidden-device-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.hidden-device-id {
  font-family: var(--mono);
  color: var(--text-dim);
  font-size: 0.75rem;
}

/* ── Misc legacy blocks (kept for compatibility) ─────────────────── */
.search-bar {
  margin-bottom: 1rem;
}
.search-bar input {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-sm);
  width: 100%;
  max-width: 400px;
  font-size: 0.85rem;
}
.search-bar input::placeholder {
  color: var(--text-muted);
}
.entity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0.75rem;
}
.entity-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem;
}
.entity-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.entity-card-title {
  font-size: 0.875rem;
  font-weight: 650;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.entity-card-id {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--mono);
}
.entity-card-field {
  font-size: 0.75rem;
  color: var(--text-dim);
  padding: 0.15rem 0;
  display: flex;
  gap: 0.5rem;
}
.entity-card-field .label {
  color: var(--text-muted);
  min-width: 80px;
}
.entity-card-field .value {
  color: var(--text);
  word-break: break-all;
}
.entity-card-field .value.matched {
  color: var(--green);
}
.entity-card-field .value.unmatched {
  color: var(--red);
}
.entity-card-field .value.partial {
  color: var(--orange);
}
.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}
.table-header h3 {
  font-size: 1rem;
  font-weight: 650;
}
.table-header .count {
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* ── Scrollbars ──────────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

.btn-link {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

/* ── Keycloak Auth Buttons + Toast ───────────────────────────────── */
.user-display {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-left: 8px;
}
.btn-login, .btn-logout {
  margin-left: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 0.85rem;
}
.btn-login:hover, .btn-logout:hover {
  background: var(--hover-bg);
}
.auth-toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--red);
  color: #fff;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-md);
}
.auth-toast .btn-retry {
  padding: 4px 10px;
  border-radius: 4px;
  border: none;
  background: #fff;
  color: #b34747;
  cursor: pointer;
  font-weight: 600;
}

/* ── Device toolbars (Inaktive-Geräte + TANSS-Verknüpfung) ─────── */
.device-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.device-toolbar label {
  color: var(--text-muted);
  font-size: 0.8rem;
}
.device-toolbar input[type="number"],
.device-toolbar input[type="search"] {
  width: 6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.35rem 0.5rem;
  font-size: 0.85rem;
}
.device-toolbar input[type="search"] {
  width: 11rem;
}
.device-toolbar .chk {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}
.device-toolbar .chk input {
  accent-color: var(--accent);
}
.device-toolbar button {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.35rem 0.8rem;
  font-size: 0.8rem;
  cursor: pointer;
}
.device-toolbar button:hover:not(:disabled) {
  filter: brightness(1.15);
}
.device-toolbar button:disabled {
  opacity: 0.5;
  cursor: wait;
}
.device-source {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 0.75rem;
}
.device-summary {
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* ── TANSS-Gerät anlegen: Zeilen-Button + Modal ────────────────── */
.tanss-create-btn {
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  padding: 0.25rem 0.6rem;
  cursor: pointer;
  margin-left: 0.6rem;
}
.tanss-create-btn:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--accent);
  background: var(--accent-soft);
}
.tanss-create-btn:disabled {
  opacity: 0.5;
  cursor: wait;
}

/* Inaktiv-Button (⛔) für verknüpfte Geräte in der Inaktive-Geräte-Tabelle:
   markiert das TANSS-Gerät in TANSS als inaktiv; das Ninja-Gerät muss danach
   manuell in der NinjaOne-Web-Oberfläche gelöscht werden (API: HTTP 405). */
.tanss-deactivate-btn {
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  padding: 0.25rem 0.6rem;
  cursor: pointer;
  margin-left: 0.6rem;
}
.tanss-deactivate-btn:hover:not(:disabled) {
  color: var(--red);
  border-color: var(--red);
  background: color-mix(in srgb, var(--red) 8%, transparent);
}
.tanss-deactivate-btn:disabled {
  opacity: 0.5;
  cursor: wait;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 14, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 1rem;
}
/* display:flex ueberschreibt das UA-default [hidden]{display:none} —
   ohne diese Regel waeren beide TANSS-Dialoge permanent sichtbar und
   "Abbrechen" (hidden=true) haette keinen visuellen Effekt. */
.modal-overlay[hidden] {
  display: none;
}
.modal {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  width: min(500px, 100%);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 1.25rem 1.5rem;
}
.modal h3 {
  margin: 0;
  font-size: 1.05rem;
}
.modal-info {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.85rem;
  line-height: 1.45;
}
.modal-label {
  color: var(--text-muted);
  font-size: 0.78rem;
}
.modal-select {
  width: 100%;
  font-family: inherit;
  font-size: 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.45rem 0.55rem;
}
.modal-select:disabled {
  opacity: 0.5;
  cursor: wait;
}
.modal-error {
  margin: 0;
  color: var(--red);
  font-size: 0.8rem;
  line-height: 1.45;
  white-space: pre-wrap;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 0.2rem;
}
.modal-btn {
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.45rem 0.95rem;
  cursor: pointer;
}
.modal-btn:hover:not(:disabled) {
  filter: brightness(1.15);
}
.modal-btn:disabled {
  opacity: 0.5;
  cursor: wait;
}
.modal-btn-primary {
  background: var(--accent);
  border-color: transparent;
  color: var(--on-accent);
}
.modal-btn-danger {
  background: var(--red);
  border-color: transparent;
  color: #fff;
}

/* Erfolgs-/Fehler-Toast (generisch) */
.app-toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  max-width: 440px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--green);
  color: #06130c;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  z-index: 9999;
}
.app-toast-error {
  background: var(--red);
  color: #fff;
}

