
html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

/* Ensure SPA uses full viewport height and consistent padding */
html, body { height: 100%; }
body { margin: 0; }
/* Layout sizing vars */
:root {
  --appbar-h: 64px;
  --app-bottom-gap: 8px;
  --app-vh: 1vh;

  /* Design tokens (ds = design system) */
  --ds-space-1: 4px;
  --ds-space-2: 8px;
  --ds-space-3: 12px;
  --ds-space-4: 16px;
  --ds-space-5: 20px;
  --ds-space-6: 24px;
  --ds-space-7: 32px;
  --ds-space-8: 40px;
  --ds-space-9: 48px;
  --ds-radius-1: 4px;
  --ds-radius-2: 6px;
  --ds-radius-3: 8px;
  --ds-radius-4: 12px;
  --ds-shadow-1: 0 1px 2px rgba(15, 23, 42, 0.08), 0 1px 1px rgba(15, 23, 42, 0.04);
  --ds-shadow-2: 0 6px 18px rgba(15, 23, 42, 0.12), 0 2px 6px rgba(15, 23, 42, 0.08);
  --ds-font-12: 12px;
  --ds-font-14: 14px;
  --ds-font-16: 16px;
  --ds-font-20: 20px;
  --ds-font-24: 24px;
  --ds-font-32: 32px;
  --ds-color-text: #111827;
  --ds-color-text-muted: #475569;
  --ds-color-border: #e2e8f0;
  --ds-color-surface: #ffffff;
  --ds-color-surface-alt: #f8fafc;
  --ds-color-brand: #0f766e;
  --ds-color-brand-contrast: #ffffff;
}
@media (max-width: 600px) { :root { --appbar-h: 56px; } }

/* Use JS-computed --app-vh to avoid browser UI bars issues */
.mud-layout { min-height: calc(var(--app-vh, 1vh) * 100); }
.mud-main-content {
  min-height: calc((var(--app-vh, 1vh) * 100) - var(--appbar-h, 64px) - var(--app-bottom-gap, 8px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Brand header (logo in drawer) with breathing room */
.brand-header {
  height: 56px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  background-size: contain !important;
  background-repeat: no-repeat !important;
  background-position: left center !important;
  background-origin: content-box;
}

@media (min-width: 600px) { .brand-header { height: 64px; } }
@media (min-width: 960px) { .brand-header { height: 72px; } }

.brand-header--logo {
  margin: 0;
  border: 0;
  height: var(--appbar-h, 64px);
  overflow: hidden;
}

.brand-header--logo .drawer-logo {
  align-self: stretch;
  object-position: left top;
}

/* Drawer logo image scales to fit header */
.drawer-logo {
  width: 100%;
  height: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

/* App content responsive padding */
.app-content {
  padding: 6px 6px var(--app-bottom-gap, 8px) 6px;
  flex: 1 1 auto;
  min-height: 0;
  height: calc((var(--app-vh, 1vh) * 100) - var(--appbar-h, 64px) - var(--app-bottom-gap, 8px));
  box-sizing: border-box;
  overflow: auto;
}
@media (max-width: 600px) {
  .app-content {
    height: calc((var(--app-vh, 1vh) * 100) - var(--appbar-h, 56px) - var(--app-bottom-gap, 8px));
  }
}
@media (min-width: 600px) { .app-content { padding: 8px 8px var(--app-bottom-gap, 8px) 8px; } }
@media (min-width: 960px) { .app-content { padding: 12px 12px var(--app-bottom-gap, 8px) 12px; } }

/* Override old scroll-container height to be 5px shorter globally */
/* Generic scroll container height: viewport minus appbar and a toolbar band (~56px) and bottom gap */
body .scroll-container { height: calc((var(--app-vh, 1vh) * 100) - var(--appbar-h, 64px) - 56px - var(--app-bottom-gap, 8px)) !important; overflow-y: auto; }

/* Brand image on auth/login */
.brand-img { max-height: 48px; width: auto; object-fit: contain; }
@media (min-width: 600px) { .brand-img { max-height: 56px; } }

/* Auth (Identity UI) layout to match old login design */
.auth-body {
  background: radial-gradient(1200px 900px at 20% 0%, #e8f1ff 0%, #f5f7fb 45%, #f8fafc 100%);
}
.auth-body .mud-main-content { min-height: 100vh; padding: 0; margin: 0; }
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card {
  width: 420px;
  max-width: 92vw;
  border-radius: 8px;
  box-sizing: border-box;
  background: #ffffff;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
  border: 1px solid rgba(15, 23, 42, 0.06);
  padding: 28px 28px 22px;
}
.auth-single { display: flex; flex-direction: column; gap: 10px; }
.auth-logo { display: flex; align-items: center; justify-content: center; height: 56px; margin-bottom: 4px; }
.auth-logo-img { max-height: 40px; width: auto; object-fit: contain; }
.auth-logo-fallback { width: 32px; height: 32px; color: #0078d4; }
.auth-title { margin: 0; text-align: center; font-size: 20px; font-weight: 600; color: #111827; }
.auth-subtitle { margin: 0 0 6px; text-align: center; font-size: 13px; color: #475569; }
.auth-form { width: 100%; text-align: left; }
.auth-field { margin-bottom: 12px; }
.auth-label { display: block; font-size: 12.5px; color: #1f2937; margin-bottom: 6px; }
.auth-input {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 13.5px;
  background: #fff;
  color: #111827;
  outline: none;
  box-sizing: border-box;
}
.auth-input:focus { border-color: #0078d4; box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.2); }
.auth-input-row { display: flex; align-items: center; gap: 6px; }
.auth-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  cursor: pointer;
}
.auth-icon-btn:hover { background: #eef2f7; }
.auth-error { min-height: 14px; font-size: 11.5px; color: #b91c1c; margin-top: 4px; }
.auth-row { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 10px; }
.auth-check { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: #1f2937; }
.auth-btn {
  width: 100%;
  padding: 9px 10px;
  border-radius: 4px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 13.5px;
}
.auth-btn-primary { background: #0078d4; color: #fff; }
.auth-btn-primary:hover { background: #0063b1; }
.auth-btn-outline {
  margin-top: 8px;
  background: #fff;
  border-color: #cbd5e1;
  color: #111827;
}
.auth-btn-outline[data-provider] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.auth-btn-outline[data-provider]::before {
  content: "";
  width: 18px;
  height: 18px;
  display: inline-block;
  background-repeat: no-repeat;
  background-size: contain;
}
.auth-btn-outline[data-provider="Google"]::before {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23EA4335' d='M12 10.2v3.9h5.4c-.6 2.4-2.6 3.9-5.4 3.9-3.2 0-5.8-2.6-5.8-5.8S8.8 6.4 12 6.4c1.6 0 2.9.6 3.9 1.6l2.7-2.7C16.9 3.6 14.7 2.6 12 2.6 6.9 2.6 2.8 6.7 2.8 11.8S6.9 21 12 21c5 0 8.3-3.5 8.3-8.4 0-.6-.1-1.2-.2-1.7H12z'/></svg>");
}
.auth-btn-outline[data-provider="Microsoft"]::before {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><rect x='2' y='2' width='9' height='9' fill='%23F35325'/><rect x='13' y='2' width='9' height='9' fill='%2381BC06'/><rect x='2' y='13' width='9' height='9' fill='%2305A6F0'/><rect x='13' y='13' width='9' height='9' fill='%23FFBA08'/></svg>");
}
.auth-divider {
  text-align: center;
  margin: 12px 0 4px;
  font-size: 12px;
  color: #6b7280;
}
.auth-divider span { background: #fff; padding: 0 8px; }
.auth-external form { display: flex; flex-direction: column; }
.auth-links {
  margin-top: 10px;
  text-align: center;
  font-size: 12.5px;
  color: #475569;
}
.auth-link { color: #0063b1; text-decoration: none; }
/* In .auth-row steht der Link neben "Angemeldet bleiben" (12.5px). Ohne Angabe
   erbt er 16px und die Zeile zerfaellt auf schmalen Bildschirmen in zwei
   ungleich grosse Bloecke. */
.auth-row .auth-link { font-size: 12.5px; }
.auth-link:hover { text-decoration: underline; }
.auth-footer {
  position: fixed;
  bottom: 0;
  width: 100%;
  background: transparent;
}

/* Panels that should share equal heights and allow inner scrolling */
.app-grid-full { height: 100%; min-height: 0; }
.app-panel { height: 100%; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.panel-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; }
.app-panel-footer { flex: 0 0 auto; padding-top: 6px; }
.stats-panel { min-height: 0; }
.stats-grid { height: 100%; min-height: 0; }
.stats-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 1fr; gap: 14px; height: 100%; min-height: 0; }
@media (max-width: 1200px) { .stats-charts { grid-template-columns: 1fr; } }
.stats-kpi { border: 1px solid #e6edf3; border-radius: 12px; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06); }
.stats-tile { display: flex; flex-direction: column; min-height: 0; height: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid #e6edf3; background: #ffffff; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06); }
.stats-title { font-weight: 600; color: #1f2a37; }
.stats-donut { position: relative; flex: 1 1 auto; min-height: 0; }
.stats-donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; color: #1f2a37; }
.stats-chart-fixed { height: 260px; }
.stats-tile .mud-table-container { max-height: 100%; overflow: auto; }
.settings-shell { min-height: 0; overflow: hidden; }
.settings-tabs { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.settings-tabs .mud-tabs-panels { flex: 1 1 auto; min-height: 0; }
.settings-tabs .mud-tab-panel { height: 100%; }
.settings-tab { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.settings-tab > form { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.settings-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; }
.settings-footer { flex: 0 0 auto; display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding-top: 8px; }
.settings-footer-info { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.settings-card { display: flex; flex-direction: column; min-height: 0; }
.settings-card .mud-card-content { flex: 1 1 auto; min-height: 0; }
.upload-shell { min-height: 0; display: flex; flex-direction: column; height: 100%; }
.upload-top { flex: 0 0 auto; }
.upload-table { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.upload-footer { flex: 0 0 auto; display: flex; align-items: center; gap: 12px; padding-top: 8px; }
.app-column { height: 100%; display: flex; flex-direction: column; gap: 8px; }
.app-column > .app-panel { flex: 1 1 0; min-height: 0; }

/* Index info tables: prevent right clipping, allow wrapping */
.info-table table { table-layout: fixed; width: 100%; }
.info-table .mud-table-cell { white-space: normal; overflow-wrap: anywhere; }
.info-table .info-actions { white-space: nowrap; }
.info-stack { display: flex; flex-direction: column; gap: 8px; align-content: flex-start; }
.info-doc-card { display: flex; flex-direction: column; gap: 6px; }
.info-doc-title { font-weight: 600; }
.info-doc-subtitle { color: var(--mud-palette-text-secondary); }
.info-doc-topic { color: var(--mud-palette-text-primary); }
.info-doc-actions { display: flex; gap: 6px; justify-content: flex-end; }
.info-doc-section { margin-bottom: 6px; }
.line-clamp-3 { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.panel-2-3 { flex: 2 1 0 !important; }
.panel-1-3 { flex: 1 1 0 !important; }
.card-media-fill { height: 100%; object-fit: cover; }

/* Make MudTable body scroll and keep footer visible */
.table-fill { display: flex; flex-direction: column; height: 100%; }
.table-fill .mud-table-container { flex: 1 1 auto; min-height: 0; overflow: auto; }
.table-fill .mud-table-pagination { flex: 0 0 auto; }

/* Utility */
.h-100 { height: 100%; }

a, .btn-link {
    color: #0366d6;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.content {
    padding-top: 1.1rem;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

/* Handbuch: Navigation links, Inhalt rechts */
.hb { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 32px; padding: 24px 24px 48px; max-width: 1280px; }
.hb-nav { position: sticky; top: 0; align-self: start; max-height: calc(100vh - 120px); overflow: auto; font-size: 0.9rem; }
.hb-title { font-size: 1.6rem; font-weight: 500; }
.hb-crumb { color: var(--mud-palette-text-secondary); font-size: 0.85rem; min-height: 1.2em; margin: 2px 0 16px; }
.hb-search { width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1px solid var(--mud-palette-lines-inputs); border-radius: 4px; font: inherit; background: var(--mud-palette-surface); color: var(--mud-palette-text-primary); margin-bottom: 14px; }
.hb-search:focus { outline: none; border-color: var(--mud-palette-primary); }
.hb-hits { color: var(--mud-palette-text-secondary); font-size: 0.8rem; margin: 0 0 6px 2px; }
.hb-nav details { margin-bottom: 6px; }
.hb-nav summary { cursor: pointer; font-weight: 500; padding: 4px 2px; list-style: none; }
.hb-nav summary::before { content: "\25B8"; display: inline-block; width: 1.1em; transition: transform .15s; }
.hb-nav details[open] > summary::before { transform: rotate(90deg); }
.hb-list { list-style: none; margin: 2px 0 6px; padding: 0 0 0 14px; }
.hb-list a { display: block; padding: 4px 8px; border-radius: 4px; color: var(--mud-palette-text-primary); text-decoration: none; }
.hb-list a:hover { background: var(--mud-palette-action-default-hover); }
.hb-list a.active { background: var(--mud-palette-primary-hover); color: var(--mud-palette-primary); font-weight: 500; }
.hb-hit-group { color: var(--mud-palette-text-secondary); font-size: 0.75rem; margin-left: 4px; }
.hb-content { max-width: 860px; line-height: 1.6; color: var(--mud-palette-text-primary); }
.hb-content h1 { font-size: 2rem; font-weight: 500; margin: 8px 0 20px; }
.hb-content h2 { font-size: 1.15rem; font-weight: 500; margin: 28px 0 10px; }
.hb-content p, .hb-content ul { margin: 0 0 12px; }
.hb-content li { margin-bottom: 4px; }
.hb-content a { color: var(--mud-palette-primary); }
.hb-content code { background: var(--mud-palette-background-gray); padding: 1px 5px; border-radius: 3px; font-size: 0.88em; }
.hb-content table { border-collapse: collapse; width: 100%; margin: 8px 0 16px; font-size: 0.9rem; }
.hb-content th, .hb-content td { border: 1px solid var(--mud-palette-lines-default); padding: 7px 10px; text-align: left; vertical-align: top; }
.hb-content th { background: var(--mud-palette-background-gray); font-weight: 500; }
@media (max-width: 900px) {
    .hb { grid-template-columns: 1fr; padding: 16px; gap: 16px; }
    .hb-nav { position: static; max-height: none; }
}

/* Optik: Logo-Kopf im Menue, weichere Kanten */
.drawer-brand { height: var(--mud-appbar-height, 64px); box-sizing: border-box; display: flex; align-items: center; justify-content: center; padding: 8px 14px; border-bottom: 1px solid var(--mud-palette-lines-default); }
.drawer-brand img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; border-radius: 4px; }
.drawer-brand-preview { width: 240px; border: 1px dashed var(--mud-palette-lines-default); border-radius: 6px; margin-bottom: 6px; }
.mud-drawer { border-right: 1px solid var(--mud-palette-lines-default); }
.mud-drawer .mud-nav-link { border-radius: 6px; margin: 1px 8px; width: calc(100% - 16px); }
.mud-drawer .mud-nav-link.active { background-color: var(--mud-palette-primary-hover); font-weight: 500; }
.mud-drawer .mud-nav-group > .mud-nav-link { margin: 1px 8px; }
.mud-paper-outlined { border-color: rgba(0, 0, 0, 0.08) !important; box-shadow: 0 1px 3px rgba(16, 24, 40, 0.05); }

/* Dokumentenansicht: Rubriken (wie Outlook „Relevant/Sonstige“), Filter, Jahresgruppen */
.dv-head { flex: 0 0 auto; display: flex; flex-direction: column; gap: 8px; padding: 6px 16px 8px; background: var(--mud-palette-surface); border-bottom: 1px solid var(--mud-palette-lines-default); }
.dv-list { padding-top: 0 !important; scrollbar-width: thin; }
.dv-list::-webkit-scrollbar { width: 6px; }
.dv-list::-webkit-scrollbar-thumb { background: var(--mud-palette-lines-inputs); border-radius: 3px; }
.dv-tabs { display: flex; gap: 18px; border-bottom: 1px solid var(--mud-palette-lines-default); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.dv-tabs::-webkit-scrollbar { display: none; }
.dv-tab { background: none; border: none; border-bottom: 2px solid transparent; padding: 6px 0 7px; margin-bottom: -1px; font: inherit; font-size: 0.95rem; color: var(--mud-palette-text-secondary); cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.dv-tab:hover { color: var(--mud-palette-text-primary); }
.dv-tab.active { color: var(--mud-palette-primary); border-bottom-color: var(--mud-palette-primary); font-weight: 600; }
.dv-badge { background: var(--mud-palette-primary); color: #fff; border-radius: 10px; font-size: 0.7rem; font-weight: 600; line-height: 1; padding: 3px 6px; }
.dv-filterpanel { display: flex; flex-direction: column; gap: 6px; padding: 8px 0 4px; border-top: 1px dashed var(--mud-palette-lines-default); }
.dv-filterlabel { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--mud-palette-text-secondary); }
.dv-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.dv-chip { border: 1px solid var(--mud-palette-lines-inputs); background: var(--mud-palette-surface); color: var(--mud-palette-text-primary); border-radius: 14px; padding: 3px 10px; font: inherit; font-size: 0.8rem; line-height: 1.4; cursor: pointer; }
.dv-chip:hover { border-color: var(--mud-palette-primary); }
.dv-chip.active { background: var(--mud-palette-primary); border-color: var(--mud-palette-primary); color: #fff; }
.dv-reset { align-self: flex-start; background: none; border: none; padding: 2px 0; font: inherit; font-size: 0.8rem; color: var(--mud-palette-primary); cursor: pointer; }
.dv-year { position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; align-items: center; padding: 6px 16px; font-size: 0.8rem; font-weight: 600; color: var(--mud-palette-text-primary); background: var(--mud-palette-background-gray); border-top: 1px solid var(--mud-palette-lines-default); }
.dv-year span { font-weight: 400; color: var(--mud-palette-text-secondary); }
.dv-empty { padding: 24px 16px; color: var(--mud-palette-text-secondary); text-align: center; }

/* PDF-Vorschau (DevExpress DxPdfViewer) im Portal-Rahmen */
.pdf-vorschau { flex: 1 1 auto; min-height: 0; display: flex; }
.pdf-vorschau .pdf-vorschau-viewer { flex: 1 1 auto; height: 100%; width: 100%; border: none; border-radius: 0 0 8px 8px; }
/* Werkzeugleiste der PDF-Vorschau flach statt schwebender Kästen */
.pdf-vorschau .dxbrv-toolbar-container { padding: 4px 8px !important; border-bottom: 1px solid var(--mud-palette-lines-default); background: var(--mud-palette-surface); }
.pdf-vorschau .dxbrv-toolbar .dxbl-btn-group.dxbrv-toolbar-item { background: transparent !important; box-shadow: none !important; padding: 0 !important; border-radius: 0 !important; }
.pdf-vorschau .dxbrv-toolbar .dxbl-btn-toolbar { gap: 4px; }
/* Drehknöpfe der PDF-Vorschau (eigene Toolbar-Einträge, DevExpress liefert keine Drehen-Icons) */
.pdf-vorschau .pdf-icon-links, .pdf-vorschau .pdf-icon-rechts { display: inline-block; width: 16px; height: 16px; background-color: currentColor; -webkit-mask: var(--pdf-icon) no-repeat center / 100%; mask: var(--pdf-icon) no-repeat center / 100%; }
.pdf-vorschau .pdf-icon-links { --pdf-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12a9 9 0 1 0 3-6.7L3 8'/%3E%3Cpath d='M3 3v5h5'/%3E%3C/svg%3E"); }
.pdf-vorschau .pdf-icon-rechts { --pdf-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12a9 9 0 1 1-3-6.7L21 8'/%3E%3Cpath d='M21 3v5h-5'/%3E%3C/svg%3E"); }
