/* ==========================================================================
   Vivyt Vault - Oberflaeche
   Farbwelt von vivyt.ch: Markenblau #0055FF und Tuerkis-Akzent #4CCABB.
   ========================================================================== */

:root {
  /* Markenfarben */
  --mv-blue: #0047cc;
  --mv-blue-700: #0038a3;
  --mv-blue-900: #001f5c;
  --mv-blue-500: #0055ff;
  --mv-blue-300: #6699ff;
  --mv-blue-050: #eaf1ff;
  --mv-teal: #0d9488;
  --mv-teal-600: #0f766e;
  --mv-teal-300: #4ccabb;

  /* Statusfarben */
  --ok: #10814a;
  --ok-bg: #e6f5ec;
  --warn: #b26a00;
  --warn-bg: #fdf1de;
  --danger: #ef4444;
  --danger-600: #dc2626;
  --danger-bg: #fef2f2;

  /* Flaechen (helles Design) */
  --bg: #f2f5f9;
  --bg-alt: #e7edf5;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #d8e0ea;
  --border-strong: #bcc9d8;
  --text: #10233d;
  --text-muted: #5b6b83;
  --text-invert: #ffffff;
  --shadow-sm: 0 1px 2px rgba(16, 35, 61, 0.08);
  --shadow: 0 6px 20px rgba(16, 35, 61, 0.12);
  --shadow-lg: 0 24px 60px rgba(16, 35, 61, 0.22);

  --radius: 10px;
  --radius-sm: 7px;
  --radius-lg: 16px;
  --topbar-h: 60px;
  --sidebar-w: 268px;
  --list-w: 380px;
  --font: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Roboto, Arial, sans-serif;
  --mono: 'Cascadia Mono', ui-monospace, 'SF Mono', Consolas, 'Liberation Mono', monospace;
}

[data-theme='dark'] {
  --mv-blue-050: #0c2447;
  --mv-blue-300: #7fb0ff;
  --mv-teal-300: #5eead4;
  --ok-bg: #10281d;
  --warn-bg: #2e2312;
  --danger-bg: #3a1414;
  --bg: #031622;
  --bg-alt: #04202f;
  --surface: #06263a;
  --surface-2: #0a2e44;
  --border: #163f57;
  --border-strong: #245271;
  --text: #eaf2fa;
  --text-muted: #8fa8bc;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

svg { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }

a, .link {
  color: var(--mv-blue-500);
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}
.link:hover { text-decoration: underline; }
[data-theme='dark'] a, [data-theme='dark'] .link { color: var(--mv-blue-300); }

::selection { background: var(--mv-blue-300); color: #fff; }

:focus-visible { outline: 2px solid var(--mv-blue-500); outline-offset: 2px; }

/* ------------------------------------------------------------------- Start */

.boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 24px;
  justify-items: center;
  background: var(--bg);
  z-index: 100;
}
.boot__logo { width: 220px; height: auto; }
.boot__bar { width: 220px; height: 4px; border-radius: 4px; background: var(--border); overflow: hidden; }
.boot__bar span { display: block; height: 100%; width: 40%; border-radius: 4px; background: var(--mv-teal); animation: boot 1.1s ease-in-out infinite; }
@keyframes boot { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }

/* --------------------------------------------------------------- Anmeldung */

.auth {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  background:
    radial-gradient(1100px 520px at 12% -10%, rgba(0, 85, 255, 0.14), transparent 60%),
    radial-gradient(760px 420px at 100% 110%, rgba(13, 148, 136, 0.12), transparent 60%),
    var(--bg);
}
.auth__panel {
  width: 100%;
  max-width: 430px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 34px 32px 26px;
}
.auth__logo { display: block; width: 210px; height: auto; margin: 0 auto 6px; }
.auth__claim { margin: 0 0 22px; text-align: center; color: var(--text-muted); font-size: 13px; }
.auth__title { font-size: 19px; margin-bottom: 16px; }
.auth__hint { margin: -8px 0 16px; font-size: 13px; color: var(--text-muted); }
.auth__form { display: block; }
.auth__error {
  margin: 4px 0 12px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--danger-bg);
  color: var(--danger-600);
  border: 1px solid rgba(239, 68, 68, 0.3);
  font-size: 13px;
}
[data-theme='dark'] .auth__error { color: #fca5a5; }
.auth__links { display: flex; justify-content: space-between; gap: 12px; margin-top: 14px; font-size: 13px; }
.auth__foot { margin: 22px 0 0; text-align: center; font-size: 11.5px; color: var(--text-muted); }
.auth__sep { margin: 0 6px; }

/* ------------------------------------------------------------ Formularteile */

.field { display: block; margin-bottom: 14px; }
.field__label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-muted); margin-bottom: 5px; }
.field__input,
.select,
textarea.field__input {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field__input:focus, .select:focus, textarea.field__input:focus {
  outline: none;
  border-color: var(--mv-blue-500);
  box-shadow: 0 0 0 3px rgba(0, 85, 255, 0.16);
}
.field__input--code { font-family: var(--mono); letter-spacing: 0.06em; resize: vertical; }
.field__input[readonly] { background: var(--bg-alt); }
.field--inline { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.field--inline .field__label { margin: 0; }
.field__row { display: flex; gap: 8px; align-items: stretch; }
.field__row .field__input { flex: 1; }
.field__help { display: block; margin-top: 5px; font-size: 12px; color: var(--text-muted); }
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 13.5px; margin-bottom: 9px; cursor: pointer; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--mv-blue); }
.select { padding-right: 26px; }
.select--sm { padding: 6px 8px; font-size: 13px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------ Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.14s, border-color 0.14s, transform 0.05s;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-alt); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn svg { width: 1.05em; height: 1.05em; }
.btn--primary { background: var(--mv-blue); border-color: var(--mv-blue); color: #fff; }
.btn--primary:hover { background: var(--mv-blue-700); border-color: var(--mv-blue-700); }
.btn--danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn--danger:hover { background: var(--danger-600); border-color: var(--danger-600); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn--ghost:hover { background: var(--bg-alt); color: var(--text); }
.btn--block { width: 100%; }
.btn--sm { padding: 6px 11px; font-size: 13px; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.14); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn--sm { width: 26px; height: 26px; }
.icon-btn--sm svg { width: 15px; height: 15px; }
.sidebar .icon-btn:hover, .detail .icon-btn:hover, .list .icon-btn:hover, .modal .icon-btn:hover { background: var(--bg-alt); }

/* ------------------------------------------------------------------- Topbar */

.app { display: flex; flex-direction: column; height: 100vh; }

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--topbar-h);
  flex: 0 0 var(--topbar-h);
  padding: 0 14px;
  color: #fff;
  background: linear-gradient(96deg, var(--mv-blue-900), var(--mv-blue) 58%, var(--mv-blue-500));
  border-bottom: 3px solid var(--mv-teal);
}
.topbar__burger { display: none; }
.topbar__mark { border-radius: 7px; }
.topbar__name { font-weight: 400; letter-spacing: 0.09em; font-size: 15px; }
.topbar__name b { font-weight: 700; }
.topbar__search { position: relative; flex: 1; max-width: 560px; margin: 0 auto; }
.topbar__search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; opacity: 0.75; }
.topbar__search input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  font: inherit;
  font-size: 13.5px;
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 20px;
}
.topbar__search input::placeholder { color: rgba(255, 255, 255, 0.7); }
.topbar__search input:focus { outline: none; background: rgba(255, 255, 255, 0.22); border-color: rgba(255, 255, 255, 0.5); }
.topbar__actions { display: flex; align-items: center; gap: 4px; }
.topbar__user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 4px;
  color: #fff;
  background: transparent;
  border: 0;
  border-radius: 20px;
  cursor: pointer;
  font: inherit;
}
.topbar__user:hover { background: rgba(255, 255, 255, 0.14); }
.topbar__user svg { width: 15px; height: 15px; }
.topbar__username { font-size: 13.5px; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--mv-teal);
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
}

/* ------------------------------------------------------------------- Layout */

.layout { display: flex; flex: 1; min-height: 0; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  display: flex;
  flex-direction: column;
  padding: 12px 10px 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}
.nav, .tree { list-style: none; margin: 0; padding: 0; }
.nav-item, .tree__row {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 10px;
  font: inherit;
  font-size: 13.8px;
  color: var(--text);
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.nav-item:hover, .tree__row:hover { background: var(--bg-alt); }
.nav-item.is-active, .tree__row.is-active {
  background: var(--mv-blue-050);
  color: var(--mv-blue);
  font-weight: 650;
}
[data-theme='dark'] .nav-item.is-active, [data-theme='dark'] .tree__row.is-active { color: #fff; }
.nav-item svg, .tree__row svg { width: 17px; height: 17px; flex: 0 0 17px; color: var(--text-muted); }
.nav-item.is-active svg, .tree__row.is-active svg { color: var(--mv-teal); }
.nav-item__label, .tree__label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge-count {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-alt);
  border-radius: 10px;
  padding: 1px 7px;
}
.nav-item.is-active .badge-count { background: rgba(255, 255, 255, 0.6); color: var(--mv-blue); }
.badge-count--danger { background: var(--danger-bg); color: var(--danger-600); }
[data-theme='dark'] .badge-count--danger { color: #fca5a5; }

.sidebar__section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 16px 4px 4px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.sidebar__title { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.sidebar__foot { margin-top: auto; padding: 12px 6px; font-size: 11px; color: var(--text-muted); }

.tree__row { position: relative; }
.tree__toggle {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  margin-left: -4px;
  background: none;
  border: 0;
  padding: 0;
  color: var(--text-muted);
  cursor: pointer;
}
.tree__toggle svg { width: 13px; height: 13px; transition: transform 0.15s; }
.tree__toggle.is-open svg { transform: rotate(90deg); }
.tree__spacer { width: 12px; flex: 0 0 12px; }
.tree__more { opacity: 0; }
.tree__row:hover .tree__more, .tree__row.is-active .tree__more { opacity: 1; }
.tree ul { list-style: none; margin: 0; padding-left: 14px; }
.chip-shared {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--mv-blue);
  background: var(--mv-blue-050);
  border: 1px solid var(--mv-blue-300);
  border-radius: 4px;
  padding: 0 4px;
}

/* -------------------------------------------------------------- Eintragsliste */

.list {
  width: var(--list-w);
  flex: 0 0 var(--list-w);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  min-width: 0;
}
.list__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.list__title { font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list__tools { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; }
.list__body { flex: 1; overflow-y: auto; padding: 6px; }

/* ---------------------------------------------------- Mehrfachauswahl */

.bulkbar {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 6px 10px;
  background: var(--mv-blue-050);
  border-bottom: 1px solid var(--border);
}
[data-theme='dark'] .bulkbar { background: var(--surface-2); }
/* Feste Zeilen statt Umbruch: die Listenspalte ist schmal, umbrechende
   Buttons wuerden die Leiste unvorhersehbar hoch werden lassen. */
.bulkbar__row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bulkbar__row--actions > .btn { flex: 1 1 auto; justify-content: center; min-width: 0; }
.bulkbar__count { font-weight: 650; font-size: 13px; white-space: nowrap; }
.bulkbar__link { font-size: 12.5px; white-space: nowrap; }
.bulkbar__note {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}
.bulkbar__spacer { flex: 1 1 auto; }

/* Auswahlkaestchen in der Zeile. Standardmaessig dezent, beim Ueberfahren
   der Zeile und bei aktiver Auswahl deutlich sichtbar. */
.item__check {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border: 1.5px solid var(--border-strong);
  border-radius: 5px;
  background: var(--surface);
  opacity: 0.35;
  transition: opacity 0.12s ease;
}
.item:hover .item__check,
.item:focus-within .item__check,
.item.is-checked .item__check { opacity: 1; }
/* Ohne Hover (Touch) gaebe es keinen Weg, die Kaestchen sichtbar zu machen. */
@media (hover: none) {
  .item__check { opacity: 1; }
}
.item__check svg { width: 13px; height: 13px; stroke: #fff; stroke-width: 2.6; }
.item.is-checked .item__check {
  background: var(--mv-blue);
  border-color: var(--mv-blue);
}
.item.is-checked { background: var(--mv-blue-050); }
[data-theme='dark'] .item.is-checked { background: var(--surface-2); }
.item__check:focus-visible { outline: 2px solid var(--mv-teal); outline-offset: 2px; }

.item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 10px;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font: inherit;
  color: var(--text);
}
.item:hover { background: var(--bg-alt); }
.item.is-active { background: var(--mv-blue-050); box-shadow: inset 3px 0 0 var(--mv-teal); }
.item__icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 8px;
  background: var(--bg-alt);
  color: var(--mv-blue);
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
}
[data-theme='dark'] .item__icon { color: var(--mv-blue-300); }
.item__main { flex: 1; min-width: 0; }
/* display: block ist nötig – als inline-Elemente würden Titel und Untertitel
   in einer Zeile zusammenlaufen und die Ellipse nicht greifen. */
.item__title {
  display: block;
  font-weight: 600;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.item__sub {
  display: block;
  margin-top: 1px;
  font-size: 12.3px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.item__flags { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.flag { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 5px; }
.flag svg { width: 14px; height: 14px; }
.flag--breach { color: #fff; background: var(--danger); }
.flag--weak { color: var(--warn); background: var(--warn-bg); }
.flag--reuse { color: var(--mv-blue); background: var(--mv-blue-050); }
.flag--fav { color: #d99a00; }
.flag--totp { color: var(--ok); background: var(--ok-bg); }

.group-title {
  padding: 12px 10px 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ------------------------------------------------------------------- Detail */

.detail { flex: 1; min-width: 0; overflow-y: auto; padding: 20px 24px 40px; background: var(--bg); }
.empty { display: grid; place-content: center; justify-items: center; gap: 12px; height: 100%; color: var(--text-muted); text-align: center; }
.empty__icon { width: 46px; height: 46px; opacity: 0.5; }

.detail__head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 18px; }
.detail__icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 12px;
  background: var(--mv-blue);
  color: #fff;
  font-weight: 700;
  font-size: 18px;
}
.detail__titles { flex: 1; min-width: 0; }
.detail__title { font-size: 21px; }
.detail__path { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.detail__actions { display: flex; gap: 6px; flex: 0 0 auto; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 4px 16px;
  margin-bottom: 16px;
}
.card--pad { padding: 16px; }
.card__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 12px 0 8px;
}

.row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.row:last-child { border-bottom: 0; }
.row__label { flex: 0 0 148px; font-size: 12.5px; font-weight: 600; color: var(--text-muted); }
.row__value { flex: 1; min-width: 0; word-break: break-word; }
.row__value--mono { font-family: var(--mono); font-size: 13.5px; letter-spacing: 0.02em; }
.row__actions { display: flex; gap: 2px; flex: 0 0 auto; }
.row--stack { flex-direction: column; align-items: stretch; gap: 6px; }
.pw-dots { font-family: var(--mono); letter-spacing: 0.18em; }
.note { white-space: pre-wrap; font-size: 13.6px; }
@media (max-width: 900px) { .row { flex-wrap: wrap; } .row__label { flex-basis: 100%; } }

.totp { display: flex; align-items: center; gap: 12px; }
.totp__code { font-family: var(--mono); font-size: 21px; font-weight: 600; letter-spacing: 0.12em; color: var(--mv-blue); }
[data-theme='dark'] .totp__code { color: var(--mv-blue-300); }
.totp__ring { width: 26px; height: 26px; transform: rotate(-90deg); }
.totp__ring circle { fill: none; stroke-width: 3; }
.totp__ring .bg { stroke: var(--border); }
.totp__ring .fg { stroke: var(--mv-teal); stroke-linecap: round; transition: stroke-dashoffset 1s linear; }

/* --------------------------------------------------------------- Kennzeichen */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 650;
  border: 1px solid transparent;
}
.tag svg { width: 13px; height: 13px; }
.tag--danger { color: var(--danger-600); background: var(--danger-bg); border-color: rgba(239, 68, 68, 0.3); }
.tag--warn { color: var(--warn); background: var(--warn-bg); border-color: rgba(178, 106, 0, 0.3); }
.tag--ok { color: var(--ok); background: var(--ok-bg); border-color: rgba(16, 129, 74, 0.3); }
.tag--info { color: var(--mv-blue); background: var(--mv-blue-050); border-color: var(--mv-blue-300); }
.tag--muted { color: var(--text-muted); background: var(--bg-alt); border-color: var(--border); }
[data-theme='dark'] .tag--danger { color: #fca5a5; }
[data-theme='dark'] .tag--info { color: var(--mv-blue-300); }

.strength { display: flex; align-items: center; gap: 10px; margin: -6px 0 14px; }
.strength__bar { flex: 1; height: 5px; border-radius: 4px; background: var(--border); overflow: hidden; }
.strength__bar span { display: block; height: 100%; width: 0; border-radius: 4px; background: var(--danger); transition: width 0.25s, background 0.25s; }
.strength__text { font-size: 11.8px; font-weight: 650; color: var(--text-muted); min-width: 92px; text-align: right; }
.strength.is-1 .strength__bar span { background: #ef4444; }
.strength.is-2 .strength__bar span { background: #ef7a00; }
.strength.is-3 .strength__bar span { background: #d3b100; }
.strength.is-4 .strength__bar span { background: #4a9d3a; }
.strength.is-5 .strength__bar span { background: var(--ok); }

/* ------------------------------------------------------------------ Kacheln */

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile {
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  text-align: left;
  font: inherit;
  color: var(--text);
  cursor: pointer;
}
.tile:hover { border-color: var(--mv-blue-300); }
.tile__value { font-size: 25px; font-weight: 700; line-height: 1.15; }
.tile__label { font-size: 12.4px; color: var(--text-muted); }
.tile--danger { border-left-color: var(--danger); }
.tile--danger .tile__value { color: var(--danger); }
.tile--warn { border-left-color: var(--warn); }
.tile--warn .tile__value { color: var(--warn); }
.tile--ok { border-left-color: var(--ok); }
.tile--info { border-left-color: var(--mv-blue); }

/* ------------------------------------------------------------------ Tabellen */

.table { width: 100%; border-collapse: collapse; font-size: 13.4px; }
.table th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}
.table td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:hover td { background: var(--surface-2); }
.table__actions { display: flex; gap: 4px; justify-content: flex-end; }
.table-wrap { max-height: min(60vh, 520px); overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.mono { font-family: var(--mono); font-size: 12.6px; }
.nowrap { white-space: nowrap; }
.muted { color: var(--text-muted); }
.right { text-align: right; }

/* -------------------------------------------------------------------- Modal */

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(6, 18, 34, 0.55);
  backdrop-filter: blur(2px);
  overflow-y: auto;
}
.modal-layer {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  overflow-y: auto;
  /* Eigener Stacking-Context je Ebene: sonst schlaegt der z-index der
     sticky-Tabellenkopfzeile (im hinteren Dialog) durch den vorderen Dialog.
     Die DOM-Reihenfolge bestimmt dann sauber, welche Ebene oben liegt. */
  isolation: isolate;
}
.modal {
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: pop 0.16s ease-out;
}
@keyframes pop { from { transform: translateY(8px) scale(0.99); opacity: 0; } }
.modal--wide { max-width: 940px; }
.modal--slim { max-width: 430px; }
.modal__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal__title { font-size: 16.5px; flex: 1; }
.modal__body { padding: 18px 20px; overflow-y: auto; }
.modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  flex-wrap: wrap;
}
.modal__foot--split { justify-content: space-between; }
.modal__error {
  margin: 0 0 14px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--danger-bg);
  color: var(--danger-600);
  font-size: 13px;
}
[data-theme='dark'] .modal__error { color: #fca5a5; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: -4px -4px 16px; padding: 0 4px; flex-wrap: wrap; }
.tab {
  padding: 9px 13px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--mv-blue); border-bottom-color: var(--mv-teal); }
[data-theme='dark'] .tab.is-active { color: #fff; }

.info-box {
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  background: var(--mv-blue-050);
  border: 1px solid var(--mv-blue-300);
  font-size: 13px;
  margin-bottom: 16px;
}
.info-box--warn { background: var(--warn-bg); border-color: rgba(178, 106, 0, 0.4); }
.info-box--danger { background: var(--danger-bg); border-color: rgba(239, 68, 68, 0.35); }
.info-box p { margin: 0 0 6px; }
.info-box p:last-child { margin-bottom: 0; }

.qr-wrap {
  display: flex;
  justify-content: center;
  margin: 4px 0 14px;
}
.qr-wrap .qr {
  width: 220px;
  height: 220px;
  max-width: 100%;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
/* Globale Icon-Regel (stroke: currentColor) fuer den QR-Code aufheben -
   sonst ueberdeckt ein heller Rand die Module. */
.qr-wrap .qr path { stroke: none; fill: #10233d; }
.qr-wrap .qr rect { stroke: none; fill: #fff; }

.code-block {
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.08em;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-alt);
  border: 1px dashed var(--border-strong);
  word-break: break-all;
  user-select: all;
}

/* --------------------------------------------------------------- Kontextmenu */

.menu-root { position: fixed; inset: 0; z-index: 70; }
.menu {
  position: absolute;
  min-width: 208px;
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.menu__item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  font: inherit;
  font-size: 13.5px;
  color: var(--text);
  text-align: left;
  background: none;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.menu__item:hover { background: var(--bg-alt); }
.menu__item svg { width: 16px; height: 16px; color: var(--text-muted); }
.menu__item--danger { color: var(--danger); }
.menu__item--danger svg { color: var(--danger); }
.menu__sep { height: 1px; margin: 5px 2px; background: var(--border); }
.menu__head { padding: 8px 10px 4px; font-size: 11.5px; color: var(--text-muted); }

/* ------------------------------------------------------------------- Toasts */

.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 90; display: flex; flex-direction: column; gap: 9px; }
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 240px;
  max-width: 380px;
  padding: 11px 14px;
  color: #fff;
  background: var(--mv-blue-900);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 13.5px;
  animation: slide 0.18s ease-out;
}
@keyframes slide { from { transform: translateX(16px); opacity: 0; } }
.toast--ok { background: #0f6b41; }
.toast--error { background: var(--danger-600); }
.toast svg { width: 17px; height: 17px; flex: 0 0 17px; }

.clipboard-note {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 90;
  padding: 7px 14px;
  font-size: 12.5px;
  color: #fff;
  background: var(--mv-blue-900);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.breach-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  margin-bottom: 8px;
  font-size: 12.3px;
  font-weight: 600;
  color: var(--danger-600);
  background: var(--danger-bg);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  width: 100%;
  text-align: left;
}
[data-theme='dark'] .breach-pill { color: #fca5a5; }

.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.spinner--dark { border-color: var(--border-strong); border-top-color: var(--mv-blue); }
@keyframes spin { to { transform: rotate(360deg); } }

.progress { height: 6px; border-radius: 4px; background: var(--border); overflow: hidden; margin: 10px 0; }
.progress span { display: block; height: 100%; width: 0; background: var(--mv-blue); transition: width 0.2s; }

/* -------------------------------------------------------------- Responsives */

@media (max-width: 1100px) {
  :root { --list-w: 320px; --sidebar-w: 232px; }
}
@media (max-width: 900px) {
  .topbar__burger { display: inline-grid; }
  .topbar__name, .topbar__username { display: none; }
  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    bottom: 0;
    left: 0;
    z-index: 40;
    box-shadow: var(--shadow-lg);
    transform: translateX(-100%);
    transition: transform 0.2s;
  }
  .sidebar.is-open { transform: none; }
  .list { flex: 1; width: auto; }
  .detail { position: fixed; inset: var(--topbar-h) 0 0; z-index: 30; display: none; }
  .detail.is-open { display: block; }
}
