/* Modul D - Artefact Vault. Nur Tokens aus dem Block in index.html, keine Hex-Werte. */

.vault-root {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  font-family: var(--font-body);
}

.vault-root.is-open { pointer-events: auto; }

.vault-backdrop {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--surface-0) 62%, transparent);
  animation: vault-fade-in 240ms ease both;
}

.vault-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 520px;
  max-width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: color-mix(in srgb, var(--surface-1) 70%, transparent);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: inset 1px 0 0 var(--border-ghost), -24px 0 60px color-mix(in srgb, var(--surface-0) 55%, transparent);
  animation: vault-slide-in 240ms cubic-bezier(0.22, 0.61, 0.36, 1) both;
  outline: none;
}

@keyframes vault-slide-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes vault-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---- Kopf --------------------------------------------------------------- */

.vault-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 22px 14px;
}

.vault-eyebrow {
  margin: 0 0 4px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-caption);
}

.vault-title {
  margin: 0;
  font-family: var(--font-headline);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: var(--headline-spacing);
  text-transform: var(--headline-transform);
  color: var(--text-primary);
}

.vault-close {
  border: 0;
  border-radius: var(--radius-btn);
  background: var(--surface-3);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  padding: 9px 14px;
  cursor: pointer;
}

.vault-close:hover { background: var(--surface-4); }

/* ---- Tabs --------------------------------------------------------------- */

.vault-tabs {
  display: flex;
  gap: 6px;
  padding: 0 22px 12px;
  border-bottom: 1px solid var(--border-ghost);
  overflow-x: auto;
}

.vault-tab {
  flex: 0 0 auto;
  border: 0;
  border-radius: var(--radius-field);
  background: transparent;
  color: var(--text-caption);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  padding: 8px 12px;
  cursor: pointer;
  white-space: nowrap;
}

.vault-tab:hover { color: var(--text-muted); }

.vault-tab.is-active {
  background: var(--brand-soft, color-mix(in srgb, var(--brand-color) 18%, transparent));
  color: var(--text-primary);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand-color) 45%, transparent);
}

/* ---- Inhalt ------------------------------------------------------------- */

.vault-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px 40px;
}

.vault-pane { outline: none; }

.vault-section {
  margin-bottom: 26px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border-ghost);
}

.vault-section:last-child { border-bottom: 0; }

.vault-h3 {
  margin: 0 0 8px;
  font-family: var(--font-headline);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-primary);
}

.vault-note {
  margin: 0 0 12px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-caption);
}

.vault-chip {
  display: inline-block;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-muted);
  font-size: 11px;
  padding: 3px 9px;
  white-space: nowrap;
}

.vault-commit {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: var(--brand-color);
}

/* ---- Design-System ------------------------------------------------------ */

.vault-swatches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}

.vault-swatch {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 0;
  border-radius: var(--radius-field);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--border-ghost);
  color: var(--text-primary);
  font-family: var(--font-body);
  padding: 8px 10px;
  cursor: pointer;
  text-align: left;
}

.vault-swatch:hover { background: var(--surface-3); }

.vault-swatch-chip {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px var(--border-ghost);
}

.vault-swatch-text { display: flex; flex-direction: column; min-width: 0; }
.vault-swatch-token { font-size: 11px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; }
.vault-swatch-hex { font-size: 11px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text-caption); }

.vault-theme {
  margin-bottom: 14px;
  padding: 12px;
  border-radius: var(--radius-card);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--border-ghost);
}

.vault-theme.is-active { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand-color) 55%, transparent); }

.vault-theme-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.vault-theme-apply {
  border: 0;
  border-radius: var(--radius-btn);
  background: var(--btn-gradient);
  color: var(--btn-ink);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  padding: 8px 14px;
  cursor: pointer;
}

.vault-theme-apply[aria-pressed="true"] { filter: brightness(1.08); }

/* ---- Kontrastrechner ---------------------------------------------------- */

.vault-contrast-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.vault-color-field { display: flex; flex-direction: column; gap: 6px; font-size: 11px; color: var(--text-caption); }
.vault-color-row { display: flex; align-items: center; gap: 8px; }

.vault-color-row input[type="color"] {
  width: 38px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.vault-hex-input {
  flex: 1;
  min-width: 0;
  border: 0;
  border-radius: var(--radius-field);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--border-ghost);
  color: var(--text-primary);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  padding: 8px 10px;
}

.vault-hex-input:focus-visible { outline: 2px solid var(--brand-color); outline-offset: 1px; }

.vault-contrast-result {
  border-radius: var(--radius-card);
  box-shadow: inset 0 0 0 1px var(--border-ghost);
  padding: 16px;
  margin-bottom: 12px;
}

.vault-contrast-ratio {
  margin: 0 0 10px;
  font-family: var(--font-headline);
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
}

.vault-contrast-sample { margin: 0 0 6px; font-size: 14px; }
.vault-contrast-sample-lg { margin: 0; font-size: 19px; font-weight: 700; }

.vault-badges { display: flex; flex-wrap: wrap; gap: 8px; }

.vault-badge {
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 11px;
  background: var(--surface-3);
  color: var(--text-muted);
}

.vault-badge.is-pass {
  background: color-mix(in srgb, var(--brand-color) 22%, var(--surface-2));
  color: var(--text-primary);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand-color) 55%, transparent);
}

.vault-badge.is-fail {
  background: color-mix(in srgb, var(--brand-secondary) 18%, var(--surface-2));
  color: var(--text-primary);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand-secondary) 45%, transparent);
}

/* ---- Diagramm-Studio ---------------------------------------------------- */

.vault-diagram-list { display: flex; flex-direction: column; gap: 6px; }

.vault-diagram-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 0;
  border-radius: var(--radius-field);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--border-ghost);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 12px;
  text-align: left;
  padding: 10px 12px;
  cursor: pointer;
}

.vault-diagram-item:hover { background: var(--surface-3); }

.vault-diagram-item.is-active {
  color: var(--text-primary);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand-color) 55%, transparent);
}

.vault-diagram-name { font-weight: 700; }

.vault-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }

.vault-btn, .vault-btn-sm {
  border: 0;
  border-radius: var(--radius-btn);
  background: var(--surface-3);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-weight: 700;
  cursor: pointer;
}

.vault-btn { font-size: 13px; padding: 10px 16px; background: var(--btn-gradient); color: var(--btn-ink); }
.vault-btn-sm { font-size: 12px; padding: 7px 11px; }
.vault-btn-sm:hover { background: var(--surface-4); }

.vault-zoom-value {
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--text-caption);
  min-width: 52px;
  text-align: center;
}

.vault-canvas {
  position: relative;
  height: 320px;
  overflow: hidden;
  border-radius: var(--radius-card);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--border-ghost);
  cursor: grab;
  touch-action: none;
}

.vault-canvas.is-dragging { cursor: grabbing; }

.vault-canvas-inner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  transform-origin: center center;
}

.vault-canvas-inner svg, .vault-diagram-svg { max-width: 100%; max-height: 100%; height: auto; }

.vault-code {
  margin: 0;
  max-height: 220px;
  overflow: auto;
  border-radius: var(--radius-field);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--border-ghost);
  color: var(--text-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  line-height: 1.6;
  padding: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

.vault-command { user-select: all; }

/* ---- Audit -------------------------------------------------------------- */

.vault-emergency {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  border: 0;
  border-radius: var(--radius-card);
  background: linear-gradient(135deg, var(--brand-secondary), color-mix(in srgb, var(--brand-secondary) 55%, var(--surface-0)));
  color: var(--text-primary);
  font-family: var(--font-body);
  text-align: left;
  padding: 16px 18px;
  margin-bottom: 22px;
  cursor: pointer;
}

.vault-emergency-title { font-family: var(--font-headline); font-size: 15px; font-weight: 700; }
.vault-emergency-sub { font-size: 11px; opacity: 0.85; }

.vault-accordion {
  border-radius: var(--radius-field);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--border-ghost);
  margin-bottom: 8px;
  padding: 10px 12px;
}

.vault-accordion > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
  list-style: none;
}

.vault-accordion > summary::-webkit-details-marker { display: none; }
.vault-accordion[open] > summary { margin-bottom: 10px; }

.vault-md { font-size: 12px; line-height: 1.6; color: var(--text-muted); }
.vault-md h5, .vault-md h6 { margin: 12px 0 6px; font-family: var(--font-headline); font-size: 12px; color: var(--text-primary); }
.vault-md p { margin: 0 0 8px; }
.vault-md ul, .vault-md ol { margin: 0 0 8px; padding-left: 18px; }
.vault-md code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; color: var(--brand-color); }

.vault-table-wrap { overflow-x: auto; border-radius: var(--radius-field); box-shadow: inset 0 0 0 1px var(--border-ghost); }

.vault-table-wrap table { border-collapse: collapse; width: 100%; font-size: 11px; }

.vault-table-wrap th, .vault-table-wrap td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-ghost);
  vertical-align: top;
}

.vault-table-wrap th { color: var(--text-caption); font-weight: 700; white-space: nowrap; }
.vault-table-wrap td { color: var(--text-muted); }
.vault-table-wrap tr:last-child td { border-bottom: 0; }

.vault-status { display: inline-block; border-radius: 999px; font-size: 11px; padding: 2px 8px; white-space: nowrap; }
.vault-status-done { background: color-mix(in srgb, var(--brand-color) 22%, var(--surface-3)); color: var(--text-primary); }
.vault-status-late { background: color-mix(in srgb, var(--brand-secondary) 22%, var(--surface-3)); color: var(--text-primary); }
.vault-status-open { background: var(--surface-3); color: var(--text-caption); }

/* ---- Fokus -------------------------------------------------------------- */

.vault-root :focus-visible { outline: 2px solid var(--brand-color); outline-offset: 2px; }

/* ---- Mobil -------------------------------------------------------------- */

@media (max-width: 640px) {
  .vault-panel { width: 100%; }
  .vault-contrast-inputs { grid-template-columns: 1fr; }
  .vault-canvas { height: 240px; }
}

@media (prefers-reduced-motion: reduce) {
  .vault-panel, .vault-backdrop { animation: none; }
}
