*,
::before,
::after {
  box-sizing: border-box;
  border-width: 0;
  border-style: solid;
  border-color: #e5e7eb;
}

html {
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body,
h1,
h2,
h3,
p,
pre,
ol,
ul {
  margin: 0;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.h-full { height: 100%; }
.h-2 { height: 0.5rem; }
.h-3 { height: 0.75rem; }
.min-h-full { min-height: 100%; }
.w-full { width: 100%; }
.max-w-md { max-width: 28rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-3xl { max-width: 48rem; }
.max-w-4xl { max-width: 56rem; }
.max-w-6xl { max-width: 72rem; }
.block { display: block; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }
.flex-1 { flex: 1 1 0%; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-start { align-items: flex-start; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.justify-start { justify-content: flex-start; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.space-y-1 > :not([hidden]) ~ :not([hidden]) { margin-top: 0.25rem; }
.space-y-2 > :not([hidden]) ~ :not([hidden]) { margin-top: 0.5rem; }
.space-y-4 > :not([hidden]) ~ :not([hidden]) { margin-top: 1rem; }
.space-y-6 > :not([hidden]) ~ :not([hidden]) { margin-top: 1.5rem; }
.sticky { position: sticky; }
.bottom-0 { bottom: 0; }
.mx-auto { margin-left: auto; margin-right: auto; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-5 { margin-top: 1.25rem; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-md { border-radius: 0.375rem; }
.border { border-width: 1px; }
.border-b { border-bottom-width: 1px; }
.border-t { border-top-width: 1px; }
.border-slate-200 { border-color: #e2e8f0; }
.border-slate-300 { border-color: #cbd5e1; }
.border-red-200 { border-color: #fecaca; }
.border-emerald-200 { border-color: #a7f3d0; }
.bg-white { background-color: #fff; }
.bg-slate-50 { background-color: #f8fafc; }
.bg-slate-100 { background-color: #f1f5f9; }
.bg-blue-50 { background-color: #eff6ff; }
.bg-blue-700 { background-color: #1d4ed8; }
.bg-red-50 { background-color: #fef2f2; }
.bg-amber-50 { background-color: #fffbeb; }
.bg-emerald-100 { background-color: #d1fae5; }
.bg-emerald-50 { background-color: #ecfdf5; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-5 { padding-left: 1.25rem; padding-right: 1.25rem; }
.py-1\.5 { padding-top: 0.375rem; padding-bottom: 0.375rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-2\.5 { padding-top: 0.625rem; padding-bottom: 0.625rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.pl-5 { padding-left: 1.25rem; }
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-sans { font-family: inherit; }
.text-white { color: #fff; }
.text-slate-500 { color: #64748b; }
.text-slate-700 { color: #334155; }
.text-slate-800 { color: #1e293b; }
.text-slate-950 { color: #020617; }
.text-blue-700 { color: #1d4ed8; }
.text-blue-950 { color: #172554; }
.text-amber-950 { color: #451a03; }
.text-red-700 { color: #b91c1c; }
.text-red-800 { color: #991b1b; }
.text-emerald-800 { color: #065f46; }
.text-emerald-900 { color: #064e3b; }
.text-center { text-align: center; }
.uppercase { text-transform: uppercase; }
.tracking-wide { letter-spacing: 0.025em; }
.leading-6 { line-height: 1.5rem; }
.shadow-sm { box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05); }
.underline { text-decoration-line: underline; }
.list-disc { list-style-type: disc; }
.whitespace-pre-wrap { white-space: pre-wrap; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.architecture-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  color: #475569;
  font-size: 0.75rem;
  line-height: 1rem;
}

.architecture-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.architecture-state-mark {
  width: 0.625rem;
  height: 0.625rem;
  flex: 0 0 auto;
  border: 2px solid #94a3b8;
  border-radius: 9999px;
  background: #fff;
}

.architecture-flow {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  padding: 0;
  list-style: none;
}

.architecture-lane {
  position: relative;
  min-width: 0;
}

.architecture-lane:not(:last-child)::after {
  content: "↓";
  position: absolute;
  left: 50%;
  bottom: -1.625rem;
  color: #64748b;
  font-size: 1.25rem;
  transform: translateX(-50%);
}

.architecture-lane-heading {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-height: 2.5rem;
  border-bottom: 2px solid #cbd5e1;
  color: #1e293b;
}

.architecture-lane-heading h3 {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25rem;
}

.architecture-step {
  display: inline-flex;
  width: 1.75rem;
  height: 1.75rem;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  background: #1d4ed8;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
}

.architecture-components {
  display: grid;
  gap: 0.625rem;
  padding: 0.75rem 0 0;
  list-style: none;
}

.architecture-component {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.125rem 0.5rem;
  align-items: start;
  border-left: 3px solid #cbd5e1;
  border-radius: 0.375rem;
  background: #f8fafc;
  padding: 0.75rem;
}

.architecture-component-copy {
  display: grid;
  gap: 0.125rem;
  min-width: 0;
}

.architecture-component-label {
  color: #0f172a;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25rem;
}

.architecture-component-detail,
.architecture-component-state {
  color: #64748b;
  font-size: 0.75rem;
  line-height: 1rem;
}

.architecture-component-state {
  grid-column: 2;
}

.architecture-state-completed .architecture-state-mark {
  border-color: #059669;
  background: #059669;
}

.architecture-component.architecture-state-completed { border-left-color: #059669; }

.architecture-state-in_progress .architecture-state-mark {
  border-color: #2563eb;
  background: #2563eb;
}

.architecture-component.architecture-state-in_progress { border-left-color: #2563eb; }

.architecture-state-planned .architecture-state-mark { border-color: #d97706; }
.architecture-component.architecture-state-planned { border-left-color: #d97706; }

.architecture-state-blocked .architecture-state-mark {
  border-color: #dc2626;
  background: #dc2626;
}

.architecture-component.architecture-state-blocked { border-left-color: #dc2626; }
.focus\:outline-none:focus { outline: 2px solid transparent; outline-offset: 2px; }
.focus\:ring-2:focus { box-shadow: 0 0 0 2px #2563eb; }
.focus\:ring-blue-600:focus { box-shadow: 0 0 0 2px #2563eb; }
.hover\:bg-slate-50:hover { background-color: #f8fafc; }
.hover\:bg-blue-800:hover { background-color: #1e40af; }
.hover\:underline:hover { text-decoration-line: underline; }
@media (min-width: 640px) {
  .sm\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .architecture-flow {
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    gap: 1.5rem;
  }
  .architecture-lane:not(:last-child)::after {
    content: "→";
    top: 0.5rem;
    right: -1.125rem;
    bottom: auto;
    left: auto;
    transform: none;
  }
}
/* HTML's hidden state must win over utility display classes such as .flex. */
[hidden] { display: none !important; }

/* Chat request feedback (item 6): CSP style-src 'self' forbids htmx' injected styles. */
.chat-pending-status { display: flex; align-items: center; gap: 0.625rem; }
.chat-spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
  border: 2px solid #cbd5e1;
  border-top-color: #1d4ed8;
  border-radius: 9999px;
  animation: chat-spin 0.8s linear infinite;
}
@keyframes chat-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .chat-spinner { animation-duration: 2.4s; } }
.chat-send-button:disabled, button:disabled { opacity: 0.55; cursor: not-allowed; }
textarea[readonly] { background-color: #f8fafc; color: #64748b; }
.break-words { overflow-wrap: anywhere; }

/* Safe-Markdown rendering of assistant answers (markdown_safe.py output only). */
.md-body { overflow-x: auto; overflow-wrap: anywhere; }
.md-body > * + * { margin-top: 0.625rem; }
.md-body h1, .md-body h2, .md-body h3, .md-body h4 { font-weight: 600; color: #0f172a; line-height: 1.35; }
.md-body h1 { font-size: 1.125rem; }
.md-body h2 { font-size: 1.0625rem; }
.md-body h3, .md-body h4 { font-size: 0.9375rem; }
.md-body strong { font-weight: 600; color: #0f172a; }
.md-body ul, .md-body ol { padding-left: 1.5rem; }
.md-body ul { list-style: disc; }
.md-body ol { list-style: decimal; }
.md-body li + li { margin-top: 0.25rem; }
.md-body li > ul, .md-body li > ol { margin-top: 0.25rem; }
.md-body hr { border: 0; border-top: 1px solid #cbd5e1; }
.md-body blockquote { border-left: 3px solid #cbd5e1; padding-left: 0.75rem; color: #475569; }
.md-body code { background: #f1f5f9; border-radius: 0.25rem; padding: 0.0625rem 0.3125rem; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.8125rem; }
.md-body pre { background: #f1f5f9; border-radius: 0.375rem; padding: 0.625rem 0.75rem; overflow-x: auto; white-space: pre; }
.md-body pre code { background: transparent; padding: 0; }
.md-body table { border-collapse: collapse; width: 100%; font-size: 0.875rem; }
.md-body th, .md-body td { border: 1px solid #cbd5e1; padding: 0.375rem 0.625rem; text-align: left; vertical-align: top; }
.md-body th { background: #f1f5f9; font-weight: 600; }
.md-body tbody tr:nth-child(even) td { background: #f8fafc; }

/* Placeholder / mask highlighting (chat comparison, audit evidence). Colour is
   never the only cue: solid border = placeholder, dashed border + wavy underline = replaced original. */
.mask-ph, .mask-orig { border-radius: 0.25rem; padding: 0 0.25rem; font-weight: 500; }
.mask-ph { background: #dcfce7; color: #14532d; border: 1px solid #16a34a; border-bottom-width: 2px; }
.mask-orig { background: #fef3c7; color: #78350f; border: 1px dashed #b45309; text-decoration: underline wavy #b45309; text-underline-offset: 3px; }
/* F-16: word only the statistical NER called a person, sent unmasked ("unsicher"). */
#messages .mask-uncertain { border-radius: 0.25rem; padding: 0 0.25rem; background: #e0e7ff; color: #312e81; border: 1px dotted #4f46e5; text-decoration: underline dotted #4f46e5; text-underline-offset: 3px; }
.mask-legend { font-size: 0.875rem; line-height: 1.25rem; color: #334155; }
.audit-balance { border: 1px solid #86efac; background: #f0fdf4; border-radius: 0.5rem; padding: 1rem; color: #14532d; }
.audit-balance-grid { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.audit-balance-grid dt { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: #166534; }
.audit-balance-grid dd { margin: 0; font-weight: 600; color: #052e16; }
.audit-ok { color: #15803d; font-weight: 700; }
.audit-bad { color: #b91c1c; font-weight: 700; }
.audit-readable { font-size: 1rem; line-height: 1.6; color: #0f172a; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 0.5rem; padding: 0.75rem 1rem; }
.audit-role { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: #475569; margin-bottom: 0.25rem; }
.audit-raw { max-height: 60vh; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; border-radius: 0.375rem; background: #020617; color: #f1f5f9; padding: 1rem; font-size: 0.75rem; }
.max-w-7xl { max-width: 80rem; }
.cursor-pointer { cursor: pointer; }

/* Collapsible protection tools, header wrapping (UAT 2026-10-07). */
.chat-tools-summary { cursor: pointer; padding: 0.375rem 0.75rem; font-size: 0.875rem; font-weight: 500; color: #0f172a; }
.whitespace-nowrap { white-space: nowrap; }
.min-w-0 { min-width: 0; }
.text-left { text-align: left; }
.gap-x-3 { column-gap: 0.75rem; }
.gap-x-4 { column-gap: 1rem; }
.gap-y-2 { row-gap: 0.5rem; }
.gap-y-3 { row-gap: 0.75rem; }
.text-slate-600 { color: #475569; }
.text-red-950 { color: #450a0a; }
.border-red-300 { border-color: #fca5a5; }
.border-amber-400 { border-color: #fbbf24; }
.md\:col-span-2 { }
@media (min-width: 768px) { .md\:col-span-2 { grid-column: span 2 / span 2; } }

/* UAT 2026-10-07 follow-up: history keeps >= ~60 % of the viewport. */
.chat-shell { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.chat-shell > header { flex: 0 0 auto; }
.chat-history { flex: 1 1 0%; min-height: 0; overflow-y: auto; }
.chat-footer { flex: 0 0 auto; position: relative; z-index: 5; }
.chat-tools[open] > div {
  position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  width: min(56rem, calc(100% - 1rem)); max-height: 55vh; overflow-y: auto;
  background: #fff; border: 1px solid #cbd5e1; border-bottom: 0; border-radius: 0.5rem 0.5rem 0 0;
  box-shadow: 0 -6px 16px rgba(15, 23, 42, 0.12); padding-top: 0.75rem;
}
.chat-class-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; }
.chat-class-label { display: inline-flex; align-items: center; gap: 0.5rem; }
.chat-banner { flex: 1 1 18rem; min-width: 0; }
.chat-help { flex: 1 1 100%; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.access-denied-main { max-width: 28rem; margin: 0 auto; padding: 4rem 1rem; }
.access-denied-card { border: 1px solid #e2e8f0; border-radius: 0.5rem; background: #fff; padding: 2rem 1.5rem; text-align: center; margin-top: 12vh; }
.access-denied-card p { line-height: 1.5; }
.btn-primary, .btn-secondary { display: inline-block; border-radius: 0.375rem; padding: 0.5rem 1rem; font-size: 0.875rem; line-height: 1.25rem; font-weight: 500; text-decoration: none; white-space: nowrap; }
.btn-primary { background: #1d4ed8; color: #fff; }
.btn-primary:hover { background: #1e40af; }
.btn-secondary { background: #fff; color: #334155; border: 1px solid #cbd5e1; }
.btn-secondary:hover { background: #f8fafc; }
.access-denied-text { margin-top: 0.75rem; font-size: 0.875rem; color: #334155; }
.access-denied-actions { margin-top: 1.5rem; }
.mt-6 { margin-top: 1.5rem; }

/* Rueckuebersetzung: lokal wiederhergestellte Originale (Anwendersicht) */
.ph { border-radius: 0.25rem; }
.ph-restored { background: #d1fae5; color: #064e3b; border: 1px solid #059669; border-bottom-width: 2px; padding: 0 0.25rem; font-weight: 500; cursor: help; }
[data-ph-view="model"] .ph[title] { background: #dcfce7; color: #14532d; border: 1px solid #16a34a; padding: 0 0.25rem; }
.ph-bar { margin-top: 0.5rem; font-size: 0.75rem; line-height: 1rem; color: #065f46; }
.ph-toggle { margin-left: 0.25rem; border-radius: 0.25rem; border: 1px solid #059669; background: #ecfdf5; color: #065f46; padding: 0.125rem 0.5rem; font-size: 0.75rem; }
.ph-toggle:hover { background: #d1fae5; }
