@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap");

:root{
  --bg: #eef2f6;
  --bg-soft: #f7f9fc;
  --panel: #ffffff;
  --border: #dde3ec;
  --border-strong: #c9d2de;
  --text: #1c2a3a;
  --muted: #5b6b7c;
  --accent: #0f766e;
  --accent-soft: #ccfbf1;
  --accent-hover: #0d9488;
  --shadow: 0 1px 2px rgba(28, 42, 58, .04), 0 8px 24px rgba(28, 42, 58, .06);
  --shadow2: 0 2px 4px rgba(28, 42, 58, .05), 0 12px 28px rgba(28, 42, 58, .08);
  --radius: 14px;
  --radius-sm: 10px;
  --sidebar-w: 260px;
}

*,
*::before,
*::after{ box-sizing: border-box; }

html, body { height: 100%; }

body{
  margin: 0;
  font-family: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(900px 420px at 8% -5%, rgba(15, 118, 110, .07), transparent 60%),
    radial-gradient(700px 380px at 100% 0%, rgba(59, 130, 246, .06), transparent 55%),
    linear-gradient(180deg, #f4f7fa 0%, #eef2f6 100%);
  -webkit-font-smoothing: antialiased;
}

.app-shell{
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
}

.sidebar{
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 16px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  box-shadow: 1px 0 0 rgba(255,255,255,.6);
}

.brand{
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  letter-spacing: -.01em;
  margin-bottom: 22px;
  color: var(--text);
}

.brand-badge{
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(145deg, #14b8a6 0%, #0f766e 100%);
  box-shadow: 0 6px 16px rgba(15, 118, 110, .22);
  flex-shrink: 0;
}

.nav-section{
  margin-top: 18px;
  margin-bottom: 6px;
  padding: 0 10px;
  font-size: .72rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.navlink{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  border: 1px solid transparent;
  font-weight: 500;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.navlink:hover{
  background: var(--bg-soft);
  border-color: var(--border);
  color: var(--accent);
}
.navlink.active{
  background: var(--accent-soft);
  border-color: rgba(15, 118, 110, .18);
  color: var(--accent);
}

.main{
  padding: 20px 24px 32px;
  min-width: 0;
}

.topbar{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.topbar-title{
  font-weight: 650;
  color: var(--text);
  font-size: 1.05rem;
}

.page{
  margin-top: 18px;
  animation: fadeUp .22s ease both;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.cardx{
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.cardx:hover{ box-shadow: var(--shadow2); }
.cardx .cardx-body{ padding: 18px 20px; }

/* Dashboard */
.dash-kpis{
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  margin-bottom: 16px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.dash-kpis .dash-kpi{
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  background: var(--panel);
  min-width: 0;
}
.dash-kpi-label{
  color: var(--muted);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .02em;
  line-height: 1.2;
  margin-bottom: .15rem;
}
.dash-kpis .dash-kpi-label{ margin-bottom: 0; }
.dash-kpi-value-row{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.dash-kpi-value{
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text);
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.dash-kpis .dash-kpi-link{
  text-decoration: none;
  color: inherit;
  transition: background .15s ease;
}
.dash-kpis .dash-kpi-link:hover{
  background: var(--bg-soft);
  color: inherit;
}

.dash-badge-overdue{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  padding: 3px 8px;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.dash-panel .cardx-body{ padding: 14px 16px 10px; }
.dash-panel-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  min-height: 32px;
}
.dash-panel-title{
  margin: 0;
  font-size: .95rem;
  font-weight: 650;
  line-height: 1.2;
}
.dash-panel-meta{
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.dash-count{
  color: var(--muted);
  font-size: .8rem;
  font-weight: 600;
  white-space: nowrap;
}

.dash-list{
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 320px;
  overflow: auto;
}
.dash-list-item{
  border-top: 1px solid var(--border);
}
.dash-list-item:first-child{ border-top: 0; }
.dash-list-link{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 2px;
  text-decoration: none;
  color: inherit;
}
.dash-list-link:hover .dash-list-title{ color: var(--accent); }
.dash-list-main{
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.dash-list-title{
  font-weight: 600;
  font-size: .9rem;
  line-height: 1.3;
}
.dash-list-sub{
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.35;
}
.dash-list-aside{
  flex-shrink: 0;
  max-width: 42%;
  text-align: right;
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.35;
}
.dash-list-empty{
  padding: 18px 2px;
  color: var(--muted);
  font-size: .9rem;
}
.dash-list-item.is-overdue{
  border-left: 3px solid #dc2626;
  padding-left: 8px;
  margin-left: -2px;
}
.dash-list-item.is-soon{
  border-left: 3px solid #d97706;
  padding-left: 8px;
  margin-left: -2px;
}

.dash-sick{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.dash-sick-item{
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  background: var(--panel);
  text-decoration: none;
  color: inherit;
  transition: background .15s ease;
}
.dash-sick-item:hover{ background: var(--bg-soft); color: inherit; }

.kpi{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.kpi .kpi-title{ color: var(--muted); font-size: .9rem; font-weight: 500; }
.kpi .kpi-value{ font-size: 1.25rem; font-weight: 700; color: var(--text); }
.kpi-icon{
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.25rem;
}

.tablex{
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
}
.tablex th{
  color: var(--muted);
  font-weight: 600;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 0 14px 4px;
}
.th-sort{
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}
.th-sort:hover,
.th-sort.is-active{
  color: var(--accent);
}
.tablex td{
  background: var(--bg-soft);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 12px 14px;
  vertical-align: middle;
}
.tablex tr td:first-child{
  border-left: 1px solid var(--border);
  border-top-left-radius: 12px;
  border-bottom-left-radius: 12px;
}
.tablex tr td:last-child{
  border-right: 1px solid var(--border);
  border-top-right-radius: 12px;
  border-bottom-right-radius: 12px;
}
.rowlink{ cursor: pointer; transition: transform .12s ease; }
.rowlink:hover td{
  background: rgba(15, 118, 110, .04);
}
.rowlink:hover{ transform: translateY(-1px); }
.text-warning-emphasis{ color: #b45309; }

.form-control, .form-select{
  background-color: #fff !important;
  border: 1px solid var(--border-strong) !important;
  color: var(--text) !important;
  border-radius: var(--radius-sm) !important;
  padding: 10px 12px !important;
}
.form-control:focus, .form-select:focus{
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 .2rem rgba(15, 118, 110, .15) !important;
}
.form-control::placeholder{ color: #94a3b8 !important; }
label.form-label{
  color: var(--muted);
  font-size: .875rem;
  font-weight: 550;
  margin-bottom: .35rem;
}

.input-group-text{
  border-radius: var(--radius-sm) 0 0 var(--radius-sm) !important;
  border: 1px solid var(--border-strong) !important;
  background: var(--bg-soft) !important;
  color: var(--muted) !important;
}

.btn{ border-radius: var(--radius-sm) !important; font-weight: 600 !important; }
.btn-primary{
  background: var(--accent) !important;
  border: 1px solid var(--accent) !important;
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(15, 118, 110, .18);
}
.btn-primary:hover,
.btn-primary:focus{
  background: var(--accent-hover) !important;
  border-color: var(--accent-hover) !important;
}

/* Soft outline — ersetzt das alte Dark-Mode btn-outline-light */
.btn-outline-light,
.btn-outline-secondary,
.btn-ghost{
  background: #fff !important;
  color: var(--text) !important;
  border: 1px solid var(--border-strong) !important;
  box-shadow: none !important;
}
.btn-outline-light:hover,
.btn-outline-secondary:hover,
.btn-ghost:hover{
  background: var(--bg-soft) !important;
  border-color: var(--accent) !important;
  color: var(--accent) !important;
}

.nav-tabs{ border-bottom: 1px solid var(--border) !important; gap: 4px; }
.nav-tabs .nav-link{
  border: 1px solid transparent !important;
  border-top-left-radius: 12px !important;
  border-top-right-radius: 12px !important;
  color: var(--muted) !important;
  padding: 10px 14px;
  font-weight: 550;
  transition: background .12s ease, color .12s ease;
}
.nav-tabs .nav-link:hover{
  color: var(--accent) !important;
  background: var(--bg-soft) !important;
}
.nav-tabs .nav-link.active{
  background: var(--accent-soft) !important;
  border-color: rgba(15, 118, 110, .2) !important;
  color: var(--accent) !important;
}

.alertx{
  border-radius: 12px !important;
  border: 1px solid var(--border) !important;
  background: var(--panel) !important;
  color: var(--text) !important;
  box-shadow: var(--shadow) !important;
}
.alert-success.alertx{
  background: #ecfdf5 !important;
  border-color: #a7f3d0 !important;
}
.alert-warning.alertx{
  background: #fffbeb !important;
  border-color: #fde68a !important;
}
.alert-error.alertx,
.alert-danger.alertx{
  background: #fef2f2 !important;
  border-color: #fecaca !important;
}

.modal-content.hr-modal,
.hr-modal{
  background: var(--panel) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  color: var(--text);
  box-shadow: var(--shadow2);
}
.hr-modal .modal-header,
.hr-modal .modal-footer{
  border-color: var(--border) !important;
}
.hr-modal .btn-close{ filter: none; }

.text-secondary{ color: var(--muted) !important; }
.text-light{ color: var(--text) !important; }

.user-chip{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  font-size: .875rem;
  font-weight: 600;
}

.login-wrap{
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

/* Zeugnis-Liste: einklappbar + Statusfarben */
.cert-item{
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}
.cert-item-toggle{
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
}
.cert-item-title{
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-weight: 600;
  font-size: .95rem;
}
.cert-sep{ color: var(--muted); font-weight: 400; }
.cert-chevron{
  transition: transform .15s ease;
  color: var(--muted);
  font-size: .85rem;
}
.cert-item-toggle[aria-expanded="true"] .cert-chevron{
  transform: rotate(90deg);
}
.cert-status-badge{
  flex-shrink: 0;
  font-size: .72rem;
  font-weight: 650;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.cert-item-body{
  padding: 0 14px 14px 36px;
  border-top: 1px solid rgba(0,0,0,.04);
}

/* Offen / Entwurf */
.cert-status-draft{
  background: #fff8eb;
  border-color: #f5d78e;
}
.cert-status-draft .cert-status-badge{
  background: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
}
/* In Prüfung */
.cert-status-review{
  background: #eef4ff;
  border-color: #b6c9f5;
}
.cert-status-review .cert-status-badge{
  background: #dbeafe;
  border-color: #3b82f6;
  color: #1e40af;
}
/* Genehmigt (noch nicht final) */
.cert-status-approved{
  background: #eefaf4;
  border-color: #a7e3c4;
}
.cert-status-approved .cert-status-badge{
  background: #d1fae5;
  border-color: #10b981;
  color: #065f46;
}
/* Finalisiert */
.cert-status-finalized{
  background: #f1f5f4;
  border-color: #c5d4d0;
}
.btn-icon{
  width: 36px;
  height: 36px;
  padding: 0 !important;
  display: inline-grid !important;
  place-items: center;
}

/* Datenschutz-Maskierung (CSS-first, ohne JS sichtbar) */
body.privacy-masked .pii-clear{ display: none !important; }
body:not(.privacy-masked) .pii-mask{ display: none !important; }
body.privacy-masked .pii-mask{
  display: inline;
  color: var(--muted);
  letter-spacing: .12em;
  user-select: none;
}
body.privacy-masked .form-control > .pii-mask,
body.privacy-masked td > .pii-mask{
  display: inline-block;
}
/* Formularfelder mit sensiblen Daten */
body.privacy-masked .pii-field{
  filter: blur(6px);
  user-select: none;
  caret-color: transparent;
}
body.privacy-masked .pii-field:focus{
  filter: blur(6px);
}
#btnPrivacyToggle .bi{ margin-right: .35rem; }

/* Mitarbeiter-Anlage-Wizard */
.emp-wizard{
  max-width: 720px;
}
.wizard-steps{
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}
.wizard-step{
  flex: 1 1 0;
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .55rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--muted);
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.wizard-step.is-active{
  border-color: rgba(15, 118, 110, .35);
  color: var(--text);
  background: var(--accent-soft);
}
.wizard-step.is-done{ color: var(--text); }
.wizard-step-num{
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .75rem;
  background: #e8eef4;
  color: inherit;
  flex-shrink: 0;
}
.wizard-step.is-active .wizard-step-num,
.wizard-step.is-done .wizard-step-num{
  background: var(--accent);
  color: #fff;
}
.wizard-step-label{
  font-weight: 600;
  font-size: .84rem;
  line-height: 1.2;
}
.wizard-pane[hidden]{ display: none !important; }

.emp-wizard-body{ padding: 12px 16px 14px; }
.emp-wizard .stamm-block:first-child{ padding-top: 4px; }
.emp-form-grid{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
}
.emp-field{ min-width: 0; }
.emp-field-sm{ max-width: 11rem; }
.emp-field-wide{ grid-column: span 2; }
.emp-field-full{ grid-column: 1 / -1; }
.emp-wizard .form-label{
  margin-bottom: .2rem;
  font-size: .75rem;
}
.emp-wizard .form-control,
.emp-wizard .form-select{
  padding: 7px 10px !important;
  font-size: .9rem;
}
.emp-wizard textarea.form-control{ min-height: 0; }
.emp-portal-opt{
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
}
.emp-wizard-actions{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

@media (max-width: 575.98px){
  .emp-form-grid{ grid-template-columns: 1fr; }
  .emp-field-sm{ max-width: none; }
  .emp-field-wide{ grid-column: auto; }
  .wizard-step-label{ font-size: .78rem; }
}

.stamm-section-nav{
  margin-bottom: .85rem;
}

.stamm-panel .cardx-body{ padding: 14px 16px 10px; }
.stamm-identity{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.stamm-identity-main{ min-width: 0; }
.stamm-identity-name{
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -.01em;
}
.stamm-identity-salutation{
  font-weight: 600;
  color: var(--muted);
}
.stamm-identity-meta{
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 4px;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 500;
}

.stamm-kv{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 28px;
  margin: 0;
}
.stamm-kv-single{
  grid-template-columns: 1fr;
  max-width: 36rem;
}
.stamm-kv-row{
  display: grid;
  grid-template-columns: 6.75rem minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
  padding: 6px 0;
  border-bottom: none;
}
.stamm-kv-single .stamm-kv-row + .stamm-kv-row{
  padding-top: 4px;
}
.stamm-kv-span{ grid-column: 1 / -1; }
.stamm-kv-row dt{
  margin: 0;
  font-size: .78rem;
  font-weight: 600;
  color: var(--muted);
}
.stamm-kv-row dd{
  margin: 0;
  font-size: .9rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  word-break: break-word;
}

.stamm-blocks{
  display: flex;
  flex-direction: column;
}
.stamm-block{
  padding: 12px 0;
  border-top: 1px solid var(--border);
}
.stamm-block:first-child{ border-top: 0; padding-top: 10px; }
.stamm-block-title{
  margin: 0 0 6px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
}
.stamm-block-text{
  font-size: .9rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  max-width: 36rem;
}
.stamm-multiline{ white-space: pre-line; font-weight: 500; }
.stamm-mono{
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .84rem;
  letter-spacing: .02em;
  font-weight: 600;
}

@media (max-width: 767.98px){
  .stamm-kv{ grid-template-columns: 1fr; gap: 0; }
  .stamm-identity{ flex-wrap: wrap; }
}

/* Unternehmensstruktur: gestapelte Accordion-Abschnitte */
.structure-stack{
  display: flex;
  flex-direction: column;
  gap: .75rem;
  max-width: 920px;
}
.structure-stack--wide{
  max-width: 1600px;
}
.structure-panel{
  overflow: hidden;
}
.structure-toggle{
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem;
  border: 0;
  background: transparent;
  color: var(--text);
  font-weight: 600;
  font-size: 1rem;
  text-align: left;
  cursor: pointer;
}
.structure-toggle .bi{
  transition: transform .2s ease;
  color: var(--muted);
}
.structure-toggle:not(.collapsed) .bi{
  transform: rotate(180deg);
}
.structure-panel .cardx-body{
  border-top: 1px solid var(--border);
}

/* Manuell abweichende Felder im Vertragsgenerator */
.form-control.is-override,
.form-select.is-override{
  background: #fffbeb !important;
  border-color: #f0c674 !important;
  box-shadow: inset 3px 0 0 #d97706;
}

/* Mail-Events: feste Spalten über alle Kategorien */
.mail-events-table{
  table-layout: fixed;
  border-spacing: 0 6px;
}
.mail-events-table .mail-events-col-event{ width: 52%; }
.mail-events-table .mail-events-col-recipients{ width: 32%; }
.mail-events-table .mail-events-col-status{ width: 16%; }
.mail-events-table th:last-child,
.mail-events-table td:last-child{
  text-align: right;
  white-space: nowrap;
}
.mail-events-table td:nth-child(2){
  word-break: break-word;
}
.mail-events-table tr.mail-events-category td{
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 14px 4px 2px;
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}
.mail-events-table tr.mail-events-category:first-child td{
  padding-top: 0;
}

/* Navigations-Tour (erster Login) */
body.nav-tour-active{
  overflow: hidden;
}
body.nav-tour-active .main{
  pointer-events: none;
}
body.nav-tour-active .sidebar .navlink.nav-tour-target{
  position: relative;
  z-index: 1102;
  background: #fff;
  border-color: rgba(15, 118, 110, .4);
  box-shadow:
    0 0 0 3px rgba(15, 118, 110, .2),
    0 0 0 9999px rgba(28, 42, 58, .48);
  pointer-events: none;
}
.nav-tour{
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: transparent;
}
.nav-tour-card{
  position: fixed;
  z-index: 1103;
  padding: 14px 16px 12px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow2);
  max-width: 340px;
}
.nav-tour-kicker{
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 4px;
}
.nav-tour-title{
  margin: 0 0 6px;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.25;
}
.nav-tour-body{
  margin: 0;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.45;
}
.nav-tour-footer{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
}
.nav-tour-pager{
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.nav-tour-count{
  font-size: .78rem;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 991.98px){
  body.nav-tour-active .sidebar .navlink.nav-tour-target{ box-shadow: none; }
  body.nav-tour-active .mobile-nav-drawer .navlink.nav-tour-target{
    position: relative;
    z-index: 1102;
    background: #fff;
    border-color: rgba(15, 118, 110, .4);
    box-shadow:
      0 0 0 3px rgba(15, 118, 110, .2),
      0 0 0 9999px rgba(28, 42, 58, .48);
    pointer-events: none;
  }
}
.analytics-control{
  margin-bottom: 14px;
  padding: 12px 14px 10px;
  border: 1px solid rgba(15, 118, 110, .22);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(15, 118, 110, .07), rgba(15, 118, 110, .03)),
    var(--panel);
  box-shadow: var(--shadow);
}
.analytics-control-head{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.analytics-control-title{
  font-size: .95rem;
  font-weight: 700;
  line-height: 1.2;
}
.analytics-control-sub{
  margin-top: 2px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 500;
}
.analytics-filters{ display: flex; flex-direction: column; gap: 8px; }
.analytics-filter-row{
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  gap: 8px 12px;
  align-items: center;
}
.analytics-filter-label{
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
}
.analytics-filter-group{
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-width: 0;
}
.analytics-filter-group > .form-select,
.analytics-filter-group > .form-control{
  width: auto;
  min-width: 9.5rem;
  max-width: 100%;
  flex: 1 1 9.5rem;
  padding: 6px 10px !important;
  font-size: .86rem;
}
.analytics-filter-year{
  flex: 0 0 5.5rem !important;
  min-width: 5.5rem !important;
  max-width: 5.5rem;
}
.analytics-filter-dates{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 11rem;
  min-width: 11rem;
}
.analytics-filter-dates .form-control{ flex: 1 1 auto; min-width: 0; }
.analytics-filter-inline-label{
  font-size: .75rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.analytics-check{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}
.analytics-check .form-check-input{
  margin: 0;
  float: none;
}
.analytics-more[hidden]{ display: none !important; }
.analytics-chips{
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 0;
  margin-top: 8px;
}
.analytics-chips:empty{ display: none; }
.analytics-chip{
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  padding: .2rem .65rem !important;
  font-size: .78rem !important;
}
.analytics-chip:hover{ border-color: var(--accent); color: var(--accent); }

.analytics-kpis{
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  margin-bottom: 14px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.analytics-kpi{
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  background: var(--panel);
  min-width: 0;
}
.analytics-kpi .dash-kpi-label{ margin-bottom: 0; }
.analytics-kpi .dash-kpi-value{ font-size: 1.35rem; }
.analytics-kpi-note{
  color: var(--muted);
  font-size: .75rem;
  font-weight: 500;
  line-height: 1.3;
}

@media (max-width: 991.98px){
  .analytics-kpis{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .analytics-filter-row{ grid-template-columns: 1fr; gap: 4px; }
}
@media (max-width: 575.98px){
  .analytics-kpis{ grid-template-columns: 1fr 1fr; }
}

.analytics-chart-heat{ position: relative; width: 100%; height: 340px; }
.analytics-chart-md{ position: relative; height: 260px; }
.analytics-chart-sm{ position: relative; height: 240px; }
.analytics-heat-legend{ display: flex; align-items: center; gap: 4px; }
.heat-swatch{
  display: inline-block;
  width: 14px;
  height: 8px;
  border-radius: 3px;
  margin-right: 4px;
  vertical-align: middle;
}
.heat-swatch.cold{ background: #0f766e; }
.heat-swatch.mid{ background: #b48c28; }
.heat-swatch.hot{ background: #c2410c; }
.analytics-insights{ display: grid; gap: 10px; }
.analytics-insight{
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
}
.analytics-insight-ok{ border-left: 3px solid #10b981; }
.analytics-insight-info{ border-left: 3px solid #3b82f6; }
.analytics-insight-warn{ border-left: 3px solid #f59e0b; }
.analytics-insight-alert{ border-left: 3px solid #ef4444; }
.analytics-matrix th, .analytics-matrix td{
  text-align: center;
  font-size: .78rem;
  padding: 6px 4px !important;
  min-width: 2.4rem;
}
.analytics-matrix th:first-child,
.analytics-matrix td:first-child{
  text-align: left;
  min-width: 7rem;
  white-space: nowrap;
}
.analytics-matrix-cell{ font-variant-numeric: tabular-nums; font-weight: 600; }
#analytics-app.is-loading{ opacity: .55; pointer-events: none; transition: opacity .15s ease; }

/* Zeitkorrekturen: aufklappbare Details (Abgeschlossen/Abgelehnt) */
.time-history-table{
  border-spacing: 0 4px;
}
.time-history-table tr.time-history-row td{
  vertical-align: middle;
}
.time-history-table tr.time-detail-row td{
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  box-shadow: none;
}
.time-detail-toggle .time-detail-chevron{
  display: inline-block;
  transition: transform .15s ease;
  color: var(--muted);
}
.time-detail-toggle[aria-expanded="true"] .time-detail-chevron{
  transform: rotate(90deg);
}
.time-detail-panel{
  margin: 0 0 8px;
  padding: 12px 14px 14px 2.75rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 0 0 12px 12px;
  border-top: none;
}
.time-detail-grid{
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 12px 24px;
}
.time-detail-label{
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  margin-bottom: 2px;
}
@media (max-width: 768px){
  .time-detail-grid{ grid-template-columns: 1fr; }
  .time-detail-panel{ padding-left: 14px; }
}

/* Vorgangs-Karten */
.case-stack{
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.case-card{
  background: var(--panel);
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.case-stack .case-card,
.case-card{ margin-bottom: 0; }
.cardx-body > .case-card + .case-card,
.case-stack + .case-stack{ margin-top: 0; }
.cardx-body > .case-card{ margin-bottom: 14px; }
.cardx-body > .case-card:last-child{ margin-bottom: 0; }

.case-status-draft{ border-left-color: #f59e0b; }
.case-status-review{ border-left-color: #3b82f6; }
.case-status-approved{ border-left-color: #10b981; }
.case-status-rejected{ border-left-color: #ef4444; }
.case-status-muted{ border-left-color: #94a3b8; }

.case-card-main{ padding: 14px 16px 12px; }
.case-card-meta{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.case-id{
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.case-type{
  font-size: .78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .03em;
}
.case-status-badge{
  font-size: .72rem;
  font-weight: 650;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: #f1f5f9;
  color: #334155;
}
.case-status-draft .case-status-badge{
  background: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
}
.case-status-review .case-status-badge{
  background: #dbeafe;
  border-color: #3b82f6;
  color: #1e40af;
}
.case-status-approved .case-status-badge{
  background: #d1fae5;
  border-color: #10b981;
  color: #065f46;
}
.case-status-rejected .case-status-badge{
  background: #fee2e2;
  border-color: #ef4444;
  color: #991b1b;
}
.case-card-title{
  font-weight: 650;
  font-size: .98rem;
  line-height: 1.35;
}
.case-card-sub{ margin-top: 4px; }
.case-dot{ margin: 0 .25rem; color: var(--muted); }
.case-card-reason{
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  font-size: .88rem;
  color: var(--text);
  max-width: 42rem;
}
.case-card-decision{
  margin-top: 6px;
  font-size: .86rem;
  font-weight: 600;
  color: var(--accent);
}

.case-card-activity{
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  padding: 10px 16px 12px;
}
.case-activity-label{
  font-size: .72rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  margin-bottom: 6px;
}
.case-comments{
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  display: grid;
  gap: 6px;
  max-width: 36rem;
}
.case-comments li{
  padding: 6px 9px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.case-comment-head{
  display: flex;
  gap: 8px;
  align-items: baseline;
}
.case-comment-author{ font-weight: 650; font-size: .82rem; }
.case-comment-time{ color: var(--muted); font-size: .75rem; }
.case-comment-body{ margin-top: 2px; font-size: .86rem; line-height: 1.35; }
.case-attachments{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.case-attachment{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  text-decoration: none;
  color: var(--text);
  font-size: .82rem;
}
.case-attachment:hover{
  border-color: var(--accent);
  color: var(--accent);
}
.case-activity-forms{
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 36rem;
}
.case-activity-form{
  display: flex;
  gap: 8px;
  align-items: center;
}
.case-activity-form .form-control{ flex: 1 1 auto; min-width: 0; }
.case-activity-form-file .form-control{ max-width: 100%; }

.case-card-footer{
  border-top: 1px solid var(--border);
  padding: 10px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  background: #fbfcfe;
}
.case-decide-inline{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  flex: 1 1 auto;
}
.case-decide-inline .form-control{
  max-width: 220px;
  min-width: 140px;
}

.case-list-filters{
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}
.case-list-filters .form-control,
.case-list-filters .form-select{ min-width: 160px; }

.case-compact-table{ border-spacing: 0 6px; }
.case-compact-table .rowlink td{ cursor: pointer; }
.case-modal-body{ padding: 12px 16px 16px; }
.case-modal-body .case-card{
  box-shadow: none;
  border-radius: var(--radius-sm);
}
.case-modal-body .case-card-footer{ background: transparent; }

/* ── Mobile bottom navigation ── */
.mobile-nav-toggle{
  display: none;
}

.mobile-bottom-nav{
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1040;
  height: calc(64px + env(safe-area-inset-bottom, 0px));
  padding: 6px 4px env(safe-area-inset-bottom, 0px);
  background: rgba(255, 255, 255, .94);
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 24px rgba(28, 42, 58, .08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  align-items: stretch;
  justify-content: space-around;
  gap: 2px;
}

.mobile-bottom-nav__item{
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 4px;
  margin: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  text-decoration: none;
  font-family: inherit;
  font-size: .68rem;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: .01em;
  cursor: pointer;
  transition: color .15s ease, background .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.mobile-bottom-nav__item i{
  font-size: 1.2rem;
  line-height: 1;
}
.mobile-bottom-nav__item span{
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mobile-bottom-nav__item:hover,
.mobile-bottom-nav__item:focus-visible{
  color: var(--accent);
  background: var(--bg-soft);
  outline: none;
}
.mobile-bottom-nav__item.active{
  color: var(--accent);
  background: var(--accent-soft);
}
.mobile-bottom-nav__badge{
  position: absolute;
  top: 2px;
  right: calc(50% - 18px);
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: .62rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

.mobile-nav-drawer{
  --bs-offcanvas-width: min(320px, 88vw);
  border-right: 1px solid var(--border);
}
.mobile-nav-drawer .offcanvas-header{
  padding: 18px 16px 10px;
  border-bottom: 1px solid var(--border);
}
.mobile-nav-drawer .offcanvas-body{
  padding: 12px 16px 24px;
}
.mobile-nav-drawer .brand{ margin-bottom: 0; }

@media (max-width: 991.98px){
  .app-shell{ grid-template-columns: 1fr; }
  .sidebar{ display: none; }

  .mobile-nav-toggle{ display: inline-flex; align-items: center; justify-content: center; }
  .mobile-bottom-nav{ display: flex; }

  body.has-mobile-nav{
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  }

  .main{
    padding: 12px 12px 20px;
  }

  .topbar{
    padding: 10px 12px;
    gap: 10px;
    border-radius: 12px;
    flex-wrap: wrap;
  }
  .topbar-title{
    font-size: .98rem;
  }
  .privacy-label-text{ display: none; }
  .topbar .btn{
    white-space: nowrap;
  }

  .page{ margin-top: 14px; }

  .cardx .cardx-body{ padding: 14px 14px; }

  .nav-tabs{
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .nav-tabs::-webkit-scrollbar{ display: none; }
  .nav-tabs .nav-link{
    white-space: nowrap;
    padding: 8px 12px;
    font-size: .9rem;
  }

  .case-list-filters .form-control,
  .case-list-filters .form-select{
    min-width: 0;
    flex: 1 1 140px;
  }

  .case-decide-inline .form-control{
    max-width: none;
    width: 100%;
  }
  .case-card-footer,
  .case-decide-inline{
    flex-direction: column;
    align-items: stretch;
  }
  .case-decide-inline .btn,
  .case-card-footer .btn{
    width: 100%;
  }

  .dash-kpis{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dash-kpi-value{ font-size: 1.35rem; }
}

@media (max-width: 575.98px){
  .main{ padding: 10px 10px 18px; }
  .mobile-bottom-nav__item{ font-size: .62rem; }
  .mobile-bottom-nav__item i{ font-size: 1.15rem; }
}
