/* ===== FONTS ===== */
@font-face { font-family:'Plus Jakarta Sans'; font-weight:400; font-style:normal; font-display:swap; src:url('/assets/fonts/plus-jakarta-sans-400-normal.woff2') format('woff2'); }
@font-face { font-family:'Plus Jakarta Sans'; font-weight:500; font-style:normal; font-display:swap; src:url('/assets/fonts/plus-jakarta-sans-500-normal.woff2') format('woff2'); }
@font-face { font-family:'Plus Jakarta Sans'; font-weight:600; font-style:normal; font-display:swap; src:url('/assets/fonts/plus-jakarta-sans-600-normal.woff2') format('woff2'); }
@font-face { font-family:'Plus Jakarta Sans'; font-weight:700; font-style:normal; font-display:swap; src:url('/assets/fonts/plus-jakarta-sans-700-normal.woff2') format('woff2'); }
@font-face { font-family:'Plus Jakarta Sans'; font-weight:800; font-style:normal; font-display:swap; src:url('/assets/fonts/plus-jakarta-sans-800-normal.woff2') format('woff2'); }

/* ===== TOKENS ===== (LGS-Blau statt Schichtplan-Indigo — Kundenportal ist produktübergreifend) */
:root {
  --accent:       #0119FF;
  --accent-hover: #0014CC;
  --accent-tint:  rgba(1,25,255,.08);
  --accent-alpha20: rgba(1,25,255,.2);

  --ink:          #0D1117;
  --text-2:       #1F2937;
  --text-body:    #4B5563;
  --text-muted:   #6B7280;

  --surface:      #F8F9FA;
  --card:         #FFFFFF;
  --border:       rgba(0,0,0,0.07);
  --border-strong:rgba(0,0,0,0.12);

  --success:        #16A34A;
  --success-bg:     #F0FDF4;
  --success-border: #BBF7D0;
  --danger:         #DC2626;
  --danger-bg:      #FEF2F2;
  --danger-border:  #FECACA;
  --warning-text:   #92400E;
  --warning-bg:     #FFFBEB;
  --warning-border: #FDE68A;

  --s1:4px;  --s2:8px;  --s3:12px; --s4:16px; --s5:20px; --s6:24px;
  --s8:32px; --s10:40px; --s12:48px;

  --r-pill: 9999px;
  --r-card: 16px;
  --r-sm:   8px;

  --shadow-card:  0 1px 3px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.06);
  --shadow-hover: 0 8px 32px rgba(0,0,0,.10);

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --t-fast:   0.15s var(--ease-out);
  --t-base:   0.25s var(--ease-out);

  --z-topbar:   98;
  --z-backdrop: 99;
  --z-sidebar:  100;
  --z-toast:    400;
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--text-body);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: var(--r-sm); }
button { font-family: inherit; cursor: pointer; }
img { display: block; max-width: 100%; }

/* ===== LAYOUT ===== */
.app-layout { display: flex; min-height: 100vh; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: 240px; flex-shrink: 0; background: var(--card); border-right: 1px solid var(--border);
  height: 100vh; position: sticky; top: 0; display: flex; flex-direction: column;
  overflow-y: auto; z-index: var(--z-sidebar);
}
.sidebar-logo { display: flex; align-items: center; padding: 20px 16px 16px; border-bottom: 1px solid var(--border); text-decoration: none; }
.sidebar-logo:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.sidebar-logo img { width: 100%; height: auto; display: block; } /* 9:1-Wortmarke: per Breite skalieren, sonst quetscht flex die Breite bei fixer Höhe -> verzerrt */

.sidebar-nav { flex: 1; padding: 12px 10px 8px; }
.nav-item {
  display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: var(--r-pill);
  font-size: 13.5px; font-weight: 500; color: var(--text-2); transition: background var(--t-fast), color var(--t-fast);
  text-decoration: none; margin-bottom: 1px; min-height: 40px;
}
.nav-item i { font-size: 15px; width: 16px; text-align: center; flex-shrink: 0; color: var(--text-muted); transition: color var(--t-fast); }
.nav-item:hover { background: var(--surface); color: var(--ink); }
.nav-item:hover i { color: var(--text-2); }
.nav-item.active { background: var(--accent-tint); color: var(--accent); font-weight: 600; }
.nav-item.active i { color: var(--accent); }
.nav-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.sidebar-legal { padding: 8px 10px 10px; border-top: 1px solid var(--border); }
.sidebar-legal a { display: block; font-size: 11px; color: var(--text-muted); padding: 4px 10px; border-radius: var(--r-sm); transition: color var(--t-fast); }
.sidebar-legal a:hover { color: var(--text-body); }

.sidebar-user { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--border); }
.sidebar-user__info { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sidebar-user__text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.sidebar-user__firma { font-size: 10.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-tint); border: 1.5px solid var(--accent-alpha20); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: var(--accent); flex-shrink: 0; letter-spacing: 0.03em; }
.user-name { font-size: 12.5px; font-weight: 600; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logout-btn { display: flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 500; color: var(--text-muted); padding: 8px 10px; border-radius: var(--r-pill); border: none; background: none; cursor: pointer; transition: color var(--t-fast), background var(--t-fast); text-decoration: none; white-space: nowrap; min-height: 40px; }
.logout-btn:hover { color: var(--ink); background: var(--surface); }
.logout-btn i { font-size: 14px; }
.logout-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ===== MAIN ===== */
.main-content { flex: 1; min-width: 0; background: var(--surface); }
.page-content { padding: 32px 40px; }

/* ===== PAGE HEADER ===== */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.page-header h1 { font-size: 22px; font-weight: 800; color: var(--ink); letter-spacing: -0.02em; line-height: 1.2; text-wrap: balance; }
.page-header p { font-size: 13px; color: var(--text-muted); margin-top: 3px; }

/* ===== BUTTONS ===== */
.btn { display: inline-flex; align-items: center; gap: 6px; font-family: inherit; font-size: 13.5px; font-weight: 600; padding: 10px 20px; border-radius: var(--r-pill); border: none; cursor: pointer; text-decoration: none; line-height: 1; transition: filter var(--t-fast), transform var(--t-fast), background var(--t-fast), color var(--t-fast), border-color var(--t-fast); white-space: nowrap; touch-action: manipulation; }
@media (hover: hover) and (pointer: fine) { .btn:hover { transform: translateY(-1px); } }
.btn:active { transform: scale(0.97); }
.btn i { font-size: 14px; }
button:focus-visible, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: var(--r-pill); }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-hover); color: #fff; }
.btn--outline { background: transparent; color: var(--ink); border: 1.5px solid var(--border-strong); }
.btn--outline:hover { background: var(--surface); color: var(--ink); }
.btn--ghost { background: transparent; color: var(--text-body); }
.btn--ghost:hover { background: var(--surface); color: var(--ink); }
.btn--danger { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger-border); }
.btn--danger:hover { background: var(--danger-border); }
.btn--sm { font-size: 12px; padding: 8px 14px; }
.btn--sm i { font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none !important; }

/* ===== CARD ===== */
.pm-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow-card); }
.pm-card__header { padding: 18px 24px 14px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pm-card__title { font-size: 15px; font-weight: 700; color: var(--ink); letter-spacing: -0.01em; }
.pm-card__body { padding: 24px; }
.pm-card + .pm-card { margin-top: 16px; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 20px; }
label.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.required { color: var(--danger); }
.form-control, .form-select {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif; font-size: 14px; color: var(--ink); background: var(--card);
  transition: border-color var(--t-fast), box-shadow var(--t-fast); appearance: none; -webkit-appearance: none; min-height: 44px;
}
.form-control:focus, .form-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.form-control.is-error, .form-select.is-error { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-bg); }
.form-control:disabled { background: var(--surface); color: var(--text-muted); cursor: not-allowed; }
.form-control::placeholder { color: var(--text-muted); }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 5px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }

/* ===== TABLE ===== */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.pm-table { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 13.5px; }
/* .pm-table--stack: auf Mobile keine Horizontal-Scroll-Tabelle, sondern gestapelte
   Karten pro Zeile (Label aus data-label, kein JS, keine doppelte Markup). */
@media (max-width: 700px) {
  .pm-table--stack { min-width: 0; }
  .pm-table--stack thead { display: none; }
  .pm-table--stack, .pm-table--stack tbody, .pm-table--stack tr, .pm-table--stack td { display: block; width: 100%; }
  .pm-table--stack tr { padding: 12px 14px; border-bottom: 1px solid var(--border); }
  .pm-table--stack tr:last-child { border-bottom: none; }
  .pm-table--stack td { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: none; text-align: right; }
  .pm-table--stack td::before { content: attr(data-label); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); text-align: left; flex-shrink: 0; }
  .pm-table--stack td:empty::before { content: none; }
}
.pm-table th { text-align: left; font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.pm-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); color: var(--text-2); vertical-align: middle; }
.pm-table tr:last-child td { border-bottom: none; }

/* ===== BADGE ===== */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: var(--r-pill); font-size: 11.5px; font-weight: 600; background: var(--surface); color: var(--text-2); border: 1px solid var(--border); }
.badge--accent  { background: var(--accent-tint); color: var(--accent); border-color: transparent; }
.badge--success { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }
.badge--warning { background: var(--warning-bg); color: var(--warning-text); border-color: var(--warning-border); }
.badge--danger  { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }
.badge--muted   { color: var(--text-muted); }

/* ===== STATS BAR ===== */
.stats-bar { display: flex; background: var(--card); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow-card); margin-bottom: 24px; overflow: hidden; }
.stats-bar__seg { flex: 1; padding: 16px 22px; border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: 3px; }
.stats-bar__seg:last-child { border-right: none; }
.stats-bar__label { font-size: 11px; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.stats-bar__value { font-size: 20px; font-weight: 800; color: var(--ink); letter-spacing: -0.02em; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-bottom: 0.1em; }
.stats-bar__sub { font-size: 12px; color: var(--text-muted); font-weight: 500; }
@media (max-width: 600px) {
  .stats-bar { flex-direction: column; }
  .stats-bar__seg { border-right: none; border-bottom: 1px solid var(--border); }
  .stats-bar__seg:last-child { border-bottom: none; }
}

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 64px 24px; background: var(--card); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow-card); }
.empty-state__icon { width: 68px; height: 68px; border-radius: 18px; background: var(--accent-tint); display: flex; align-items: center; justify-content: center; margin: 0 auto 20px; }
.empty-state__icon i { font-size: 30px; color: var(--accent); }
.empty-state h2 { font-size: 19px; font-weight: 700; color: var(--ink); margin-bottom: 8px; }
.empty-state p { font-size: 14px; color: var(--text-muted); margin-bottom: 24px; max-width: 36ch; margin-left: auto; margin-right: auto; }

/* ===== ALERT / HINT STRIP ===== */
.alert-strip { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--r-sm); margin-bottom: 20px; font-size: 13.5px; }
.alert-strip i { flex-shrink: 0; line-height: 1; font-size: 15px; }
.alert-strip--info    { background: var(--accent-tint); color: var(--accent); }
.alert-strip--warning { background: var(--warning-bg); color: var(--warning-text); border: 1px solid var(--warning-border); }

/* ===== TOAST ===== */
.toast-stack { position: fixed; top: 20px; right: 20px; z-index: var(--z-toast); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.pm-toast { padding: 11px 16px; border-radius: var(--r-sm); font-size: 13.5px; font-weight: 500; box-shadow: 0 4px 20px rgba(0,0,0,0.12); transform: translateX(120%); transition: transform 0.3s var(--ease-out); pointer-events: auto; display: flex; align-items: center; gap: 8px; max-width: 340px; }
.pm-toast.show { transform: translateX(0); }
.pm-toast--success { background: #ECFDF5; color: #065F46; border: 1px solid var(--success-border); }
.pm-toast--error { background: var(--danger-bg); color: #991B1B; border: 1px solid var(--danger-border); }
.pm-toast i { font-size: 14px; }

/* ===== MOBILE ===== */
.mobile-topbar { display: none; align-items: center; padding: 4px 8px; background: var(--card); border-bottom: 1px solid var(--border); gap: 8px; position: sticky; top: 0; z-index: var(--z-topbar); }
.mobile-burger { background: none; border: none; cursor: pointer; padding: 10px; border-radius: var(--r-sm); color: var(--ink); display: flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; }
.mobile-burger:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mobile-burger i { font-size: 20px; }
.mobile-topbar__logo { font-size: 14px; font-weight: 700; color: var(--ink); }
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: var(--z-backdrop); }
.sidebar-backdrop.show { display: block; }

@media (max-width: 768px) {
  .app-layout { flex-direction: column; }
  .mobile-topbar { display: flex; }
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform 0.25s var(--ease-out); z-index: var(--z-sidebar); height: 100dvh; }
  .sidebar.open { transform: translateX(0); }
  .page-content { padding: 20px 16px; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .pm-toast { max-width: calc(100vw - 40px); }
  .toast-stack { right: 10px; left: 10px; top: 10px; }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ===== PUBLIC PAGES (Landing/Registrieren) ===== */
/* 1:1 vom Keycloak-Login-Theme übernommen (keycloaklogin/assets/css/styles.css) —
   Split-Screen: dunkles Brand-Panel links (Streifenverlauf, Logo, Headline, Pills,
   Rechtliches) + weißes Formular-Panel rechts. Nur Design übernommen, keine
   Login-Feld-Logik (das ist Keycloaks eigene, separat gepflegte Seite). */
/* Nur .panel-form scrollt bei langen Formularen (z.B. Registrieren); .panel-brand bleibt fixiert. */
.page { display: grid; grid-template-columns: 1fr 1fr; height: 100vh; }

.panel-brand {
  position: relative; background: var(--ink); overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: var(--s10) var(--s12); gap: var(--s12);
}
.panel-brand::before {
  content: ''; position: absolute; inset: 0 -320px; z-index: 0; pointer-events: none;
  background: linear-gradient(73deg,
    #000773 0% 10%, #000da3 10% 20%, #0013cc 20% 30%, #0022ff 30% 70%,
    #0013cc 70% 80%, #000da3 80% 90%, #000773 90% 100%);
}
.panel-brand > * { position: relative; z-index: 1; }

.brand-logo { display: inline-flex; align-items: center; text-decoration: none; }
.brand-logo img { height: 32px; width: auto; display: block; }

.brand-body { display: flex; flex-direction: column; gap: var(--s5); flex: 1; justify-content: center; }
.brand-headline {
  font-size: clamp(2rem, 2.8vw, 2.75rem); font-weight: 400; line-height: 1.12;
  letter-spacing: -0.02em; color: rgba(255,255,255,0.65); text-wrap: balance;
}
.brand-headline em { font-style: normal; color: #fff; font-weight: 800; }
.brand-sub { font-size: 16px; color: rgba(255,255,255,0.65); line-height: 1.65; max-width: 38ch; }
.brand-pills { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s2); }
.brand-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px;
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.14);
  border-radius: var(--r-pill); font-size: 13px; font-weight: 500; color: rgba(255,255,255,0.78);
}
.brand-pill svg { width: 13px; height: 13px; opacity: 0.65; flex-shrink: 0; }

.brand-foot { display: flex; flex-wrap: wrap; gap: var(--s4); }
.brand-foot a { font-size: 12px; color: rgba(255,255,255,0.6); transition: color var(--t-fast); }
.brand-foot a:hover { color: #fff; }

.panel-form {
  display: flex; flex-direction: column; justify-content: safe center; align-items: center;
  padding: var(--s10) var(--s8); background: var(--card);
  height: 100vh; overflow-y: auto;
}
.login-card { width: 100%; max-width: 400px; }
.login-card--wide { max-width: 560px; }
.login-card__hd { margin-bottom: var(--s8); }
.login-card__title { font-size: clamp(1.6rem, 2vw, 2rem); font-weight: 800; line-height: 1.12; letter-spacing: -0.02em; color: var(--ink); margin-bottom: var(--s2); }
.login-card__sub { font-size: 15px; color: var(--text-body); }
.card-foot { margin-top: var(--s5); text-align: center; font-size: 13px; color: var(--text-muted); }
.card-foot a { color: var(--accent); font-weight: 500; }

@media (max-width: 760px) {
  /* Mobil: gestapelt, normaler Seiten-Scroll statt Split-Screen-Scroll-Trick (kein zuverlässiges 100vh im mobilen Browser-Chrome). */
  .page { grid-template-columns: 1fr; grid-template-rows: auto 1fr; height: auto; min-height: 100vh; }
  .panel-brand { flex-direction: row; align-items: center; justify-content: space-between; padding: var(--s4) var(--s5); gap: 0; min-height: 0; }
  .panel-brand::before { inset: 0; }
  .brand-body, .brand-foot { display: none; }
  .panel-form { justify-content: flex-start; padding: var(--s10) var(--s6); align-items: stretch; height: auto; overflow-y: visible; }
  .login-card, .login-card--wide { max-width: 100%; }
}
@media (max-width: 400px) { .panel-form { padding-inline: var(--s4); } }
