/* ============================================================================
   barox Switch Test Companion – Anwendungs-CSS
   Baut auf barox-design-system.css auf (nur Tokens verwenden, keine Hex-Werte).
   ========================================================================== */

:root {
  --sidebar-w: 248px;
  --header-h: 60px;
}

body { background: var(--bg); }

/* ------------------------------- App-Shell -------------------------------- */
.app { min-height: 100vh; }
.app-header {
  position: sticky; top: 0; z-index: 60;
  height: var(--header-h);
  background: var(--navy);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; gap: 16px;
  box-shadow: 0 1px 6px rgba(0, 45, 78, 0.22);
}
.app-header .brand { display: flex; align-items: center; gap: 12px; }
.app-header .brand img { height: 26px; width: auto; display: block; }
.app-header .brand .sub {
  color: var(--amber); font-family: var(--font-display); font-weight: 700;
  font-size: 0.95rem; letter-spacing: 0.02em; white-space: nowrap;
}
.app-header .brand .sub small { color: var(--navy-20); font-weight: 400; font-family: var(--font-text); }
.app-header .user { display: flex; align-items: center; gap: 14px; color: var(--navy-20); font-size: 0.9rem; }
.app-header .user strong { color: var(--white); font-weight: 500; }
.role-badge {
  display: inline-block; padding: 2px 9px; border-radius: 20px;
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  background: var(--amber); color: var(--navy);
}
.role-badge.viewer { background: var(--navy-40); color: var(--white); }
.role-badge.tester { background: var(--navy-20); color: var(--navy); }
.linkbtn { background: none; border: 0; color: var(--navy-20); cursor: pointer; font: inherit; padding: 0; }
.linkbtn:hover { color: var(--amber); }

.app-body { display: flex; align-items: stretch; }
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: var(--white); border-right: 1px solid var(--line);
  min-height: calc(100vh - var(--header-h));
  padding: 18px 12px; position: sticky; top: var(--header-h); align-self: flex-start;
}
.sidebar .nav-group { margin-bottom: 20px; }
.sidebar .nav-group h4 {
  font-family: var(--font-text); font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--grey); margin: 0 0 8px 10px; font-weight: 700;
}
.sidebar a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius); text-decoration: none;
  color: var(--ink); font-size: 0.92rem; font-weight: 500; margin-bottom: 2px;
}
.sidebar a:hover { background: var(--navy-10); color: var(--navy); }
.sidebar a.active { background: var(--navy); color: var(--white); }
.sidebar a.active .ico { color: var(--amber); }
.sidebar a .ico { width: 18px; height: 18px; flex: 0 0 18px; color: var(--navy-60); }
.sidebar a.active .ico { color: var(--amber); }

.main { flex: 1 1 auto; min-width: 0; padding: 26px 30px 60px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .eyebrow { color: var(--amber-dark); font-weight: 700; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.page-head h1 { margin: 0; }
.page-head .muted { color: var(--grey); font-size: 0.95rem; margin-top: 4px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* -------------------------------- Utilities ------------------------------- */
.muted { color: var(--grey); }
.small { font-size: 0.85rem; }
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > * { flex: 1 1 220px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.hidden { display: none; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

/* --------------------------------- Panels --------------------------------- */
.panel {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 22px 24px; margin-bottom: 20px;
}
.panel > h2, .panel > h3 { margin-top: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-head h2, .panel-head h3 { margin: 0; }
.panel.accent { border-top: 3px solid var(--amber); }

/* --------------------------------- Stat-Tiles ----------------------------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 16px 18px; box-shadow: var(--shadow); border-left: 3px solid var(--navy-40);
}
.stat .k { font-size: 0.78rem; color: var(--grey); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.stat .v { font-family: var(--font-display); font-size: 1.9rem; font-weight: 800; color: var(--navy); line-height: 1.1; margin-top: 4px; }
.stat.pass { border-left-color: var(--success); }
.stat.fail { border-left-color: var(--error); }
.stat.warn { border-left-color: var(--warning); }
.stat.amber { border-left-color: var(--amber); }

/* --------------------------------- Tabellen ------------------------------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.data th, table.data td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data thead th {
  background: var(--navy-10); color: var(--navy); font-weight: 700;
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap;
}
table.data tbody tr:hover { background: var(--navy-10); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ----------------------------- Status-Badges ------------------------------ */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 0.76rem; font-weight: 700; white-space: nowrap; border: 1px solid transparent;
}
.badge.is-pass    { background: #e8f3e9; color: #1d4a20; border-color: #bcdcc0; }
.badge.is-partial { background: #fff4d9; color: #7a5b00; border-color: #f0d79a; }
.badge.is-fail    { background: #fdecea; color: #7a1710; border-color: #f2c2bd; }
.badge.is-blocked { background: #eae6f2; color: #3f2f66; border-color: #cfc4e4; }
.badge.is-progress{ background: var(--navy-10); color: var(--navy); border-color: var(--navy-20); }
.badge.is-na      { background: #eef1f3; color: var(--grey); border-color: var(--line); }
.badge.is-idle    { background: #eef1f3; color: var(--grey); border-color: var(--line); }

.prio { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 0.74rem; font-weight: 700; }
.prio-Kritisch { background: #fdecea; color: #7a1710; }
.prio-Hoch     { background: #fff4d9; color: #7a5b00; }
.prio-Mittel   { background: var(--navy-10); color: var(--navy); }
.prio-Niedrig  { background: #eef1f3; color: var(--grey); }

/* ---------------------------- Empfehlung / Ampel -------------------------- */
.rec-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 16px; border-radius: 24px; font-weight: 800; font-size: 0.9rem; }
.rec-pill::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.rec-approve { background: #e8f3e9; color: #1d4a20; }
.rec-rework  { background: #fff4d9; color: #7a5b00; }
.rec-reject  { background: #fdecea; color: #7a1710; }
.rec-open    { background: var(--navy-10); color: var(--navy); }

.light { width: 14px; height: 14px; border-radius: 50%; display: inline-block; box-shadow: 0 0 0 3px rgba(0,0,0,0.04); }
.light.green { background: var(--success); }
.light.amber { background: var(--amber); }
.light.red   { background: var(--error); }
.light.grey  { background: var(--navy-40); }

/* ------------------------------ Fortschritt ------------------------------- */
.progress { background: var(--navy-10); border-radius: 20px; height: 10px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--amber); border-radius: 20px; transition: width .3s; }
.progress.big { height: 16px; }
.progress-label { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--grey); margin-bottom: 4px; }

/* --------------------------------- Formulare ------------------------------ */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.field { margin-bottom: 4px; }
.field small { color: var(--grey); font-size: 0.8rem; }
.inline-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.checkbox { display: flex; align-items: center; gap: 8px; }
.checkbox input { width: auto; }
.btn-sm { padding: 6px 14px; font-size: 0.85rem; }
.btn-danger { background: var(--error); color: var(--white); border-color: var(--error); }
.btn-danger:hover { background: #8f1e17; color: var(--white); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--navy); }
.btn-ghost:hover { background: var(--navy-10); }
select, input, textarea { font-family: var(--font-text); }
textarea { resize: vertical; min-height: 70px; }
.errors { list-style: none; padding: 0; margin: 0; }

/* --------------------------------- Alerts --------------------------------- */
.flash-area { margin-bottom: 18px; }
.alert { margin-bottom: 10px; }

/* --------------------------------- Wizard --------------------------------- */
.wizard-steps { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 22px; counter-reset: step; }
.wizard-steps a, .wizard-steps span {
  display: flex; align-items: center; gap: 8px; text-decoration: none;
  padding: 8px 14px; border-radius: var(--radius); font-size: 0.85rem; font-weight: 600;
  color: var(--grey); background: var(--white); border: 1px solid var(--line);
}
.wizard-steps a:hover { border-color: var(--navy-40); color: var(--navy); }
.wizard-steps .done { color: var(--navy); border-color: var(--navy-20); }
.wizard-steps .done::before { content: "✓"; color: var(--success); font-weight: 800; }
.wizard-steps .current { background: var(--navy); color: var(--white); border-color: var(--navy); }
.wizard-steps .current::before { counter-increment: step; content: counter(step); }
.wizard-nav { display: flex; justify-content: space-between; margin-top: 24px; gap: 12px; }

/* Kategorie-Chips im Testschritt */
.cat-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.cat-chips a {
  text-decoration: none; padding: 6px 12px; border-radius: 20px; font-size: 0.82rem; font-weight: 600;
  background: var(--white); border: 1px solid var(--line); color: var(--navy);
}
.cat-chips a.active { background: var(--amber); border-color: var(--amber); color: var(--navy); }
.cat-chips a:hover { border-color: var(--navy-40); }

/* Testfall-Karte */
.tc { border: 1px solid var(--line); border-radius: var(--radius-lg); margin-bottom: 14px; overflow: hidden; background: var(--white); }
.tc.is-pass    { border-left: 4px solid var(--success); }
.tc.is-fail    { border-left: 4px solid var(--error); }
.tc.is-partial { border-left: 4px solid var(--warning); }
.tc.is-blocked { border-left: 4px solid #6a4fb0; }
.tc.is-idle, .tc.is-progress, .tc.is-na { border-left: 4px solid var(--navy-40); }
.tc-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; cursor: pointer; }
.tc-head:hover { background: var(--navy-10); }
.tc-head .t { font-weight: 600; color: var(--navy); }
.tc-head .meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tc-body { padding: 4px 16px 18px; border-top: 1px solid var(--line); }

/* Anhänge */
.attach-list { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 10px; }
.attach-list li { display: flex; align-items: center; gap: 8px; background: var(--navy-10); border-radius: var(--radius); padding: 6px 10px; font-size: 0.82rem; }
.attach-list a { text-decoration: none; color: var(--navy); font-weight: 600; }
.ext-tag { font-size: 0.66rem; text-transform: uppercase; background: var(--navy); color: var(--white); border-radius: 3px; padding: 1px 5px; font-weight: 700; }

/* Detailseite: Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 20px; flex-wrap: wrap; }
.tabs a { text-decoration: none; padding: 10px 16px; font-weight: 600; color: var(--grey); border-bottom: 2px solid transparent; margin-bottom: -2px; }
.tabs a:hover { color: var(--navy); }
.tabs a.active { color: var(--navy); border-bottom-color: var(--amber); }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: linear-gradient(135deg, var(--navy) 0%, #013d69 100%); }
.login-card { background: var(--white); border-radius: var(--radius-xl); box-shadow: 0 20px 50px rgba(0,45,78,.35);
  width: 100%; max-width: 400px; padding: 34px 32px; border-top: 4px solid var(--amber); }
.login-card .logo { text-align: center; margin-bottom: 8px; }
.login-card .logo img { height: 34px; }
.login-card h1 { text-align: center; font-size: 1.3rem; margin-bottom: 4px; }
.login-card .sub { text-align: center; color: var(--grey); font-size: 0.9rem; margin-bottom: 22px; }
.login-divider { text-align: center; color: var(--grey); font-size: 0.8rem; margin: 18px 0; position: relative; }
.login-divider::before, .login-divider::after { content: ""; position: absolute; top: 50%; width: 40%; height: 1px; background: var(--line); }
.login-divider::before { left: 0; } .login-divider::after { right: 0; }
.btn-ms { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  background: var(--white); border: 1px solid var(--navy-40); color: var(--navy); font-weight: 600;
  padding: 11px; border-radius: var(--radius); text-decoration: none; }
.btn-ms:hover { background: var(--navy-10); }

/* Responsive */
@media (max-width: 900px) {
  .app-body { flex-direction: column; }
  .sidebar { width: 100%; position: static; min-height: 0; border-right: 0; border-bottom: 1px solid var(--line);
    display: flex; gap: 6px; overflow-x: auto; padding: 10px; }
  .sidebar .nav-group { margin: 0; display: flex; gap: 6px; }
  .sidebar .nav-group h4 { display: none; }
  .main { padding: 18px 16px 50px; }
}
