/* ============================================================
   Bechtle Rheinland Asset Management Tool — Main Stylesheet
   ============================================================ */

/* Alpine.js: hide elements with x-cloak until Alpine initialises */
[x-cloak] { display: none !important; }

/* ============================================================
   Bechtle Pro — self-hosted web font (variable + static)
   ============================================================ */

@font-face {
  font-family: 'BechtlePro';
  src: url('../fonts/BechtleProVar.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'BechtlePro';
  src: url('../fonts/BechtleProVar-Italic.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}
/* Static fallbacks */
@font-face {
  font-family: 'BechtlePro';
  src: url('../fonts/BechtlePro-Light.woff2') format('woff2');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'BechtlePro';
  src: url('../fonts/BechtlePro-LightItalic.woff2') format('woff2');
  font-weight: 300;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'BechtlePro';
  src: url('../fonts/BechtlePro.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'BechtlePro';
  src: url('../fonts/BechtlePro-Italic.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'BechtlePro';
  src: url('../fonts/BechtlePro-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'BechtlePro';
  src: url('../fonts/BechtlePro-BoldItalic.woff2') format('woff2');
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

/* ============================================================
   CSS Custom Properties
   ============================================================ */

:root {
  --bechtle-dark-green:   #075033;
  --bechtle-green:        #23a96a;
  --bechtle-light-bg:     #f0f4f2;
  --bechtle-white:        #ffffff;
  --bechtle-text:         #1a1a2e;
  --bechtle-text-muted:   #6b7280;
  --bechtle-border:       #e5e7eb;
  --bechtle-danger:       #dc2626;
  --bechtle-warning:      #d97706;
  --bechtle-info:         #2563eb;
  --bechtle-success:      #16a34a;

  /* Shadows */
  --shadow-xs:  0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm:  0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md:  0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-lg:  0 10px 32px rgba(0, 0, 0, 0.1), 0 4px 8px rgba(0, 0, 0, 0.04);
  --shadow-xl:  0 20px 60px rgba(0, 0, 0, 0.18);

  /* Transitions */
  --transition-fast:   all 0.12s ease;
  --transition-base:   all 0.15s ease;
  --transition-smooth: all 0.2s ease;

  /* Border Radii */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-pill: 999px;

  /* Responsive touch targets */
  --touch-target: 44px;
  --btn-height-sm: 32px;
  --btn-height-md: 40px;
  --btn-height-lg: 48px;
}

/* ============================================================
   Base Reset
   ============================================================ */

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: 'BechtlePro', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bechtle-light-bg);
  color: var(--bechtle-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

img,
svg {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
}

ul,
ol {
  list-style: none;
}

/* ============================================================
   App Layout
   ============================================================ */

.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ============================================================
   Sidebar
   ============================================================ */

.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: 240px;
  height: 100vh;
  background: var(--bechtle-dark-green);
  color: white;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 99px;
}

.sidebar-header {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.sidebar-logo-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 4px;
}

.sidebar-logo {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.logo-wordmark {
  font-size: 0.75rem;
  font-weight: 700;
  color: white;
  letter-spacing: 0.02em;
  white-space: nowrap;
  line-height: 1.2;
}

.logo-subtitle {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.6);
  white-space: nowrap;
}

.sidebar-logo-icon {
  width: 36px;
  height: 36px;
  background: var(--bechtle-green);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.sidebar-logo-text {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.sidebar-subtitle {
  font-size: 0.7rem;
  opacity: 0.6;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: rgba(255, 255, 255, 0.85);
  border-radius: 8px;
  margin: 1px 8px;
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--transition-base);
  cursor: pointer;
  position: relative;
  min-height: 44px;
}

.sidebar-nav a:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.sidebar-nav a.active {
  background: var(--bechtle-green);
  color: white;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(35, 169, 106, 0.35);
}

.sidebar-nav a.active .nav-icon,
.sidebar-nav a:hover .nav-icon {
  opacity: 1;
}

.sidebar-nav .nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0.75;
  line-height: 1;
}

.sidebar-section-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.4);
  padding: 16px 24px 6px;
  font-weight: 600;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
}

.sidebar-user {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 12px;
}

.sidebar-user-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 10px;
}

.sidebar-user-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: white;
}

.sidebar-user-role {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.55);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-user strong {
  display: block;
  color: white;
  font-size: 0.875rem;
  margin-bottom: 2px;
}

/* ============================================================
   Main Content
   ============================================================ */

/* .main-wrapper wraps topbar + page content, offset from fixed sidebar */
.main-wrapper {
  margin-left: 240px;
  width: calc(100% - 240px);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.main-content {
  flex: 1;
  padding: 24px;
  min-width: 0;
  overflow-x: hidden;
}

/* ============================================================
   Topbar
   ============================================================ */

.topbar {
  background: var(--bechtle-white);
  border-bottom: 1px solid var(--bechtle-border);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-xs);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Topbar Logo — sichtbar nur wenn Sidebar versteckt ist (≤1023px) */
.topbar-logo {
  display: none; /* auf Desktop: Sidebar zeigt Logo */
  align-items: center;
  gap: 8px;
  text-decoration: none;
  flex-shrink: 0;
}

.topbar-logo-img {
  width: clamp(22px, 3vw, 30px);
  height: clamp(22px, 3vw, 30px);
  object-fit: contain;
  flex-shrink: 0;
}

.topbar-logo-text {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}

.topbar-logo-wordmark {
  font-size: clamp(0.65rem, 1.5vw, 0.8rem);
  font-weight: 700;
  color: var(--bechtle-text);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
  line-height: 1.2;
}

.topbar-logo-subtitle {
  font-size: clamp(0.55rem, 1.2vw, 0.65rem);
  color: var(--bechtle-text-muted);
  white-space: nowrap;
  line-height: 1.2;
}

@media (max-width: 1023px) {
  .topbar-logo {
    display: flex;
  }
}

/* Auf sehr kleinen Screens (≤480px): nur Icon, kein Text */
@media (max-width: 480px) {
  .topbar-logo-text {
    display: none;
  }
  .topbar-logo-img {
    width: 26px;
    height: 26px;
  }
}

.page-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--bechtle-text);
}

.breadcrumb {
  font-size: 0.8rem;
  color: var(--bechtle-text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.breadcrumb-sep {
  opacity: 0.4;
}

/* ============================================================
   Page Body
   ============================================================ */

.page-body {
  padding: 24px;
  flex: 1;
}

/* ============================================================
   Cards
   ============================================================ */

.card {
  background: var(--bechtle-white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--bechtle-border);
  box-shadow: var(--shadow-sm);
}

.card + .card {
  margin-top: 16px;
}

.card-body {
  padding: 20px 24px;
}

.card-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--bechtle-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--bechtle-text);
}

.card-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--bechtle-border);
  background: #fafafa;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ============================================================
   Dashboard Stat Cards
   ============================================================ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bechtle-white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--bechtle-border);
  box-shadow: var(--shadow-sm);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition-smooth);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.stat-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.stat-card-icon.green {
  background: #dcfce7;
  color: #15803d;
}

.stat-card-icon.blue {
  background: #dbeafe;
  color: #1d4ed8;
}

.stat-card-icon.orange {
  background: #fef3c7;
  color: #92400e;
}

.stat-card-icon.red {
  background: #fee2e2;
  color: #991b1b;
}

.stat-card-icon.purple {
  background: #ede9fe;
  color: #5b21b6;
}

.stat-card-icon.teal {
  background: #ccfbf1;
  color: #0f766e;
}

.stat-card-info {
  flex: 1;
  min-width: 0;
}

.stat-number {
  font-size: 1.875rem;
  font-weight: 700;
  line-height: 1;
  color: var(--bechtle-text);
  letter-spacing: -0.02em;
}

.stat-label {
  font-size: 0.8125rem;
  color: var(--bechtle-text-muted);
  margin-top: 4px;
}

.stat-trend {
  font-size: 0.75rem;
  font-weight: 500;
  margin-top: 2px;
}

.stat-trend.up   { color: var(--bechtle-success); }
.stat-trend.down { color: var(--bechtle-danger); }

/* ============================================================
   Buttons
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: var(--transition-base);
  white-space: nowrap;
  text-decoration: none;
  vertical-align: middle;
  line-height: 1.4;
  letter-spacing: 0.01em;
  -webkit-user-select: none;
  user-select: none;
  min-height: 40px;
  min-width: 40px;
  touch-action: manipulation;
}

.btn:focus-visible {
  outline: 2px solid var(--bechtle-green);
  outline-offset: 2px;
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Primary */
.btn-primary {
  background: var(--bechtle-dark-green);
  color: white;
  border-color: var(--bechtle-dark-green);
}

.btn-primary:hover {
  background: #063d27;
  border-color: #063d27;
  box-shadow: 0 4px 12px rgba(7, 80, 51, 0.25);
}

.btn-primary:active {
  background: #052e1e;
}

/* Secondary */
.btn-secondary {
  background: var(--bechtle-green);
  color: white;
  border-color: var(--bechtle-green);
}

.btn-secondary:hover {
  background: #1d8f59;
  border-color: #1d8f59;
  box-shadow: 0 4px 12px rgba(35, 169, 106, 0.25);
}

.btn-secondary:active {
  background: #177a4c;
}

/* Outline */
.btn-outline {
  background: transparent;
  color: var(--bechtle-dark-green);
  border-color: var(--bechtle-dark-green);
}

.btn-outline:hover {
  background: var(--bechtle-dark-green);
  color: white;
}

/* Outline Secondary */
.btn-outline-secondary {
  background: transparent;
  color: var(--bechtle-green);
  border-color: var(--bechtle-green);
}

.btn-outline-secondary:hover {
  background: var(--bechtle-green);
  color: white;
}

/* Danger */
.btn-danger {
  background: var(--bechtle-danger);
  color: white;
  border-color: var(--bechtle-danger);
}

.btn-danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
}

.btn-danger:active {
  background: #991b1b;
}

/* Ghost */
.btn-ghost {
  background: transparent;
  color: var(--bechtle-text-muted);
  border-color: transparent;
}

.btn-ghost:hover {
  background: #f3f4f6;
  color: var(--bechtle-text);
}

/* Light */
.btn-light {
  background: #f3f4f6;
  color: var(--bechtle-text);
  border-color: var(--bechtle-border);
}

.btn-light:hover {
  background: #e5e7eb;
}

/* Sizes */
.btn-sm {
  padding: 6px 12px;
  font-size: 0.8125rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 12px 24px;
  font-size: 1rem;
  border-radius: var(--radius-lg);
  min-height: 48px;
}

.btn-icon {
  padding: 8px;
  aspect-ratio: 1;
}

.btn-icon.btn-sm {
  padding: 6px;
}

.btn-block {
  width: 100%;
  justify-content: center;
}

/* ============================================================
   Forms
   ============================================================ */

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 6px;
}

.form-label .required {
  color: var(--bechtle-danger);
  margin-left: 2px;
}

.form-control {
  display: block;
  width: 100%;
  padding: 9px 12px;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--bechtle-text);
  background: var(--bechtle-white);
  border: 1.5px solid #d1d5db;
  border-radius: var(--radius-md);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
  line-height: 1.5;
}

.form-control::placeholder {
  color: #9ca3af;
}

.form-control:focus {
  outline: none;
  border-color: var(--bechtle-green);
  box-shadow: 0 0 0 3px rgba(35, 169, 106, 0.15);
}

.form-control:disabled,
.form-control[readonly] {
  background: #f9fafb;
  color: var(--bechtle-text-muted);
  cursor: not-allowed;
}

.form-control.is-invalid {
  border-color: var(--bechtle-danger);
}

.form-control.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

.form-control.is-valid {
  border-color: var(--bechtle-success);
}

/* Select Dropdown Arrow */
select.form-control {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  padding-right: 36px;
  cursor: pointer;
}

/* Textarea */
textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

/* Checkbox & Radio */
.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.form-check-input {
  width: 16px;
  height: 16px;
  accent-color: var(--bechtle-green);
  cursor: pointer;
  flex-shrink: 0;
}

.form-check-label {
  font-size: 0.875rem;
  color: var(--bechtle-text);
  cursor: pointer;
}

.form-text {
  font-size: 0.8rem;
  color: var(--bechtle-text-muted);
  margin-top: 4px;
  line-height: 1.4;
}

.invalid-feedback {
  font-size: 0.8rem;
  color: var(--bechtle-danger);
  margin-top: 4px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-row.cols-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.form-row.cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

.form-section-title {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--bechtle-text-muted);
  margin-bottom: 12px;
  margin-top: 24px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--bechtle-border);
}

.form-section-title:first-child {
  margin-top: 0;
}

/* ============================================================
   Tables
   ============================================================ */

.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  border-radius: 10px;
  border: 1px solid var(--bechtle-border);
  background: var(--bechtle-white);
}

table.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

.table thead th {
  background: #f9fafb;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--bechtle-text-muted);
  padding: 11px 16px;
  border-bottom: 2px solid var(--bechtle-border);
  text-align: left;
  white-space: nowrap;
  position: relative;
}

.table thead th:first-child {
  border-radius: 10px 0 0 0;
}

.table thead th:last-child {
  border-radius: 0 10px 0 0;
}

.table thead th.sortable {
  cursor: pointer;
  user-select: none;
}

.table thead th.sortable:hover {
  color: var(--bechtle-text);
}

.table tbody tr {
  transition: background 0.1s ease;
}

.table tbody tr:hover {
  background: #f9fafb;
}

.table tbody td {
  padding: 13px 16px;
  font-size: 0.875rem;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: middle;
  color: var(--bechtle-text);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.table-actions .btn {
  white-space: nowrap;
}

/* Row highlighting variants */
.table tbody tr.row-warning {
  background: #fffbeb;
}

.table tbody tr.row-warning:hover {
  background: #fef3c7;
}

.table tbody tr.row-danger {
  background: #fff1f2;
}

.table tbody tr.row-danger:hover {
  background: #fee2e2;
}

/* ============================================================
   Badges
   ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.4;
  letter-spacing: 0.01em;
}

/* Asset Status Badges */
.badge-lager {
  background: #dcfce7;
  color: #15803d;
}

.badge-vergeben {
  background: #dbeafe;
  color: #1d4ed8;
}

.badge-reparatur {
  background: #fef3c7;
  color: #92400e;
}

.badge-ausgemustert {
  background: #fee2e2;
  color: #991b1b;
}

/* Role Badges */
.badge-admin {
  background: #ede9fe;
  color: #5b21b6;
}

.badge-it {
  background: #e0f2fe;
  color: #0369a1;
}

.badge-lager-role {
  background: #fef9c3;
  color: #713f12;
}

.badge-audit {
  background: #f1f5f9;
  color: #475569;
}

/* Semantic Badges */
.badge-success {
  background: #dcfce7;
  color: #15803d;
}

.badge-warning {
  background: #fef3c7;
  color: #92400e;
}

.badge-danger {
  background: #fee2e2;
  color: #991b1b;
}

.badge-info {
  background: #dbeafe;
  color: #1d4ed8;
}

.badge-secondary {
  background: #f3f4f6;
  color: #4b5563;
}

/* ============================================================
   Alerts
   ============================================================ */

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border-left: 4px solid;
  font-size: 0.875rem;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.5;
}

.alert-icon {
  flex-shrink: 0;
  margin-top: 1px;
}

.alert-content {
  flex: 1;
  min-width: 0;
}

.alert-title {
  font-weight: 600;
  margin-bottom: 2px;
}

.alert-success {
  background: #f0fdf4;
  border-color: #22c55e;
  color: #14532d;
}

.alert-danger {
  background: #fff1f2;
  border-color: #dc2626;
  color: #991b1b;
}

.alert-warning {
  background: #fffbeb;
  border-color: #f59e0b;
  color: #78350f;
}

.alert-info {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1e3a8a;
}

/* ============================================================
   Modals
   ============================================================ */

.modal-overlay,
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.modal,
.modal-box {
  background: var(--bechtle-white);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  animation: modal-slide-in 0.2s ease;
  scrollbar-width: thin;
  scrollbar-color: var(--bechtle-border) transparent;
}

/* Autocomplete Dropdown */
.autocomplete-dropdown {
  position: absolute;
  left: 0; right: 0;
  top: 100%;
  background: var(--bechtle-white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 200;
  max-height: 220px;
  overflow-y: auto;
}

.autocomplete-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.875rem;
  transition: background 0.1s;
}

.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover { background: var(--bechtle-light); }
.autocomplete-empty { padding: 10px 14px; color: var(--text-secondary); font-size: 0.875rem; }

.selected-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 10px;
  background: #d1fae5;
  color: #065f46;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}

/* Relative wrapper for dropdown positioning */
.form-group { position: relative; }

@keyframes modal-slide-in {
  from {
    opacity: 0;
    transform: translateY(-12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal::-webkit-scrollbar {
  width: 4px;
}

.modal::-webkit-scrollbar-track {
  background: transparent;
}

.modal::-webkit-scrollbar-thumb {
  background: var(--bechtle-border);
  border-radius: 99px;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--bechtle-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  background: var(--bechtle-white);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  z-index: 1;
}

.modal-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--bechtle-text);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--bechtle-border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  background: #fafafa;
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.25rem;
  color: var(--bechtle-text-muted);
  padding: 4px;
  border-radius: var(--radius-sm);
  line-height: 1;
  transition: var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
}

.modal-close:hover {
  background: #f3f4f6;
  color: var(--bechtle-text);
}

.modal-xl {
  max-width: 800px;
}

.modal-lg {
  max-width: 680px;
}

.modal-sm {
  max-width: 420px;
}

/* ============================================================
   Search & Filters
   ============================================================ */

.search-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 1rem;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 200px;
  max-width: 480px;
}

.search-input-wrapper .search-icon,
.search-input-wrapper > svg {
  position: absolute;
  left: 10px;
  color: var(--bechtle-text-muted);
  pointer-events: none;
  display: flex;
  align-items: center;
}

.search-input-wrapper .form-input,
.search-input-wrapper .search-input {
  padding-left: 34px;
  width: 100%;
}

.search-bar-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--bechtle-text-muted);
  pointer-events: none;
  z-index: 1;
  font-size: 0.875rem;
}

.filters-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  padding: 16px;
  background: var(--bechtle-white);
  border-radius: 10px;
  border: 1px solid var(--bechtle-border);
  margin-bottom: 20px;
  box-shadow: var(--shadow-xs);
}

.filters-bar select,
.filters-bar input {
  min-width: 160px;
}

.filters-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--bechtle-text-muted);
  white-space: nowrap;
}

/* ============================================================
   Filter Bar (assets.html, mitarbeiter.html)
   ============================================================ */

.filter-bar {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  align-items: end;
  padding: 16px;
  background: var(--bechtle-white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--bechtle-border);
  margin-bottom: 20px;
  box-shadow: var(--shadow-xs);
}

.filter-bar-wrap {
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.filter-search {
  grid-column: span 2;
}

.filter-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--bechtle-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.filter-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  grid-column: 1 / -1;
  padding-top: 4px;
}

.form-select {
  width: 100%;
  padding: 8px 32px 8px 12px;
  border: 1.5px solid var(--bechtle-border);
  border-radius: var(--radius-md);
  background-color: var(--bechtle-white);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  appearance: none;
  font-size: 0.875rem;
  color: var(--bechtle-text);
  cursor: pointer;
  transition: var(--transition-base);
  height: 40px;
}

.form-select:focus {
  outline: none;
  border-color: var(--bechtle-green);
  box-shadow: 0 0 0 3px rgba(7, 80, 51, 0.08);
}

.form-input {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid var(--bechtle-border);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: var(--bechtle-text);
  background: var(--bechtle-white);
  transition: var(--transition-base);
  height: 40px;
}

.form-input:focus {
  outline: none;
  border-color: var(--bechtle-green);
  box-shadow: 0 0 0 3px rgba(7, 80, 51, 0.08);
}

/* ============================================================
   Signature Pad
   ============================================================ */

.signature-wrapper {
  border: 2px dashed var(--bechtle-green);
  border-radius: var(--radius-lg);
  background: #fafafa;
  position: relative;
  overflow: hidden;
  transition: border-color 0.15s;
}

.signature-wrapper:hover {
  border-color: var(--bechtle-dark-green);
}

#signature-pad,
canvas.signature-pad {
  display: block;
  cursor: crosshair;
  touch-action: none;
  width: 100%;
  height: 200px;
}

.signature-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.signature-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bechtle-text-muted);
  font-size: 0.875rem;
  pointer-events: none;
  opacity: 0.6;
  user-select: none;
  gap: 8px;
}

/* ============================================================
   Stepper (Onboarding / Offboarding Flow)
   ============================================================ */

.stepper {
  display: flex;
  margin-bottom: 32px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  min-width: 80px;
}

.step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 16px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: #e5e7eb;
  z-index: 0;
  transition: background 0.3s ease;
}

.step.done::after {
  background: var(--bechtle-green);
}

.step-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid #d1d5db;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 600;
  background: var(--bechtle-white);
  z-index: 1;
  color: #d1d5db;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.step.active .step-circle {
  border-color: var(--bechtle-dark-green);
  color: var(--bechtle-dark-green);
  box-shadow: 0 0 0 4px rgba(7, 80, 51, 0.12);
}

.step.done .step-circle {
  border-color: var(--bechtle-green);
  background: var(--bechtle-green);
  color: white;
}

.step-label {
  font-size: 0.75rem;
  margin-top: 6px;
  color: var(--bechtle-text-muted);
  text-align: center;
  line-height: 1.3;
  transition: color 0.15s;
}

.step.active .step-label {
  color: var(--bechtle-dark-green);
  font-weight: 600;
}

.step.done .step-label {
  color: var(--bechtle-green);
  font-weight: 500;
}

/* ============================================================
   Activity Feed
   ============================================================ */

/* ── Offboarding List ─────────────────────────────────────────────────── */
.offboarding-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.offboarding-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-color);
  transition: background 0.15s;
}

.offboarding-item:last-child {
  border-bottom: none;
}

.offboarding-item:hover {
  background: #fafafa;
}

.offboarding-item.urgent {
  background: #fff5f5;
  border-left: 3px solid var(--bechtle-danger);
}

.offboarding-item.soon {
  background: #fffbf0;
  border-left: 3px solid var(--bechtle-warning);
}

.offboarding-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.offboarding-name {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-primary);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.offboarding-name:hover {
  color: var(--bechtle-green);
}

.offboarding-date {
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.days-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 0.68rem;
  font-weight: 600;
  margin-left: 4px;
}

.urgent-badge {
  background: #fee2e2;
  color: #b91c1c;
}

.soon-badge {
  background: #fef3c7;
  color: #92400e;
}

.btn-offboard {
  background: var(--bechtle-warning);
  color: #fff;
  border: none;
  white-space: nowrap;
  flex-shrink: 0;
  font-size: 0.75rem;
  padding: 5px 10px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
  text-decoration: none;
  transition: opacity 0.15s;
}

.btn-offboard:hover {
  opacity: 0.85;
  color: #fff;
}

/* ── Activity List ────────────────────────────────────────────────────── */
.activity-list {
  list-style: none;
}

.activity-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #f3f4f6;
  align-items: flex-start;
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bechtle-green);
  flex-shrink: 0;
  margin-top: 6px;
}

.activity-dot.red    { background: var(--bechtle-danger); }
.activity-dot.orange { background: var(--bechtle-warning); }
.activity-dot.blue   { background: var(--bechtle-info); }
.activity-dot.gray   { background: #9ca3af; }

.activity-text {
  font-size: 0.875rem;
  flex: 1;
  line-height: 1.5;
}

.activity-text strong {
  font-weight: 600;
}

.activity-time {
  font-size: 0.75rem;
  color: var(--bechtle-text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 2px;
}

/* ============================================================
   Empty State
   ============================================================ */

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--bechtle-text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
  display: block;
}

.empty-state-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--bechtle-text);
  margin-bottom: 8px;
}

.empty-state-text {
  font-size: 0.875rem;
  max-width: 360px;
  margin: 0 auto 20px;
  line-height: 1.6;
}

/* ============================================================
   Login Page
   ============================================================ */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bechtle-dark-green);
  background-image:
    radial-gradient(ellipse at top left, rgba(35, 169, 106, 0.2) 0%, transparent 50%),
    radial-gradient(ellipse at bottom right, rgba(35, 169, 106, 0.1) 0%, transparent 50%);
  padding: 24px;
}

.login-box {
  background: var(--bechtle-white);
  border-radius: var(--radius-xl);
  padding: 48px 48px 40px;
  width: 100%;
  max-width: 480px;
  min-width: 320px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
  animation: modal-slide-in 0.25s ease;
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.login-logo-img {
  width: 72px;
  height: 72px;
  object-fit: contain;
}

.login-logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background: var(--bechtle-dark-green);
  border-radius: 14px;
  font-size: 1.75rem;
  margin-bottom: 12px;
}

.login-logo-text {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--bechtle-dark-green);
  letter-spacing: -0.02em;
  line-height: 1;
}

.login-logo-subtitle {
  font-size: 0.8rem;
  color: var(--bechtle-text-muted);
  margin-top: 4px;
}

.login-title {
  font-size: 1.35rem;
  font-weight: 600;
  margin-bottom: 8px;
  text-align: center;
  color: var(--bechtle-text);
  white-space: nowrap;
}

.login-subtitle {
  font-size: 0.875rem;
  color: var(--bechtle-text-muted);
  text-align: center;
  margin-bottom: 28px;
}

.login-wordmark {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--bechtle-dark-green);
  display: block;
  text-align: center;
  margin-bottom: 4px;
}

.login-footer {
  margin-top: 24px;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--bechtle-text-muted);
}

.login-flash-container {
  margin-bottom: 16px;
}

/* ============================================================
   Pagination
   ============================================================ */

.pagination {
  display: flex;
  gap: 4px;
  align-items: center;
  justify-content: center;
  margin-top: 24px;
  flex-wrap: wrap;
}

.page-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  cursor: pointer;
  border: 1.5px solid var(--bechtle-border);
  background: var(--bechtle-white);
  color: var(--bechtle-text);
  text-decoration: none;
  transition: var(--transition-base);
  font-weight: 500;
  user-select: none;
}

.page-btn.active {
  background: var(--bechtle-dark-green);
  color: white;
  border-color: var(--bechtle-dark-green);
  box-shadow: 0 2px 6px rgba(7, 80, 51, 0.2);
}

.page-btn:hover:not(.active) {
  background: #f3f4f6;
  border-color: #d1d5db;
}

.page-btn:disabled,
.page-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.pagination-info {
  font-size: 0.8125rem;
  color: var(--bechtle-text-muted);
  text-align: center;
  margin-top: 8px;
}

/* ============================================================
   Inventur-specific
   ============================================================ */

.inventur-row td input[type="number"] {
  width: 80px;
  text-align: center;
  padding: 6px 8px;
}

.diff-positive {
  color: var(--bechtle-success);
  font-weight: 600;
}

.diff-negative {
  color: var(--bechtle-danger);
  font-weight: 600;
}

.diff-zero {
  color: var(--bechtle-text-muted);
}

/* ============================================================
   Spinner
   ============================================================ */

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

.spinner-sm {
  width: 14px;
  height: 14px;
  border-width: 1.5px;
}

.spinner-lg {
  width: 32px;
  height: 32px;
  border-width: 3px;
}

.spinner-dark {
  border-color: rgba(7, 80, 51, 0.2);
  border-top-color: var(--bechtle-dark-green);
}

.spinner-green {
  border-color: rgba(35, 169, 106, 0.2);
  border-top-color: var(--bechtle-green);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
  z-index: 10;
  backdrop-filter: blur(1px);
}

/* ============================================================
   Section Headers / Page Toolbar
   ============================================================ */

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.section-header-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--bechtle-text);
}

.section-subtitle {
  font-size: 0.8125rem;
  color: var(--bechtle-text-muted);
}

.section-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ============================================================
   Progress Bar
   ============================================================ */

.progress {
  width: 100%;
  height: 6px;
  background: #e5e7eb;
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--bechtle-green);
  border-radius: var(--radius-pill);
  transition: width 0.4s ease;
}

.progress-bar.danger  { background: var(--bechtle-danger); }
.progress-bar.warning { background: var(--bechtle-warning); }
.progress-bar.info    { background: var(--bechtle-info); }

/* ============================================================
   Tabs
   ============================================================ */

.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--bechtle-border);
  margin-bottom: 20px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--bechtle-text-muted);
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: var(--transition-base);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.tab-btn:hover {
  color: var(--bechtle-text);
  background: #f9fafb;
}

.tab-btn.active {
  color: var(--bechtle-dark-green);
  border-bottom-color: var(--bechtle-dark-green);
  font-weight: 600;
}

.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: #f3f4f6;
  color: var(--bechtle-text-muted);
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 600;
}

.tab-btn.active .tab-count {
  background: rgba(7, 80, 51, 0.12);
  color: var(--bechtle-dark-green);
}

/* ============================================================
   Info List (Detail Views)
   ============================================================ */

.info-list {
  display: grid;
  gap: 0;
}

.info-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: 0.875rem;
  align-items: start;
}

.info-row:last-child {
  border-bottom: none;
}

.info-label {
  font-weight: 500;
  color: var(--bechtle-text-muted);
  flex-shrink: 0;
}

.info-value {
  color: var(--bechtle-text);
  word-break: break-word;
}

/* ============================================================
   Dropdown Menu
   ============================================================ */

.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--bechtle-white);
  border: 1px solid var(--bechtle-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  z-index: 200;
  overflow: hidden;
  animation: dropdown-in 0.12s ease;
}

@keyframes dropdown-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  font-size: 0.875rem;
  color: var(--bechtle-text);
  cursor: pointer;
  transition: background 0.1s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.dropdown-item:hover {
  background: #f9fafb;
}

.dropdown-item.danger {
  color: var(--bechtle-danger);
}

.dropdown-item.danger:hover {
  background: #fff1f2;
}

.dropdown-divider {
  height: 1px;
  background: var(--bechtle-border);
  margin: 4px 0;
}

/* ============================================================
   Avatar
   ============================================================ */

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 600;
  flex-shrink: 0;
  background: var(--bechtle-green);
  color: white;
  font-size: 0.875rem;
  width: 36px;
  height: 36px;
  letter-spacing: 0.02em;
}

.avatar-sm {
  width: 28px;
  height: 28px;
  font-size: 0.75rem;
}

.avatar-lg {
  width: 48px;
  height: 48px;
  font-size: 1.125rem;
}

.avatar-xl {
  width: 64px;
  height: 64px;
  font-size: 1.5rem;
}

/* ============================================================
   Tooltip
   ============================================================ */

[data-tooltip] {
  position: relative;
  cursor: default;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a2e;
  color: white;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 999;
}

[data-tooltip]:hover::after {
  opacity: 1;
}

/* ============================================================
   Utility Classes
   ============================================================ */

/* Text colors */
.text-muted    { color: var(--bechtle-text-muted) !important; }
.text-success  { color: var(--bechtle-success) !important; }
.text-danger   { color: var(--bechtle-danger) !important; }
.text-warning  { color: var(--bechtle-warning) !important; }
.text-info     { color: var(--bechtle-info) !important; }
.text-white    { color: white !important; }
.text-dark     { color: var(--bechtle-text) !important; }
.text-green    { color: var(--bechtle-green) !important; }

/* Font weights */
.fw-bold    { font-weight: 700 !important; }
.fw-medium  { font-weight: 500 !important; }
.fw-semibold { font-weight: 600 !important; }
.fw-normal  { font-weight: 400 !important; }

/* Text alignment */
.text-center { text-align: center !important; }
.text-right  { text-align: right !important; }
.text-left   { text-align: left !important; }

/* Margin Bottom */
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 4px !important; }
.mb-2 { margin-bottom: 8px !important; }
.mb-3 { margin-bottom: 16px !important; }
.mb-4 { margin-bottom: 24px !important; }
.mb-5 { margin-bottom: 32px !important; }

/* Margin Top */
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 4px !important; }
.mt-2 { margin-top: 8px !important; }
.mt-3 { margin-top: 16px !important; }
.mt-4 { margin-top: 24px !important; }
.mt-5 { margin-top: 32px !important; }

/* Margin Start/End */
.ms-auto { margin-left: auto !important; }
.me-auto  { margin-right: auto !important; }

/* Padding */
.p-0 { padding: 0 !important; }
.p-1 { padding: 4px !important; }
.p-2 { padding: 8px !important; }
.p-3 { padding: 16px !important; }
.p-4 { padding: 24px !important; }

/* Display */
.d-flex        { display: flex !important; }
/* Filter-Hilfklasse: schlägt d-flex !important durch höhere Spezifität */
.ma-row.ma-row-hidden { display: none !important; }
.d-inline-flex { display: inline-flex !important; }
.d-block       { display: block !important; }
.d-inline      { display: inline !important; }
.d-none        { display: none !important; }
.d-grid        { display: grid !important; }

/* Flexbox */
.flex-1           { flex: 1 !important; }
.flex-column      { flex-direction: column !important; }
.flex-wrap        { flex-wrap: wrap !important; }
.align-center     { align-items: center !important; }
.align-start      { align-items: flex-start !important; }
.align-end        { align-items: flex-end !important; }
.justify-center   { justify-content: center !important; }
.justify-between  { justify-content: space-between !important; }
.justify-end      { justify-content: flex-end !important; }
.justify-start    { justify-content: flex-start !important; }

/* Gap */
.gap-1 { gap: 4px !important; }
.gap-2 { gap: 8px !important; }
.gap-3 { gap: 12px !important; }
.gap-4 { gap: 16px !important; }
.gap-5 { gap: 24px !important; }

/* Width / Height */
.w-100 { width: 100% !important; }
.w-auto { width: auto !important; }
.h-100 { height: 100% !important; }

/* Border radius */
.rounded    { border-radius: var(--radius-md) !important; }
.rounded-lg { border-radius: var(--radius-lg) !important; }
.rounded-xl { border-radius: var(--radius-xl) !important; }
.rounded-pill { border-radius: var(--radius-pill) !important; }

/* Overflow */
.overflow-hidden { overflow: hidden !important; }
.overflow-auto   { overflow: auto !important; }

/* Position */
.position-relative { position: relative !important; }
.position-absolute { position: absolute !important; }

/* Misc */
.cursor-pointer { cursor: pointer !important; }
.user-select-none { user-select: none !important; }
.whitespace-nowrap { white-space: nowrap !important; }

/* ============================================================
   Responsive Breakpoints
   ============================================================ */

@media (max-width: 1024px) {
  .form-row.cols-4 {
    grid-template-columns: 1fr 1fr;
  }

  .form-row.cols-3 {
    grid-template-columns: 1fr 1fr;
  }

  .filter-search {
    grid-column: span 1;
  }
}

/* Sidebar/layout: hide sidebar below 1024px (tablet + phone) */
@media (max-width: 1023px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: var(--shadow-xl);
  }

  .main-wrapper {
    margin-left: 0;
    width: 100%;
  }

  .mobile-menu-btn {
    display: flex;
  }
}

@media (max-width: 768px) {
  .main-content {
    padding: 16px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .form-row.cols-3 {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .topbar {
    padding: 0 16px;
    gap: 8px;
  }

  .topbar-right {
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .topbar-right .btn {
    font-size: 0.8rem;
    padding: 6px 10px;
  }

  .page-body {
    padding: 16px;
  }

  .modal {
    max-width: 100%;
    margin: 0;
    border-radius: var(--radius-lg);
  }

  .modal-xl,
  .modal-lg {
    max-width: 100%;
  }

  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal-overlay .modal {
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    max-height: 95vh;
  }

  .modal-header {
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  }

  .info-row {
    grid-template-columns: 130px 1fr;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .section-header-right {
    width: 100%;
  }

  .login-box {
    padding: 36px 28px;
    min-width: unset;
  }

  /* Tables scrollable on mobile */
  .table-wrapper,
  .card-body.p-0 {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table {
    min-width: 520px;
  }

  /* Card header stacks on small screens */
  .card-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Filter bar stacks on mobile */
  .filter-bar {
    grid-template-columns: 1fr;
  }

  .filter-search {
    grid-column: span 1;
  }

  .filter-actions {
    justify-content: stretch;
  }

  .filter-actions .btn {
    flex: 1;
    justify-content: center;
  }

  /* Detail grid responsive */
  .detail-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .filters-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .filters-bar select,
  .filters-bar input {
    width: 100%;
    min-width: unset;
  }

  .info-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .modal-footer {
    flex-direction: column-reverse;
  }

  .modal-footer .btn {
    width: 100%;
    justify-content: center;
  }

  .topbar {
    height: auto;
    min-height: 56px;
    padding: 8px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .page-title {
    font-size: 0.95rem;
  }

  .stat-number {
    font-size: 1.5rem;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .stepper {
    gap: 4px;
  }

  .step-label {
    font-size: 0.7rem;
  }
}

/* Mobile overlay for sidebar */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 99;
  display: none;
}

.sidebar-overlay.active {
  display: block;
}

/* Mobile menu toggle button */
.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--radius-md);
  color: var(--bechtle-text);
  font-size: 1.25rem;
  transition: var(--transition-base);
}

.mobile-menu-btn:hover {
  background: #f3f4f6;
}

/* Hamburger zeigt sich immer wenn Sidebar versteckt ist */
@media (max-width: 1023px) {
  .mobile-menu-btn {
    display: flex;
  }
}

/* ============================================================
   Handbuch Styles
   ============================================================ */

.chapter-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--bechtle-dark-green);
  color: white;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}
.handbuch-step {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  align-items: flex-start;
}
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: var(--bechtle-green);
  color: white;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}
.handbuch-tip {
  background: #f0f9f4;
  border-left: 3px solid var(--bechtle-green);
  padding: 12px 16px;
  border-radius: 0 8px 8px 0;
  font-size: 0.875rem;
  margin: 12px 0;
}
.role-table th { background: var(--bechtle-dark-green); color: white; }

/* ============================================================
   Print Styles
   ============================================================ */

/* ── Global Search ───────────────────────────────────────────── */
.topbar-search { display: flex; align-items: center; }
.topbar-search-wrap {
  display: flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius-pill);
  padding: 5px 12px;
  transition: var(--transition-base);
}
.topbar-search-wrap:focus-within {
  background: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.4);
}
.topbar-search-input {
  background: transparent; border: none; outline: none;
  color: white; font-size: 0.8rem; width: 150px;
  font-family: 'BechtlePro', sans-serif;
  transition: width 0.2s ease;
}
.topbar-search-input:focus { width: 220px; }
.topbar-search-input::placeholder { color: rgba(255,255,255,0.55); }
.topbar-search-wrap svg { color: rgba(255,255,255,0.7); flex-shrink:0; }
@media (max-width: 768px) {
  .topbar-search { display: none; }
}

@media print {
  .sidebar,
  .topbar,
  .btn,
  .filters-bar,
  .pagination {
    display: none !important;
  }

  .main-wrapper {
    margin-left: 0;
    width: 100%;
  }

  .main-content {
    padding: 0;
  }

  .page-body {
    padding: 0;
  }

  .card {
    border: 1px solid #ccc;
    box-shadow: none;
    break-inside: avoid;
  }

  body {
    background: white;
    font-size: 12px;
  }

  .table tbody tr:hover {
    background: transparent;
  }
}

/* ── Toast Notifications ─────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  font-size: 0.95rem;
  font-weight: 500;
  min-width: 300px;
  max-width: 520px;
  pointer-events: all;
  animation: toastIn 0.35s cubic-bezier(.21,1.02,.73,1) forwards;
}

.toast-hide {
  animation: toastOut 0.4s ease forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-16px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(-10px) scale(0.96); }
}

.toast-success { background: #1a4731; color: #fff; }
.toast-error,
.toast-danger  { background: #7f1d1d; color: #fff; }
.toast-warning { background: #78350f; color: #fff; }
.toast-info,
.toast-message { background: #1e3a5f; color: #fff; }

.toast-icon { flex-shrink: 0; opacity: 0.9; }
.toast-text { flex: 1; line-height: 1.4; }

.toast-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  flex-shrink: 0;
}
.toast-close:hover { color: #fff; }

/* ── Übergabe Action Cards ───────────────────────────────── */
.action-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
}
.action-card-title svg {
  flex-shrink: 0;
  color: var(--bechtle-green);
}

/* ============================================================
   RESPONSIVE v2 — Tablet, iPad, iPhone
   ============================================================ */

/* ── Tablet (641px – 1023px): iPad mini bis iPad Pro Portrait ─ */
@media (min-width: 641px) and (max-width: 1023px) {
  .main-content {
    padding: 20px;
  }

  /* Stats: 2-spaltig auf Tablet */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  /* Formulare: 2-spaltig */
  .form-row.cols-3,
  .form-row.cols-4 {
    grid-template-columns: 1fr 1fr;
  }

  /* Topbar: etwas kompakter */
  .topbar {
    padding: 0 20px;
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
  }

  .topbar-right .btn {
    font-size: 0.85rem;
    padding: 8px 14px;
  }

  /* Detail-Grid 2-spaltig */
  .detail-grid {
    grid-template-columns: 1fr 1fr;
  }

  /* Card-Padding etwas kleiner */
  .card-body {
    padding: 16px 20px;
  }

  .card-header {
    padding: 14px 20px;
  }
}

/* ── Phone (≤ 640px): iPhone SE bis iPhone Plus ─────────────── */
@media (max-width: 640px) {
  /* Safe areas für iPhone Notch / Dynamic Island */
  .topbar {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }

  .sidebar {
    padding-bottom: env(safe-area-inset-bottom);
  }

  /* Fluid Page Title */
  .page-title {
    font-size: clamp(0.85rem, 3.5vw, 1.05rem);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 45vw;
  }

  /* Topbar Actions: Icon + verkürzt */
  .topbar-right {
    gap: 4px;
  }

  .topbar-right .btn-text {
    display: none;
  }

  .topbar-right .btn {
    padding: 8px 10px;
    min-width: 44px;
    font-size: 0.8rem;
  }

  /* Sidebar Nav: größere Touch-Targets */
  .sidebar-nav a {
    min-height: 48px;
    padding: 12px 16px;
    font-size: 0.9rem;
  }

  /* Stats: 2-spaltig auf kleinen Screens */
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .stat-card {
    padding: 14px;
  }

  .stat-number {
    font-size: 1.6rem;
  }

  /* Cards kompakter */
  .card-body {
    padding: 12px 16px;
  }

  .card-header {
    padding: 10px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Card-Title etwas kleiner */
  .card-title {
    font-size: 0.875rem;
  }

  /* Stepper: Labels ausblenden auf sehr kleinen Screens */
  .step-label {
    font-size: clamp(0.6rem, 2.5vw, 0.75rem);
  }

  .step-circle {
    width: 28px;
    height: 28px;
    font-size: 0.75rem;
  }

  /* Filter-Bar: alles einspaltig */
  .filter-bar,
  .filters-bar {
    grid-template-columns: 1fr;
    flex-direction: column;
    gap: 8px;
  }

  .filter-actions {
    justify-content: stretch;
  }

  .filter-actions .btn {
    flex: 1;
    justify-content: center;
  }

  /* Formulare einspaltig */
  .form-row,
  .form-row.cols-2,
  .form-row.cols-3,
  .form-row.cols-4 {
    grid-template-columns: 1fr;
  }

  /* Formular-Inputs volle Breite */
  .form-input,
  .form-select {
    font-size: 16px; /* verhindert iOS Auto-Zoom */
  }

  /* Modal: Sheet von unten */
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal-overlay .modal {
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    max-height: 95dvh;
    overflow-y: auto;
  }

  .modal-header {
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    position: sticky;
    top: 0;
    background: var(--bechtle-white);
    z-index: 1;
  }

  .modal-footer {
    position: sticky;
    bottom: 0;
    background: var(--bechtle-white);
    border-top: 1px solid var(--bechtle-border);
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }

  /* Modal-Buttons volle Breite */
  .modal-footer .btn {
    flex: 1;
    justify-content: center;
  }

  /* Tabellen: Scroll-Indikator */
  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
  }

  /* Login: volle Breite */
  .login-box {
    width: 100%;
    min-width: unset;
    padding: 28px 20px;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  }

  /* Detail-Grid 1-spaltig */
  .detail-grid {
    grid-template-columns: 1fr;
  }

  /* Info-Row 1-spaltig */
  .info-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  /* Section-Header stapelt */
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .section-header-right {
    width: 100%;
  }

  /* Handbuch: Chapter-Num kleiner */
  .chapter-num {
    width: 32px;
    height: 32px;
    font-size: 0.75rem;
    flex-shrink: 0;
  }
}

/* ── iPhone SE und sehr kleine Geräte (≤ 390px) ─────────────── */
@media (max-width: 390px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .topbar-right .btn {
    padding: 6px 8px;
    min-width: 40px;
  }

  .page-title {
    max-width: 35vw;
  }
}

/* ── Landscape-Optimierungen für Phone ───────────────────────── */
@media (max-width: 768px) and (orientation: landscape) {
  .sidebar {
    overflow-y: auto;
  }

  .modal-overlay .modal {
    max-height: 90dvh;
  }
}
