:root {
  /* ========================================================== */
  /* MATERIAL DESIGN 3 (M3) DESIGN TOKENS                       */
  /* ========================================================== */

  /* M3 Surface & Tonal Palette (Dark Theme) */
  --md-sys-color-surface: #0b1120;
  --md-sys-color-surface-dim: #070d18;
  --md-sys-color-surface-bright: #1e293b;
  --md-sys-color-surface-container-lowest: #050811;
  --md-sys-color-surface-container-low: #0f172a;
  --md-sys-color-surface-container: #131d31;
  --md-sys-color-surface-container-high: #182339;
  --md-sys-color-surface-container-highest: #1e2c47;
  --md-sys-color-on-surface: #f8fafc;
  --md-sys-color-on-surface-variant: #cbd5e1;
  --md-sys-color-outline: rgba(255, 255, 255, 0.12);
  --md-sys-color-outline-variant: rgba(255, 255, 255, 0.06);

  /* M3 Primary, Secondary, Tertiary & Accent Colors */
  --md-sys-color-primary: #f59e0b;
  --md-sys-color-on-primary: #1e1b18;
  --md-sys-color-primary-container: rgba(245, 158, 11, 0.18);
  --md-sys-color-on-primary-container: #fbbf24;

  --md-sys-color-secondary: #38bdf8;
  --md-sys-color-on-secondary: #082f49;
  --md-sys-color-secondary-container: rgba(56, 189, 248, 0.15);
  --md-sys-color-on-secondary-container: #7dd3fc;

  --md-sys-color-tertiary: #2dd4bf;
  --md-sys-color-on-tertiary: #042f2e;
  --md-sys-color-tertiary-container: rgba(45, 212, 191, 0.15);
  --md-sys-color-on-tertiary-container: #5eead4;

  --md-sys-color-error: #ef4444;
  --md-sys-color-on-error: #450a0a;
  --md-sys-color-error-container: rgba(239, 68, 68, 0.18);
  --md-sys-color-on-error-container: #fca5a5;

  /* M3 Shape Hierarchy */
  --md-sys-shape-none: 0px;
  --md-sys-shape-xs: 4px;
  --md-sys-shape-sm: 8px;
  --md-sys-shape-md: 12px;
  --md-sys-shape-lg: 16px;
  --md-sys-shape-xl: 28px;
  --md-sys-shape-full: 9999px;

  /* M3 Elevation (DP Shadows) */
  --md-sys-elevation-level0: none;
  --md-sys-elevation-level1: 0 1px 3px 1px rgba(0, 0, 0, 0.25), 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --md-sys-elevation-level2: 0 2px 6px 2px rgba(0, 0, 0, 0.3), 0 1px 2px 0 rgba(0, 0, 0, 0.35);
  --md-sys-elevation-level3: 0 4px 12px 3px rgba(0, 0, 0, 0.35), 0 1px 3px 0 rgba(0, 0, 0, 0.4);
  --md-sys-elevation-level4: 0 6px 16px 4px rgba(0, 0, 0, 0.4), 0 2px 4px 0 rgba(0, 0, 0, 0.45);
  --md-sys-elevation-level5: 0 8px 24px 6px rgba(0, 0, 0, 0.5), 0 4px 8px 0 rgba(0, 0, 0, 0.55);

  /* M3 Motion & Easing */
  --md-sys-motion-easing-standard: cubic-bezier(0.2, 0, 0, 1);
  --md-sys-motion-easing-emphasized: cubic-bezier(0.2, 0, 0, 1.2);
  --md-sys-motion-duration-short: 150ms;
  --md-sys-motion-duration-medium: 250ms;
  --md-sys-motion-duration-long: 400ms;

  /* M3 Typography Tokens */
  --md-sys-typescale-display-large: 800 2.25rem/1.2 'Plus Jakarta Sans', sans-serif;
  --md-sys-typescale-headline-medium: 700 1.5rem/1.3 'Plus Jakarta Sans', sans-serif;
  --md-sys-typescale-title-large: 700 1.25rem/1.35 'Plus Jakarta Sans', sans-serif;
  --md-sys-typescale-title-medium: 600 1rem/1.4 'Plus Jakarta Sans', sans-serif;
  --md-sys-typescale-body-large: 400 1rem/1.5 'Plus Jakarta Sans', sans-serif;
  --md-sys-typescale-body-medium: 400 0.875rem/1.5 'Plus Jakarta Sans', sans-serif;
  --md-sys-typescale-label-large: 600 0.875rem/1.2 'Plus Jakarta Sans', sans-serif;
  --md-sys-typescale-label-medium: 600 0.75rem/1.2 'Plus Jakarta Sans', sans-serif;
  --md-sys-typescale-code: 500 0.875rem/1.4 'JetBrains Mono', monospace;

  /* ========================================================== */
  /* LEGACY BRIDGE MAPPINGS (Ensures 100% zero-regression)     */
  /* ========================================================== */
  --bg-darkest: var(--md-sys-color-surface-dim);
  --bg-dark: var(--md-sys-color-surface);
  --bg-surface: var(--md-sys-color-surface-container);
  --bg-card: var(--md-sys-color-surface-container-high);
  --bg-card-hover: var(--md-sys-color-surface-container-highest);
  --bg-input: var(--md-sys-color-surface-container-lowest);
  --border-subtle: var(--md-sys-color-outline-variant);
  --border-focus: rgba(245, 158, 11, 0.5);
  
  --amber-primary: #d97706;
  --amber-light: var(--md-sys-color-primary);
  --amber-glow: var(--md-sys-color-primary-container);
  --gradient-amber: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #d97706 100%);
  --shadow-amber: 0 6px 20px rgba(245, 158, 11, 0.45);
  --blue-sky: var(--md-sys-color-secondary);
  --blue-dark: #0284c7;
  --blue-glow: var(--md-sys-color-secondary-container);
  --green-success: #10b981;
  --green-glow: var(--md-sys-color-tertiary-container);
  --red-danger: var(--md-sys-color-error);
  --red-glow: var(--md-sys-color-error-container);
  --purple-accent: #a855f7;

  --text-main: var(--md-sys-color-on-surface);
  --text-secondary: var(--md-sys-color-on-surface-variant);
  --text-muted: #8292a9;
  --text-dim: #54657e;

  --radius-sm: var(--md-sys-shape-sm);
  --radius-md: var(--md-sys-shape-md);
  --radius-lg: var(--md-sys-shape-lg);
  --radius-full: var(--md-sys-shape-full);
  --shadow-sm: var(--md-sys-elevation-level1);
  --shadow-md: var(--md-sys-elevation-level2);
  --shadow-lg: var(--md-sys-elevation-level3);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Custom Sleek Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-darkest);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-card-hover);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--amber-primary);
}

/* Universal Utility Classes */
.hidden {
  display: none !important;
}

/* ========================================================== */
/* HEADER & TOP COMMAND BAR (MATERIAL DESIGN 3)              */
/* ========================================================== */
.app-header {
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 20px;
  box-shadow: var(--md-sys-elevation-level1);
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.logo-icon {
  background: linear-gradient(135deg, var(--md-sys-color-primary), #d97706);
  color: #0b1120;
  width: 40px;
  height: 40px;
  border-radius: var(--md-sys-shape-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
}

.logo-icon i,
.logo-icon svg {
  width: 22px;
  height: 22px;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-title {
  font-size: 1.18rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #ffffff;
  line-height: 1.1;
}

.version-badge {
  font-size: 0.65rem;
  font-weight: 800;
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-primary);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 2px 6px;
  border-radius: var(--md-sys-shape-xs);
}

.app-subtitle {
  font-size: 0.74rem;
  color: var(--md-sys-color-on-surface-variant);
  font-weight: 500;
}

/* Header Center Command Search Button (M3 Search Bar Style) */
.header-center {
  flex: 1;
  max-width: 520px;
}

.command-search-btn {
  width: 100%;
  background: var(--md-sys-color-surface-container-high);
  border: 1px solid var(--md-sys-color-outline-variant);
  color: var(--md-sys-color-on-surface-variant);
  padding: 10px 18px;
  border-radius: var(--md-sys-shape-full);
  font-size: 0.88rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard);
  box-shadow: var(--md-sys-elevation-level1);
}

.command-search-btn:hover {
  background: var(--md-sys-color-surface-container-highest);
  border-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-surface);
  box-shadow: 0 0 0 1px var(--md-sys-color-primary);
}

.cmd-icon {
  width: 18px;
  height: 18px;
  color: var(--md-sys-color-primary);
  margin-right: 10px;
}

.cmd-btn-text {
  flex: 1;
  text-align: left;
}

.shortcut-key {
  background: var(--md-sys-color-surface-container-lowest);
  border: 1px solid var(--md-sys-color-outline);
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--md-sys-shape-sm);
  font-family: 'JetBrains Mono', monospace;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.sync-badge {
  background: var(--md-sys-color-surface-container-high);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-full);
  padding: 5px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--md-sys-color-secondary);
}

.sync-dot {
  width: 8px;
  height: 8px;
  background-color: var(--md-sys-color-secondary);
  border-radius: var(--md-sys-shape-full);
  box-shadow: 0 0 8px var(--md-sys-color-secondary);
}

.quick-create-dropdown {
  position: relative;
}

.btn-quick-action {
  padding: 9px 18px !important;
  font-weight: 700;
  border-radius: var(--md-sys-shape-full) !important;
  box-shadow: var(--md-sys-elevation-level2);
}

.quick-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--md-sys-color-surface-container-high);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-lg);
  box-shadow: var(--md-sys-elevation-level3);
  width: 250px;
  overflow: hidden;
  z-index: 100;
}

.quick-dropdown-menu.hidden {
  display: none;
}

.quick-menu-item {
  width: 100%;
  background: none;
  border: none;
  color: var(--md-sys-color-on-surface);
  padding: 12px 16px;
  text-align: left;
  font-size: 0.86rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: background var(--md-sys-motion-duration-short) ease;
}

.quick-menu-item:hover {
  background: var(--md-sys-color-surface-container-highest);
  color: var(--md-sys-color-primary);
}

.quick-menu-item i,
.quick-menu-item svg {
  width: 17px;
  height: 17px;
  color: var(--md-sys-color-primary);
}

/* ========================================================== */
/* NAVIGATION BAR (MATERIAL DESIGN 3 PILL SEGMENTED BAR)     */
/* ========================================================== */
.nav-tabs-bar {
  background: var(--md-sys-color-surface-container-lowest);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  padding: 8px 24px;
}

.nav-tabs-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  align-items: center;
}

.nav-tab-btn {
  background: transparent;
  border: none;
  color: var(--md-sys-color-on-surface-variant);
  padding: 9px 18px;
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  border-radius: var(--md-sys-shape-full);
  transition: all var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-standard);
  white-space: nowrap;
}

.nav-tab-btn i,
.nav-tab-btn svg {
  width: 18px;
  height: 18px;
  transition: transform var(--md-sys-motion-duration-short) ease;
}

.nav-tab-btn:hover {
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
}

.nav-tab-btn.active {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.4);
}

.nav-tab-btn.active i,
.nav-tab-btn.active svg {
  transform: scale(1.08);
  color: var(--md-sys-color-primary);
}

.tab-badge {
  background: var(--md-sys-color-surface-container-highest);
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: var(--md-sys-shape-full);
  border: 1px solid var(--md-sys-color-outline-variant);
  transition: all var(--md-sys-motion-duration-short) ease;
}

.nav-tab-btn.active .tab-badge {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  border-color: transparent;
}

.tab-badge.info {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  border-color: rgba(56, 189, 248, 0.3);
}

/* ========================================================== */
/* MAIN CONTAINER & VIEWPORT */
/* ========================================================== */
.app-container {
  flex: 1;
  padding: 20px;
  max-width: 100%;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  margin: 0 auto;
}

.tab-view {
  animation: fadeIn 0.2s ease-out;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.tab-view.hidden {
  display: none !important;
}

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

/* Header Action Bars */
.view-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.view-heading {
  font-size: 1.4rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.02em;
}

.view-subheading {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.header-action-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Pixel-Perfect Aligned Search Input Wrapper */
.search-input-wrapper {
  position: relative;
  min-width: 280px;
  display: flex;
  align-items: center;
}

.search-input-wrapper i,
.search-input-wrapper svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input-wrapper input {
  width: 100%;
  padding-left: 36px !important;
  height: 38px;
}

/* Segmented Filter Row (Material Design 3) */
.segmented-filter-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  gap: 14px;
  flex-wrap: wrap;
}

.segmented-control {
  display: inline-flex;
  background: var(--md-sys-color-surface-container);
  padding: 4px;
  border-radius: var(--md-sys-shape-full);
  border: 1px solid var(--md-sys-color-outline-variant);
  overflow-x: auto;
  max-width: 100%;
  align-items: center;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.segmented-control::-webkit-scrollbar {
  display: none;
}

.seg-btn {
  background: transparent;
  border: none;
  color: var(--md-sys-color-on-surface-variant);
  padding: 7px 18px;
  border-radius: var(--md-sys-shape-full);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard);
  white-space: nowrap;
}

.seg-btn:hover {
  color: var(--md-sys-color-on-surface);
  background: var(--md-sys-color-surface-container-high);
}

.seg-btn.active {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  font-weight: 700;
  box-shadow: var(--md-sys-elevation-level1);
}

.seg-btn.seg-danger.active {
  background: var(--md-sys-color-error-container);
  color: var(--md-sys-color-on-error-container);
}

.seg-btn.seg-success.active {
  background: var(--md-sys-color-tertiary-container);
  color: var(--md-sys-color-on-tertiary-container);
}

/* Edge-Fade Container for Scrollable Navigation Bars */
.scroll-fade-container {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  max-width: 100%;
}

.scroll-fade-container::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 48px;
  background: linear-gradient(to right, rgba(11, 17, 32, 0) 0%, rgba(11, 17, 32, 0.95) 100%);
  pointer-events: none;
  opacity: 0.9;
  z-index: 5;
}

.orders-subnav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.orders-subnav-row .scroll-fade-container {
  flex: 1;
  min-width: 0;
}

.orders-subnav-row .orders-subtabs-bar {
  margin-bottom: 0;
  width: 100%;
}

.orders-subnav-row .view-display-toggles {
  flex-shrink: 0;
  margin-left: 8px;
}

.view-display-toggles {
  display: flex;
  gap: 4px;
  background: var(--md-sys-color-surface-container);
  padding: 4px;
  border-radius: var(--md-sys-shape-full);
  border: 1px solid var(--md-sys-color-outline-variant);
}

.btn-icon-toggle {
  background: transparent;
  border: none;
  color: var(--md-sys-color-on-surface-variant);
  padding: 8px 10px;
  border-radius: var(--md-sys-shape-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--md-sys-motion-duration-short) ease;
}

.btn-icon-toggle i,
.btn-icon-toggle svg {
  width: 17px;
  height: 17px;
}

.btn-icon-toggle:hover {
  color: var(--md-sys-color-on-surface);
}

.btn-icon-toggle.active {
  background: var(--md-sys-color-surface-container-highest);
  color: var(--md-sys-color-primary);
  box-shadow: var(--md-sys-elevation-level1);
}

/* ========================================================== */
/* BUTTONS & FORMS (MATERIAL DESIGN 3)                       */
/* ========================================================== */
button {
  font-family: inherit;
}

.btn-primary {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  border: none;
  padding: 9px 20px;
  border-radius: var(--md-sys-shape-full);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--md-sys-elevation-level1);
  transition: all var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard);
}

.btn-primary:hover {
  box-shadow: var(--md-sys-elevation-level2), 0 4px 14px rgba(245, 158, 11, 0.35);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary i,
.btn-primary svg {
  width: 17px;
  height: 17px;
}

.btn-secondary {
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
  border: 1px solid var(--md-sys-color-outline-variant);
  padding: 9px 18px;
  border-radius: var(--md-sys-shape-full);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all var(--md-sys-motion-duration-short) ease;
}

.btn-secondary:hover {
  background: var(--md-sys-color-surface-container-highest);
  border-color: var(--md-sys-color-outline);
}

.btn-secondary i,
.btn-secondary svg {
  width: 16px;
  height: 16px;
}

.btn-danger {
  background: var(--md-sys-color-error);
  color: #ffffff;
  border: none;
  padding: 9px 18px;
  border-radius: var(--md-sys-shape-full);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  box-shadow: var(--md-sys-elevation-level1);
  transition: all var(--md-sys-motion-duration-short) ease;
}

.btn-danger:hover {
  box-shadow: var(--md-sys-elevation-level2);
  transform: translateY(-1px);
}

.btn-danger-ghost {
  background: var(--md-sys-color-error-container);
  color: var(--md-sys-color-on-error-container);
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 8px 14px;
  border-radius: var(--md-sys-shape-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--md-sys-motion-duration-short) ease;
}

.btn-danger-ghost:hover {
  background: var(--md-sys-color-error);
  color: #ffffff;
}

.btn-danger-ghost i,
.btn-danger-ghost svg {
  width: 16px;
  height: 16px;
}

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

input[type="text"], input[type="number"], input[type="email"], input[type="tel"], input[type="date"], select, textarea {
  width: 100%;
  background: var(--md-sys-color-surface-container-lowest);
  border: 1px solid var(--md-sys-color-outline-variant);
  color: var(--md-sys-color-on-surface);
  padding: 11px 14px;
  border-radius: var(--md-sys-shape-md);
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--md-sys-motion-duration-short) ease, box-shadow var(--md-sys-motion-duration-short) ease;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--md-sys-color-primary);
  box-shadow: 0 0 0 2px var(--md-sys-color-primary-container);
}

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

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: 6px;
}

.form-row {
  display: flex;
  gap: 12px;
}

.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

/* ========================================================== */
/* ORDER CARDS & LIST */
/* ========================================================== */
.orders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
}

.orders-grid.list-mode {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.orders-grid.list-mode .order-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  border-radius: var(--md-sys-shape-md);
  margin-bottom: 0;
  box-shadow: none;
  border: 1px solid var(--md-sys-color-outline-variant);
  background: var(--md-sys-color-surface-container);
  transition: all var(--md-sys-motion-duration-short) ease;
}

.orders-grid.list-mode .order-card:hover {
  background: var(--md-sys-color-surface-container-high);
  border-color: var(--md-sys-color-primary);
}

.orders-grid.list-mode .order-card-header {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 150px;
  flex-shrink: 0;
}

.orders-grid.list-mode .client-info-group {
  flex: 1.5;
  min-width: 0;
}

.orders-grid.list-mode .client-name-heading {
  font-size: 0.96rem;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.orders-grid.list-mode .site-address-row {
  margin-bottom: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.78rem;
}

.orders-grid.list-mode .order-desc-text,
.orders-grid.list-mode .order-steps-mini-preview,
.orders-grid.list-mode .order-card-meta-footer {
  display: none;
}

.orders-grid.list-mode .order-elem-count-badge {
  font-size: 0.78rem;
  color: var(--md-sys-color-secondary);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 110px;
}

.orders-grid.list-mode .problem-callout {
  padding: 4px 10px;
  font-size: 0.74rem;
  margin-bottom: 0;
  gap: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.orders-grid.list-mode .progress-container {
  margin-top: 0;
  min-width: 160px;
  flex-shrink: 0;
}

@media (max-width: 900px) {
  .orders-grid.list-mode .order-card {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 14px;
  }
  .orders-grid.list-mode .order-card-header {
    flex-direction: row;
    justify-content: space-between;
    width: 100%;
  }
  .orders-grid.list-mode .progress-container {
    width: 100%;
    min-width: 0;
  }
}

.order-card {
  background: var(--md-sys-color-surface-container-high);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-lg);
  padding: 20px;
  cursor: pointer;
  transition: all var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard);
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: var(--md-sys-elevation-level1);
}

.order-card:hover {
  border-color: var(--md-sys-color-primary);
  transform: translateY(-2px);
  box-shadow: var(--md-sys-elevation-level2), 0 4px 16px rgba(0, 0, 0, 0.3);
}

.order-card.has-problem {
  border: 1px solid var(--md-sys-color-error);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.05), var(--md-sys-color-surface-container-high));
}

.order-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.order-num-tag {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: var(--md-sys-color-primary);
  font-size: 0.95rem;
}

.type-pill {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: var(--md-sys-shape-full);
  text-transform: uppercase;
}

.pill-eigenbau { background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); border: 1px solid rgba(245, 158, 11, 0.3); }
.pill-zukauf { background: rgba(100, 116, 139, 0.15); color: #cbd5e1; border: 1px solid rgba(148, 163, 184, 0.3); }
.pill-mischform { background: rgba(245, 158, 11, 0.2); color: #fde68a; border: 1px solid var(--amber-light); }
.pill-fenster { background: var(--md-sys-color-tertiary-container); color: var(--md-sys-color-tertiary); border: 1px solid rgba(45, 212, 191, 0.4); }
.pill-kueche { background: rgba(99, 102, 241, 0.15); color: #a5b4fc; border: 1px solid #6366f1; }
.pill-sonder { background: rgba(168, 85, 247, 0.15); color: #c084fc; border: 1px solid #a855f7; }

.client-name-heading {
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 4px;
}

.site-address-row {
  font-size: 0.84rem;
  color: var(--md-sys-color-on-surface-variant);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}

.site-address-row i,
.site-address-row svg {
  width: 15px;
  height: 15px;
  color: var(--md-sys-color-primary);
}

.order-desc-text {
  font-size: 0.86rem;
  color: var(--md-sys-color-on-surface-variant);
  line-height: 1.45;
  margin-bottom: 16px;
  flex: 1;
}

.order-elem-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--md-sys-color-secondary);
  background: var(--md-sys-color-secondary-container);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 3px 10px;
  border-radius: var(--md-sys-shape-full);
  margin-bottom: 12px;
  font-weight: 600;
  width: fit-content;
}

.problem-callout {
  background: var(--md-sys-color-error-container);
  border: 1px solid var(--md-sys-color-error);
  color: var(--md-sys-color-on-error-container);
  padding: 8px 14px;
  border-radius: var(--md-sys-shape-md);
  font-size: 0.82rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.progress-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: auto;
}

.progress-track-bar {
  flex: 1;
  height: 8px;
  background: var(--md-sys-color-surface-container);
  border-radius: var(--md-sys-shape-full);
  overflow: hidden;
}

.progress-fill-bar {
  height: 100%;
  background: linear-gradient(90deg, #d97706, var(--md-sys-color-primary));
  border-radius: var(--md-sys-shape-full);
  transition: width 0.3s ease;
}

.progress-fill-bar.done {
  background: var(--md-sys-color-tertiary);
}

.progress-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--md-sys-color-on-surface);
  white-space: nowrap;
}

/* ========================================================== */
/* ORDER DETAIL VIEW (HUB & CLEAN TABS)                      */
/* ========================================================== */
.detail-top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.btn-back {
  background: var(--md-sys-color-surface-container-high);
  border: 1px solid var(--md-sys-color-outline-variant);
  color: var(--md-sys-color-on-surface);
  padding: 8px 16px;
  border-radius: var(--md-sys-shape-full);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all var(--md-sys-motion-duration-short) ease;
}

.btn-back:hover {
  background: var(--md-sys-color-surface-container-highest);
}

.detail-action-buttons {
  display: flex;
  gap: 10px;
}

.order-hero-card {
  background: var(--md-sys-color-surface-container-high);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-xl);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--md-sys-elevation-level1);
}

.order-hero-main {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 18px;
}

.hero-client {
  font-size: 1.55rem;
  font-weight: 800;
  color: #ffffff;
  margin-top: 4px;
}

.hero-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  background: var(--md-sys-color-surface-container);
  padding: 14px 18px;
  border-radius: var(--md-sys-shape-lg);
  border: 1px solid var(--md-sys-color-outline-variant);
}

.hero-meta-item {
  display: flex;
  flex-direction: column;
}

.hero-meta-label {
  font-size: 0.74rem;
  color: var(--md-sys-color-on-surface-variant);
  text-transform: uppercase;
  font-weight: 700;
}

.hero-meta-value {
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
  margin-top: 2px;
}

/* Detail Subtabs Bar (M3 Underline Tabs as in Mockup 05) */
.subtabs-bar {
  display: flex;
  background: transparent;
  border-bottom: 2px solid var(--md-sys-color-outline-variant);
  border-radius: 0;
  padding: 0 4px;
  margin-bottom: 24px;
  gap: 16px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.subtabs-bar::-webkit-scrollbar {
  display: none;
}

.subtab-btn {
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  color: var(--md-sys-color-on-surface-variant);
  padding: 12px 16px;
  margin-bottom: -2px;
  font-size: 0.92rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all var(--md-sys-motion-duration-short) ease;
  white-space: nowrap;
}

.subtab-btn i,
.subtab-btn svg {
  width: 16px;
  height: 16px;
  transition: color var(--md-sys-motion-duration-short) ease;
}

.subtab-btn:hover {
  color: var(--md-sys-color-on-surface);
  background: rgba(255, 255, 255, 0.03);
}

.subtab-btn.active {
  color: var(--md-sys-color-primary);
  border-bottom-color: var(--md-sys-color-primary);
  font-weight: 700;
  background: transparent;
  box-shadow: none;
}

.subtab-btn.active i,
.subtab-btn.active svg {
  color: var(--md-sys-color-primary);
}

.subtab-count {
  background: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: var(--md-sys-shape-full);
  font-weight: 800;
}

.subtab-btn.active .subtab-count {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-primary);
}

.subtab-count.danger {
  background: var(--md-sys-color-error);
  color: white;
}

.subtab-content.hidden {
  display: none;
}

/* ========================================================== */
/* STEPS & TASK ENGINE (MATERIAL DESIGN 3 - TEXT FOCUSED)     */
/* ========================================================== */
.steps-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.step-filter-pills {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  max-width: 100%;
  padding-bottom: 4px;
}

.step-phase-pill {
  background: var(--bg-surface);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.step-phase-pill:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
}

.step-phase-pill.active {
  background: var(--amber-light);
  color: #0b1120;
  border-color: var(--amber-light);
  font-weight: 700;
}

.step-phase-pill.pill-danger.active {
  background: var(--red-danger);
  color: #ffffff;
  border-color: var(--red-danger);
}

.steps-clean-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Step Card (Clean Text-Focused) */
.step-card {
  background: var(--md-sys-color-surface-container-high);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-lg);
  padding: 18px 20px;
  transition: all var(--md-sys-motion-duration-short) ease;
  position: relative;
  box-shadow: var(--md-sys-elevation-level1);
}

.step-card:hover {
  border-color: var(--md-sys-color-primary);
  box-shadow: var(--md-sys-elevation-level2);
}

.step-card.step-problem {
  border: 1px solid var(--md-sys-color-error);
  background: linear-gradient(to right, rgba(239, 68, 68, 0.08), var(--md-sys-color-surface-container-high));
}

.step-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.step-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.step-role-badge {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: var(--md-sys-shape-full);
  text-transform: uppercase;
}

.role-werkstatt { background: var(--md-sys-color-primary-container); color: var(--md-sys-color-primary); border: 1px solid rgba(245, 158, 11, 0.3); }
.role-montage { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-secondary); border: 1px solid rgba(56, 189, 248, 0.3); }

.step-title-text {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--md-sys-color-on-surface);
}

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

.btn-step-icon {
  background: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
  color: var(--md-sys-color-on-surface-variant);
  width: 32px;
  height: 32px;
  border-radius: var(--md-sys-shape-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--md-sys-motion-duration-short) ease;
}

.btn-step-icon:hover {
  color: var(--md-sys-color-on-surface);
  background: var(--md-sys-color-surface-container-highest);
}

/* Dynamic Wiki Match Box (M3 Style) */
.dynamic-wiki-box {
  margin-top: 12px;
  margin-bottom: 14px;
  background: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-md);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.wiki-match-info {
  font-size: 0.82rem;
  color: var(--md-sys-color-secondary);
  font-weight: 600;
}

.wiki-match-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.wiki-tag-pill {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 4px 12px;
  border-radius: var(--md-sys-shape-full);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  transition: all var(--md-sys-motion-duration-short) ease;
}

.wiki-tag-pill:hover {
  background: var(--md-sys-color-secondary);
  color: var(--md-sys-color-on-secondary);
}

/* 4 Status Segmented Buttons (Material Design 3 - Pill Container) */
.status-pill-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.st-pill {
  background: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
  color: var(--md-sys-color-on-surface-variant);
  padding: 9px 12px;
  border-radius: var(--md-sys-shape-full);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: all var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.st-pill:hover {
  background: var(--md-sys-color-surface-container-highest);
  color: var(--md-sys-color-on-surface);
}

.st-pill.st-offen.active {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-primary);
  border-color: rgba(245, 158, 11, 0.4);
  box-shadow: var(--md-sys-elevation-level1);
}

.st-pill.st-arbeit.active {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-secondary);
  border-color: rgba(56, 189, 248, 0.4);
  box-shadow: var(--md-sys-elevation-level1);
}

.st-pill.st-done.active {
  background: var(--md-sys-color-tertiary-container);
  color: var(--md-sys-color-tertiary);
  border-color: rgba(45, 212, 191, 0.4);
  box-shadow: var(--md-sys-elevation-level1);
}

.st-pill.st-problem.active {
  background: var(--md-sys-color-error-container);
  color: var(--md-sys-color-error);
  border-color: rgba(239, 68, 68, 0.4);
  box-shadow: var(--md-sys-elevation-level1);
}

/* ========================================================== */
/* ELEMENTS / AUFMAß MATRIX TABLE */
/* ========================================================== */
.elements-tab-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.elements-table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}

.modern-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  text-align: left;
}

.modern-table th {
  background: var(--bg-darkest);
  color: var(--text-muted);
  font-weight: 700;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.modern-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
  vertical-align: middle;
}

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

.modern-table tr:hover {
  background: var(--bg-card-hover);
}

.dim-code {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: var(--amber-light);
  background: var(--amber-glow);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.din-badge {
  font-weight: 700;
  font-size: 0.78rem;
  padding: 3px 8px;
  border-radius: 4px;
}

.din-left { background: var(--blue-glow); color: var(--blue-sky); }
.din-right { background: var(--green-glow); color: var(--green-success); }

/* ========================================================== */
/* WORKSHOP TASKS VIEW & KANBAN */
/* ========================================================== */
.tasks-enhanced-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.task-item-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all 0.15s ease;
}

.task-item-card:hover {
  border-color: var(--border-focus);
}

.task-item-card.completed {
  opacity: 0.6;
}

.task-item-card.completed .task-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

.task-checkbox-custom {
  width: 22px;
  height: 22px;
  accent-color: var(--amber-light);
  cursor: pointer;
}

.task-main-info {
  flex: 1;
}

.task-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.task-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.task-prio-badge {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.prio-dringend { background: var(--red-danger); color: white; }
.prio-normal { background: var(--bg-surface); color: var(--text-muted); }
.prio-niedrig { background: rgba(148, 163, 184, 0.1); color: var(--text-dim); }

.task-sub-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.78rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

/* Kanban Board */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  overflow-x: auto;
  min-height: 400px;
}

.kanban-column {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 12px;
  display: flex;
  flex-direction: column;
}

.kanban-col-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.col-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.dot-grey { background: #64748b; }
.dot-blue { background: var(--blue-sky); }
.dot-amber { background: var(--amber-light); }
.dot-green { background: var(--green-success); }

.col-count {
  margin-left: auto;
  font-size: 0.75rem;
  background: var(--bg-darkest);
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

.kanban-col-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kanban-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.kanban-card:hover {
  border-color: var(--amber-light);
  transform: translateY(-2px);
}

/* ========================================================== */
/* FIRMEN-WIKI SYSTEM (RICH KNOWLEDGE BASE) */
/* ========================================================== */
.wiki-search-container {
  margin-bottom: 18px;
}

.wiki-search-box-large {
  position: relative;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
}

.wiki-search-box-large input {
  width: 100%;
  padding: 12px 14px 12px 42px !important;
  font-size: 1rem;
  border-radius: var(--radius-md);
  background: var(--bg-card);
}

.wiki-search-box-large .search-icon,
.wiki-search-box-large i,
.wiki-search-box-large svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--amber-light);
  pointer-events: none;
}

.btn-clear-search {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
}

.wiki-category-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.filter-chip {
  background: var(--bg-surface);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.filter-chip:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
}

.filter-chip.active {
  background: var(--amber-primary);
  color: #ffffff;
  border-color: var(--amber-primary);
}

/* Wiki Main Layout (Split Pane) */
.wiki-main-layout {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 20px;
  min-height: 550px;
}

@media (max-width: 900px) {
  .wiki-main-layout {
    grid-template-columns: 1fr;
  }
}

.wiki-articles-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 700px;
  overflow-y: auto;
  padding-right: 4px;
}

.wiki-article-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.wiki-article-card:hover {
  border-color: var(--amber-light);
  background: var(--bg-card-hover);
}

.wiki-article-card.selected {
  border-color: var(--amber-light);
  background: var(--bg-surface);
  box-shadow: 0 0 0 1px var(--amber-light);
}

.wiki-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.wiki-cat-tag {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--blue-sky);
  background: var(--blue-glow);
  padding: 2px 6px;
  border-radius: 4px;
}

.wiki-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 6px;
}

.wiki-card-snippet {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Wiki Full Reader Pane */
.wiki-reader-pane {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-height: 700px;
  overflow-y: auto;
  box-shadow: var(--shadow-sm);
}

.wiki-reader-empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}

.wiki-reader-empty i,
.wiki-reader-empty svg {
  width: 48px;
  height: 48px;
  color: var(--amber-light);
  margin-bottom: 12px;
}

.wiki-article-header {
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 16px;
  margin-bottom: 20px;
}

.wiki-article-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 8px;
}

.wiki-article-meta {
  display: flex;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
  align-items: center;
  flex-wrap: wrap;
}

/* Markdown & Technical formatting for Wiki */
.wiki-article-body {
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--text-secondary);
}

.wiki-article-body h3 {
  color: #ffffff;
  font-size: 1.15rem;
  margin-top: 18px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 4px;
}

.wiki-article-body ul {
  padding-left: 20px;
  margin-bottom: 14px;
}

.wiki-article-body li {
  margin-bottom: 6px;
}

.wiki-article-body strong {
  color: #ffffff;
}

/* Parameter Tables in Wiki */
.wiki-table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  font-size: 0.85rem;
}

.wiki-table th, .wiki-table td {
  border: 1px solid var(--border-subtle);
  padding: 8px 12px;
  text-align: left;
}

.wiki-table th {
  background: var(--bg-darkest);
  color: var(--amber-light);
}

/* Wiki Alert Callout Boxes */
.callout-warning {
  background: var(--red-glow);
  border-left: 4px solid var(--red-danger);
  padding: 12px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 14px 0;
  color: #fca5a5;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.callout-tip {
  background: var(--amber-glow);
  border-left: 4px solid var(--amber-light);
  padding: 12px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 14px 0;
  color: #fef08a;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.callout-note {
  background: var(--blue-glow);
  border-left: 4px solid var(--blue-sky);
  padding: 12px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 14px 0;
  color: #bae6fd;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.callout-warning i, .callout-warning svg,
.callout-tip i, .callout-tip svg,
.callout-note i, .callout-note svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 2px;
}

/* ========================================================== */
/* IN-CONTEXT SLIDE-OVER WIKI DRAWER */
/* ========================================================== */
.drawer-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(7, 13, 24, 0.7);
  backdrop-filter: blur(8px);
  z-index: 1050;
  display: flex;
  justify-content: flex-end;
}

.drawer-overlay.hidden {
  display: none;
}

.drawer-panel {
  background: var(--bg-card);
  width: 100%;
  max-width: 580px;
  height: 100%;
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: slideInRight 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.drawer-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.drawer-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--amber-light);
  display: flex;
  align-items: center;
  gap: 4px;
  text-transform: uppercase;
}

.drawer-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.6rem;
  cursor: pointer;
}

.drawer-body {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

.drawer-search-bar {
  position: relative;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
}

.drawer-search-bar input {
  width: 100%;
  padding-left: 36px !important;
  height: 38px;
}

.drawer-search-bar i,
.drawer-search-bar svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.drawer-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

/* ========================================================== */
/* CUSTOMERS VIEW */
/* ========================================================== */
.customers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.customer-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.customer-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cust-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--amber-light);
  background: var(--amber-glow);
  padding: 2px 6px;
  border-radius: 4px;
}

.cust-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
}

.cust-info-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.cust-info-item i,
.cust-info-item svg {
  width: 14px;
  height: 14px;
}

.cust-info-item a {
  color: var(--blue-sky);
  text-decoration: none;
}

.cust-info-item a:hover {
  text-decoration: underline;
}

/* ========================================================== */
/* SETTINGS VIEW */
/* ========================================================== */
/* ========================================================== */
/* SETTINGS VIEW */
/* ========================================================== */
/* SETTINGS SUB-NAVIGATION BAR (M3 UNDERLINE TABS)           */
/* ========================================================== */
.settings-subnav-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  background: transparent;
  border-bottom: 2px solid var(--md-sys-color-outline-variant);
  border-radius: 0;
  padding: 0 4px 6px 4px;
  margin-bottom: 24px;
  overflow-x: auto;
  max-width: 100%;
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: rgba(245, 158, 11, 0.5) rgba(255, 255, 255, 0.06);
}

.settings-subnav-bar::-webkit-scrollbar {
  display: block !important;
  height: 4px !important;
}

.settings-subnav-bar::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05) !important;
  border-radius: 4px;
}

.settings-subnav-bar::-webkit-scrollbar-thumb {
  background: rgba(245, 158, 11, 0.5) !important;
  border-radius: 4px;
}

.settings-subnav-bar::-webkit-scrollbar-thumb:hover {
  background: var(--md-sys-color-primary) !important;
}

.settings-subnav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  margin-bottom: -2px;
  border-radius: 0;
  border: none;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--md-sys-motion-duration-short) ease;
}

.settings-subnav-btn svg {
  width: 17px;
  height: 17px;
  color: var(--md-sys-color-on-surface-variant);
  transition: color var(--md-sys-motion-duration-short) ease;
}

.settings-subnav-btn:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--md-sys-color-on-surface);
}

.settings-subnav-btn:hover svg {
  color: var(--md-sys-color-primary);
}

.settings-subnav-btn.active {
  background: transparent;
  color: var(--md-sys-color-primary);
  border-bottom-color: var(--md-sys-color-primary);
  font-weight: 700;
  box-shadow: none;
}

.settings-subnav-btn.active svg {
  color: var(--md-sys-color-primary);
}

.settings-subtab-pane {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.settings-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

.settings-card-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 14px;
}

.settings-header-titles {
  flex: 1;
  min-width: 0;
}

.settings-header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.set-icon,
.settings-card-header svg.set-icon {
  width: 24px;
  height: 24px;
  color: var(--amber-light);
  flex-shrink: 0;
  margin-top: 2px;
}

.settings-card-header h3 {
  font-size: 1.1rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 4px;
}

.settings-card-header p {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.settings-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.template-steps-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
  background: var(--bg-darkest);
  padding: 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  margin-bottom: 12px;
}

.template-step-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  transition: all 0.15s ease;
}

.template-step-row:hover {
  background: var(--bg-card-hover);
  border-color: rgba(245, 158, 11, 0.3);
}

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

.template-add-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.template-step-input {
  flex: 1;
  min-width: 180px;
}

.template-role-btn-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

.template-role-select {
  width: 120px;
}

.btn-add-step-submit {
  padding: 8px 14px;
  font-weight: 700;
  white-space: nowrap;
}

.tag-add-bar {
  display: flex;
  gap: 8px;
  align-items: center;
}

.tag-input-field {
  flex: 1;
  min-width: 180px;
}

.tags-cloud-box {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 8px;
  background: var(--bg-darkest);
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  max-height: 240px;
  overflow-y: auto;
}

.tag-badge-pill {
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s ease;
}

.tag-badge-pill:hover {
  border-color: var(--amber-light);
  color: #ffffff;
}

.tag-badge-pill button {
  background: none;
  border: none;
  color: var(--red-danger);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
  transition: transform 0.15s ease;
}

.tag-badge-pill button:hover {
  transform: scale(1.2);
}

.settings-actions-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.file-upload-label {
  cursor: pointer;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* ========================================================== */
/* MODALS & DIALOGS (MATERIAL DESIGN 3)                      */
/* ========================================================== */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(5, 8, 17, 0.78);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 3500;
}

.modal.hidden {
  display: none !important;
}

.modal-content {
  background: var(--md-sys-color-surface-container-high);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-xl);
  max-width: 560px;
  width: 100%;
  padding: 28px;
  box-shadow: var(--md-sys-elevation-level4);
  max-height: 90vh;
  overflow-y: auto;
  transition: transform var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-emphasized);
}

.modal-large {
  max-width: 760px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-header h3 i,
.modal-header h3 svg {
  width: 22px;
  height: 22px;
}

.modal-close {
  background: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
  color: var(--md-sys-color-on-surface-variant);
  width: 34px;
  height: 34px;
  border-radius: var(--md-sys-shape-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all var(--md-sys-motion-duration-short) ease;
}

.modal-close:hover {
  background: var(--md-sys-color-surface-container-highest);
  color: var(--md-sys-color-on-surface);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
  border-top: 1px solid var(--md-sys-color-outline-variant);
  padding-top: 16px;
}

/* Editor helpers */
.editor-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  flex-wrap: wrap;
  gap: 6px;
}

.markdown-toolbar {
  display: flex;
  gap: 4px;
}

.md-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 3px 7px;
  border-radius: 4px;
  font-size: 0.74rem;
  cursor: pointer;
}

.md-btn:hover {
  background: var(--bg-card-hover);
  color: var(--amber-light);
}

.tag-suggestions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.tag-sug-pill {
  font-size: 0.72rem;
  background: var(--bg-surface);
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
}

.tag-sug-pill:hover {
  color: var(--amber-light);
  background: var(--bg-card-hover);
}

/* ========================================================== */
/* COMMAND PALETTE (CTRL + K) */
/* ========================================================== */
.command-palette-box {
  background: var(--bg-card);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-lg);
  max-width: 600px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  animation: fadeIn 0.15s ease-out;
}

.command-search-header {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  gap: 12px;
}

.palette-icon,
.command-search-header svg.palette-icon {
  width: 20px;
  height: 20px;
  color: var(--amber-light);
  flex-shrink: 0;
}

.command-search-header input {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  font-size: 1.05rem;
  color: #ffffff;
}

.command-search-header input:focus {
  box-shadow: none !important;
}

.esc-badge {
  background: var(--bg-darkest);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
}

.command-results {
  max-height: 360px;
  overflow-y: auto;
  padding: 8px;
}

.cmd-group-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 6px 12px;
}

.cmd-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.88rem;
  transition: all 0.1s ease;
}

.cmd-item i,
.cmd-item svg {
  width: 16px;
  height: 16px;
  color: var(--amber-light);
  flex-shrink: 0;
}

.cmd-item:hover, .cmd-item.selected {
  background: var(--bg-surface);
  color: #ffffff;
}

.command-footer {
  display: flex;
  gap: 16px;
  padding: 10px 18px;
  background: var(--bg-darkest);
  border-top: 1px solid var(--border-subtle);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.command-footer kbd {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: monospace;
}

/* ========================================================== */
/* LIGHTBOX & TOASTS */
/* ========================================================== */
.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 85vh;
  text-align: center;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 80vh;
  border-radius: var(--radius-md);
  border: 2px solid var(--amber-light);
  box-shadow: var(--shadow-lg);
}

.lightbox-close-btn {
  position: absolute;
  top: -16px;
  right: -16px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  border: 1px solid var(--border-subtle);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.4rem;
}

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideInUp 0.2s ease-out;
}

.toast i,
.toast svg {
  width: 18px;
  height: 18px;
}

.toast.toast-success { border-left: 4px solid var(--green-success); }
.toast.toast-danger { border-left: 4px solid var(--red-danger); }
.toast.toast-info { border-left: 4px solid var(--blue-sky); }

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

/* ========================================================== */
/* USER PROFILE & FAST TEAM SWITCHER */
/* ========================================================== */
.user-profile-widget {
  position: relative;
}

.btn-user-profile {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 4px 10px 4px 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-user-profile:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--amber-light), var(--amber-primary));
  color: #0b1120;
  font-weight: 800;
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.user-meta-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

.user-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.1;
}

.user-role-badge {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 3px;
  text-transform: uppercase;
  margin-top: 2px;
}

.user-chevron,
.btn-user-profile svg.user-chevron {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}

/* Role Badges */
.role-badge-meister { background: var(--amber-glow); color: var(--amber-light); border: 1px solid rgba(245, 158, 11, 0.3); }
.role-badge-buero { background: rgba(129, 140, 248, 0.18); color: #a5b4fc; border: 1px solid rgba(129, 140, 248, 0.35); }
.role-badge-werkstatt { background: var(--blue-glow); color: var(--blue-sky); border: 1px solid rgba(56, 189, 248, 0.3); }
.role-badge-montage { background: var(--green-glow); color: var(--green-success); border: 1px solid rgba(16, 185, 129, 0.3); }
.role-badge-azubi { background: rgba(148, 163, 184, 0.18); color: #cbd5e1; border: 1px solid rgba(148, 163, 184, 0.3); }

/* User Profile Dropdown */
.user-profile-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 290px;
  padding: 12px;
  z-index: 200;
}

.dropdown-user-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
}

.dropdown-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--amber-light), var(--amber-primary));
  color: #0b1120;
  font-weight: 800;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dropdown-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: #ffffff;
}

.dropdown-role-label {
  font-size: 0.72rem;
  color: var(--amber-light);
  font-weight: 600;
}

.dropdown-email {
  font-size: 0.72rem;
  color: var(--text-muted);
}

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

.dropdown-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 6px;
  padding: 0 4px;
}

.quick-users-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 180px;
  overflow-y: auto;
}

.quick-user-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.quick-user-item:hover {
  background: var(--bg-card-hover);
  border-color: rgba(245, 158, 11, 0.3);
}

.quick-user-item.active {
  border-color: var(--amber-light);
  background: rgba(245, 158, 11, 0.1);
}

.quick-user-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quick-u-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #334155;
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dropdown-item {
  width: 100%;
  background: none;
  border: none;
  color: var(--text-main);
  padding: 8px 10px;
  text-align: left;
  font-size: 0.84rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s ease;
}

.dropdown-item i,
.dropdown-item svg {
  width: 15px;
  height: 15px;
  color: var(--amber-light);
}

.dropdown-item:hover {
  background: var(--bg-surface);
}

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

.dropdown-item.text-danger i,
.dropdown-item.text-danger svg {
  color: var(--red-danger);
}

/* Auth Modal Quick Grid */
.auth-quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.auth-quick-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.auth-quick-card:hover {
  border-color: var(--amber-light);
  transform: translateY(-2px);
  background: var(--bg-card-hover);
}

.auth-quick-card.active {
  border-color: var(--amber-light);
  background: rgba(245, 158, 11, 0.12);
}

/* Team Management in Settings */
.team-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.team-member-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.2s ease;
  position: relative;
}

.team-member-card:hover {
  border-color: rgba(245, 158, 11, 0.45);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.team-member-card.team-card-current {
  border-color: rgba(16, 185, 129, 0.5);
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.06) 0%, var(--bg-surface) 100%);
}

.team-card-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.team-avatar-badge {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.25), rgba(217, 119, 6, 0.45));
  border: 1.5px solid var(--amber-light);
  color: #ffffff;
  font-weight: 800;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.team-card-headings {
  flex: 1;
  min-width: 0;
}

.team-card-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.team-card-name {
  font-weight: 800;
  color: #ffffff;
  font-size: 0.98rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-active-pill {
  background: rgba(16, 185, 129, 0.15);
  color: var(--green-success);
  border: 1px solid rgba(16, 185, 129, 0.35);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  font-size: 0.68rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}

.team-active-pill svg {
  width: 10px;
  height: 10px;
}

.team-card-role-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.team-spec-pill {
  font-size: 0.74rem;
  color: var(--text-muted);
  background: var(--bg-darkest);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.team-card-body {
  background: var(--bg-darkest);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.team-meta-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-meta-item svg {
  width: 13px;
  height: 13px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.team-meta-val {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-token-code {
  font-family: var(--font-mono, monospace);
  color: var(--amber-light);
  font-weight: 700;
  background: rgba(245, 158, 11, 0.1);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid rgba(245, 158, 11, 0.25);
  font-size: 0.76rem;
}

.team-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
}

.btn-qr-pass-action {
  flex: 1;
  font-size: 0.8rem !important;
  padding: 7px 12px !important;
  font-weight: 700;
  justify-content: center;
}

.btn-card-icon {
  background: var(--bg-darkest);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-card-icon:hover {
  background: var(--bg-card-hover);
  color: #ffffff;
  border-color: var(--amber-light);
}

.btn-card-icon svg {
  width: 15px;
  height: 15px;
}

.btn-card-icon.btn-card-danger:hover {
  background: rgba(239, 68, 68, 0.15);
  color: var(--red-danger);
  border-color: var(--red-danger);
}

/* ========================================================== */
/* ========================================================== */
/* SECURE FULLSCREEN ENTERPRISE LOGIN SCREEN */
/* ========================================================== */
.lock-screen-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at 50% 20%, rgba(30, 41, 59, 0.95), #060a12 90%);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  overflow-y: auto;
}

.lock-card {
  width: 100%;
  max-width: 460px;
  background: var(--bg-card);
  border: 1px solid var(--border-focus);
  border-radius: var(--radius-xl);
  padding: 28px 24px;
  box-shadow: var(--shadow-xl), 0 0 50px rgba(245, 158, 11, 0.1);
  animation: fadeIn 0.3s ease-out;
  overflow: visible;
}

.lock-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.lock-logo {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--amber-light), var(--amber-primary));
  color: #0b1120;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.lock-logo svg {
  width: 28px;
  height: 28px;
}

.lock-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.5px;
}

.lock-version {
  font-size: 0.78rem;
  color: var(--amber-light);
  font-weight: 600;
}

.lock-security-banner {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: #6ee7b7;
  margin-bottom: 20px;
}

.lock-security-banner svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--green-success);
}

.lock-tabs {
  display: flex;
  background: var(--bg-darkest);
  border-radius: var(--radius-md);
  padding: 4px;
  gap: 4px;
  margin-bottom: 20px;
}

.lock-tab-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.lock-tab-btn.active {
  background: var(--amber-primary);
  color: #0b1120;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon svg {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.input-with-icon input {
  padding-left: 38px !important;
  width: 100%;
}

.btn-lg {
  padding: 12px 18px;
  font-size: 0.95rem;
  font-weight: 700;
}

.lock-footer-help {
  margin-top: 16px;
  font-size: 0.75rem;
  color: var(--text-dim);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.lock-footer-help svg {
  width: 13px;
  height: 13px;
}

/* QR Code & Token Login Area */
.qr-login-box {
  background: var(--bg-darkest);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
}

.qr-scanner-trigger-area {
  text-align: center;
  padding: 10px 0;
}

.qr-scan-icon-ring {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(245, 158, 11, 0.15);
  border: 2px dashed var(--amber-light);
  color: var(--amber-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px auto;
}

.qr-scan-icon-ring svg {
  width: 30px;
  height: 30px;
}

.qr-scan-heading {
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 4px;
}

.qr-scan-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.qr-video-feed {
  width: 100%;
  max-height: 200px;
  border-radius: var(--radius-md);
  border: 2px solid var(--amber-primary);
  margin-bottom: 10px;
  object-fit: cover;
  background: #000000;
}

.qr-divider-text {
  text-align: center;
  position: relative;
  margin: 16px 0;
}

.qr-divider-text::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 100%;
  height: 1px;
  background: var(--border-subtle);
}

.qr-divider-text span {
  position: relative;
  background: var(--bg-darkest);
  padding: 0 10px;
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--text-dim);
  letter-spacing: 0.5px;
}

.token-input-field {
  letter-spacing: 2px;
  font-weight: 700;
  font-size: 0.95rem;
}

/* ========================================================== */
/* PRINTABLE QR-PASS ID CARD */
/* ========================================================== */
.qr-pass-card {
  background: #0f172a;
  border: 2px solid var(--amber-primary);
  border-radius: var(--radius-lg);
  padding: 20px;
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  margin: 0 auto;
}

.qr-pass-header {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(245, 158, 11, 0.3);
  padding-bottom: 10px;
  margin-bottom: 14px;
}

.qr-code-canvas-box {
  width: 150px;
  height: 150px;
  background: #ffffff;
  padding: 8px;
  border-radius: 8px;
  margin: 0 auto 12px auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-code-canvas-box img,
.qr-code-canvas-box canvas {
  width: 100% !important;
  height: 100% !important;
}

.qr-user-name {
  font-size: 1.15rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 2px;
}

.qr-token-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 4px;
}

.qr-token-code {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--amber-light);
  letter-spacing: 2px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px dashed var(--amber-light);
  padding: 4px 10px;
  border-radius: 4px;
  display: inline-block;
  margin-top: 2px;
}

.qr-pass-footer {
  font-size: 0.68rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border-subtle);
  padding-top: 8px;
  margin-top: 12px;
}

/* ========================================================== */
/* INVITATION SYSTEM & ONBOARDING STYLES */
/* ========================================================== */
.invitations-section {
  background: var(--bg-darkest);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 20px;
}

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

.pending-invites-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.invite-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.2s ease;
}

.invite-card.expired {
  opacity: 0.6;
  border-color: rgba(239, 68, 68, 0.3);
}

.invite-card.used {
  opacity: 0.7;
  border-color: rgba(16, 185, 129, 0.3);
}

.invite-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.invite-code-pill {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--amber-light);
  background: rgba(245, 158, 11, 0.12);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px dashed var(--amber-light);
}

.invite-status-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.status-badge-active {
  background: rgba(245, 158, 11, 0.2);
  color: var(--amber-light);
  border: 1px solid var(--amber-primary);
}

.status-badge-expired {
  background: rgba(239, 68, 68, 0.2);
  color: var(--red-danger);
}

.status-badge-used {
  background: rgba(16, 185, 129, 0.2);
  color: var(--green-success);
}

.invite-card-body {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.invite-actions-row {
  display: flex;
  gap: 6px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

/* Printable / Presentable Invitation Badge */
.invite-badge-card {
  background: linear-gradient(145deg, #0f172a, #090e1a);
  border: 2px solid var(--amber-primary);
  border-radius: var(--radius-lg);
  padding: 20px;
  color: #ffffff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  margin: 0 auto;
}

.invite-expiry-pill {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid var(--amber-light);
  color: var(--amber-light);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}

.invite-expiry-pill svg {
  width: 14px;
  height: 14px;
}

/* Onboarding Welcome Banner */
.onboarding-welcome-banner {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(6, 78, 59, 0.4));
  border: 1px solid var(--green-success);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
}

/* ========================================================== */
/* COMPREHENSIVE RESPONSIVE DESIGN (MOBILE & TABLET) */
/* ========================================================== */

/* Large Tablets and Laptops <= 992px */
@media (max-width: 992px) {
  .wiki-main-layout {
    grid-template-columns: 1fr;
  }
  .wiki-reader-pane {
    position: relative;
    max-height: none;
  }
  .order-hero-main {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .hero-meta-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Tablets & Mobile Devices <= 768px */
@media (max-width: 768px) {
  .app-header {
    padding: 8px 12px;
    height: auto;
    flex-wrap: wrap;
    gap: 8px;
  }

  .header-left .brand-subtitle,
  .brand-text .app-subtitle {
    display: none;
  }

  .header-center {
    order: 3;
    width: 100%;
    margin: 0;
  }

  .command-search-btn {
    width: 100%;
    max-width: 100%;
    justify-content: flex-start;
    padding: 8px 12px;
  }

  .command-search-btn .shortcut-key {
    display: none;
  }

  .header-right {
    margin-left: auto;
    gap: 8px;
  }

  .sync-text {
    display: none;
  }

  .sync-badge {
    padding: 6px;
  }

  .quick-btn-label {
    display: none;
  }

  .btn-quick-action {
    padding: 6px 10px;
  }

  .user-profile-widget {
    display: none !important;
  }

  .nav-tabs-bar {
    top: auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .nav-tabs-container {
    width: max-content;
    padding: 6px 12px;
  }

  .nav-tab-btn {
    padding: 6px 12px;
    font-size: 0.8rem;
    white-space: nowrap;
  }

  .app-container {
    padding: 12px;
  }

  .view-header-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .header-action-group {
    flex-direction: column;
    align-items: stretch;
  }

  .search-input-wrapper {
    width: 100%;
  }

  .segmented-filter-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .segmented-control {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
  }

  .seg-btn {
    white-space: nowrap;
    padding: 6px 12px;
  }

  .subtabs-bar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
  }

  .subtab-btn {
    white-space: nowrap;
    padding: 8px 14px;
  }

  .step-filter-pills {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    padding-bottom: 4px;
  }

  .step-phase-pill {
    white-space: nowrap;
  }

  .wiki-category-chips {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    padding-bottom: 4px;
  }

  .filter-chip {
    white-space: nowrap;
  }

  .orders-grid,
  .customers-grid,
  .team-cards-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .modal-content {
    max-width: 96vw;
    padding: 16px;
    max-height: 90vh;
  }

  .status-pill-grid {
    grid-template-columns: 1fr 1fr;
  }

  .drawer-panel {
    width: 100vw;
    max-width: 100vw;
  }

  .hero-meta-grid {
    grid-template-columns: 1fr;
  }

  .detail-top-nav {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .detail-action-buttons {
    justify-content: flex-end;
  }
}

/* Small Mobile Screens <= 480px */
@media (max-width: 480px) {
  .lock-card {
    padding: 20px 14px;
  }

  .lock-users-grid {
    grid-template-columns: 1fr;
  }

  .pin-key {
    padding: 10px 0;
    font-size: 1.15rem;
  }

  .status-pill-grid {
    grid-template-columns: 1fr 1fr;
  }

  .step-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .step-menu-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

/* ========================================================== */
/* MOBILE HAMBURGER, DRAWER & BOTTOM NAV STYLES */
/* ========================================================== */
.btn-hamburger {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
  flex-shrink: 0;
  margin-right: 6px;
}

.btn-hamburger:hover {
  background: var(--bg-card-hover);
  border-color: var(--amber-light);
  color: var(--amber-light);
}

.mobile-drawer-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(7, 13, 24, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1100;
  transition: opacity 0.3s ease;
}

.mobile-drawer-backdrop.hidden {
  display: none;
  opacity: 0;
}

.mobile-nav-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(320px, 86vw);
  background: rgba(15, 23, 42, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border-subtle);
  z-index: 1110;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  transform: translateX(0);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
}

.mobile-nav-drawer.hidden {
  transform: translateX(-100%);
  pointer-events: none;
}

.mobile-drawer-header {
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
}

.drawer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.drawer-title {
  font-weight: 800;
  color: white;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.drawer-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.btn-drawer-close {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-drawer-close:hover {
  color: white;
  border-color: var(--border-focus);
}

.drawer-user-card {
  padding: 16px 20px;
  background: var(--bg-darkest);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 12px;
}

.drawer-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--gradient-amber);
  color: #0b1120;
  font-weight: 800;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-amber);
}

.drawer-user-name {
  font-weight: 700;
  color: white;
  font-size: 0.95rem;
}

.drawer-user-email {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.drawer-nav-section, .drawer-actions-section {
  padding: 16px 14px;
}

.drawer-section-heading {
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  margin-bottom: 10px;
  padding-left: 8px;
}

.drawer-nav-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.drawer-nav-item, .drawer-action-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: var(--transition-fast);
}

.drawer-nav-item:hover, .drawer-action-btn:hover {
  background: var(--bg-card-hover);
  color: white;
}

.drawer-nav-item.active {
  background: var(--amber-glow);
  color: var(--amber-light);
  font-weight: 700;
  border-left: 3px solid var(--amber-light);
}

.drawer-nav-item svg, .drawer-action-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.drawer-actions-section {
  border-top: 1px solid var(--border-subtle);
  margin-top: auto;
}

/* Mobile Bottom Navigation Bar (Material Design 3) */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 68px;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--md-sys-color-outline-variant);
  z-index: 1000;
  justify-content: space-around;
  align-items: center;
  padding: 0 8px;
  box-shadow: var(--md-sys-elevation-level2);
}

.mobile-nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: transparent;
  border: none;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 4px;
  position: relative;
  border-radius: var(--md-sys-shape-md);
  transition: all var(--md-sys-motion-duration-short) ease;
}

.mobile-nav-btn i,
.mobile-nav-btn svg {
  width: 20px;
  height: 20px;
  transition: transform var(--md-sys-motion-duration-short) ease;
}

.mobile-nav-btn:hover {
  color: var(--md-sys-color-on-surface);
}

.mobile-nav-btn.active {
  color: var(--md-sys-color-primary);
  font-weight: 700;
}

.mobile-nav-btn.active i,
.mobile-nav-btn.active svg {
  transform: scale(1.1);
  color: var(--md-sys-color-primary);
}

.mobile-nav-btn .tab-badge {
  position: absolute;
  top: 3px;
  right: calc(50% - 18px);
  font-size: 0.62rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: var(--md-sys-shape-full);
}

/* Mobile Floating Action Button (M3 FAB) */
.main-mobile-fab {
  position: fixed;
  bottom: 82px;
  right: 18px;
  z-index: 990;
  background: var(--md-sys-color-primary) !important;
  color: var(--md-sys-color-on-primary) !important;
  font-weight: 800 !important;
  font-size: 0.88rem;
  border: none !important;
  border-radius: var(--md-sys-shape-lg);
  padding: 14px 20px;
  display: none;
  align-items: center;
  gap: 8px;
  box-shadow: var(--md-sys-elevation-level3), 0 4px 16px rgba(245, 158, 11, 0.4);
  cursor: pointer;
  transition: all var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-emphasized);
}

.main-mobile-fab:hover {
  transform: scale(1.05);
  box-shadow: var(--md-sys-elevation-level4), 0 6px 22px rgba(245, 158, 11, 0.5);
}

.main-mobile-fab:active {
  transform: scale(0.96);
}

.main-mobile-fab svg,
.main-mobile-fab i {
  width: 18px;
  height: 18px;
  color: #0b1120 !important;
  stroke: #0b1120 !important;
  stroke-width: 2.4px;
}

.main-mobile-fab span,
.main-mobile-fab .fab-label {
  color: #0b1120 !important;
  font-weight: 800 !important;
}

/* ========================================================== */
/* STREAMLINED ORDER DETAIL TOPBAR (M3 - MATCHING MOCKUP 05)  */
/* ========================================================== */
.order-detail-topbar {
  background: var(--md-sys-color-surface-container-high);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-xl);
  padding: 18px 24px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  box-shadow: var(--md-sys-elevation-level1);
}

.order-topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.btn-back-link {
  background: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
  color: var(--md-sys-color-on-surface);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 8px 16px;
  border-radius: var(--md-sys-shape-full);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all var(--md-sys-motion-duration-short) ease;
}

.btn-back-link:hover {
  background: var(--md-sys-color-surface-container-highest);
  color: #ffffff;
  border-color: var(--md-sys-color-primary);
}

.btn-back-link svg {
  width: 16px;
  height: 16px;
}

.order-headline-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.det-client-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--md-sys-color-on-surface);
  margin-top: 2px;
}

.order-headline-group.clickable-order-info {
  cursor: pointer;
  border-radius: var(--md-sys-shape-md);
  padding: 6px 10px;
  margin: -6px -10px;
  transition: all var(--md-sys-motion-duration-short) ease;
  user-select: none;
}

.order-headline-group.clickable-order-info:hover {
  background: var(--md-sys-color-primary-container);
}

.btn-info-badge {
  background: var(--md-sys-color-primary-container);
  border: 1px solid rgba(251, 191, 36, 0.35);
  color: var(--md-sys-color-primary);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--md-sys-shape-full);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-info-badge:hover {
  background: var(--amber-primary);
  color: #0b1120;
  border-color: var(--amber-light);
  transform: translateY(-1px);
}

.btn-info-badge svg {
  width: 12px;
  height: 12px;
}

.det-client-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: white;
  letter-spacing: -0.02em;
  margin: 0;
}

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

/* ========================================================== */
/* ORDER ATTACHMENTS & DRAWINGS STYLES */
/* ========================================================== */
.attachment-dropzone {
  border: 2px dashed var(--border-subtle);
  background: rgba(30, 41, 59, 0.4);
  border-radius: var(--radius-lg);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.attachment-dropzone:hover,
.attachment-dropzone.dragover {
  border-color: var(--amber-light);
  background: rgba(251, 191, 36, 0.06);
  transform: translateY(-1px);
}

.attachment-dropzone .dropzone-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(251, 191, 36, 0.12);
  color: var(--amber-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2px;
}

.attachment-dropzone .dropzone-icon svg {
  width: 22px;
  height: 22px;
}

.attachment-dropzone .dropzone-text {
  font-size: 0.92rem;
  color: var(--text-main);
}

.attachment-dropzone .dropzone-browse {
  color: var(--amber-light);
  text-decoration: underline;
  font-weight: 700;
}

.attachment-dropzone .dropzone-hint {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.attachments-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.attachment-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.2s ease;
  position: relative;
}

.attachment-card:hover {
  border-color: var(--border-focus);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.attachment-preview-box {
  width: 100%;
  height: 180px;
  background: #0b1120;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.attachment-preview-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.attachment-preview-box:hover img {
  transform: scale(1.04);
}

.attachment-pdf-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.08), rgba(15, 23, 42, 0.9));
  color: var(--red-danger);
}

.attachment-pdf-preview svg {
  width: 48px;
  height: 48px;
}

.attachment-type-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(4px);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.attachment-card-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.attachment-file-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.attachment-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.attachment-card-actions button,
.attachment-card-actions a {
  flex: 1;
  font-size: 0.76rem;
  padding: 6px 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
}

/* ========================================================== */
/* DECOUPLED WIKI FULL-SCREEN & CARDS STYLES */
/* ========================================================== */
.wiki-sub-page {
  animation: fadeIn 0.2s ease;
}

.wiki-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin-top: 16px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.wiki-reader-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.wiki-reader-actions {
  display: flex;
  gap: 8px;
}

.wiki-full-reader-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  box-shadow: var(--shadow-md);
  max-width: 960px;
  width: 100%;
  box-sizing: border-box;
  margin: 0 auto;
}

@media (max-width: 900px) {
  .btn-hamburger {
    display: inline-flex;
  }

  /* Branding completely hidden from mobile top header (only shown in hamburger drawer) */
  .app-header .brand {
    display: none !important;
  }

  .nav-tabs-bar {
    display: none;
  }

  .mobile-bottom-nav {
    display: flex;
  }

  .main-mobile-fab {
    display: inline-flex;
  }

  /* Mobile Notification Dropdown: stay within screen margins */
  .notification-dropdown-menu {
    position: fixed !important;
    top: 64px !important;
    left: 12px !important;
    right: 12px !important;
    width: auto !important;
    max-width: calc(100vw - 24px) !important;
  }

  /* Hide redundant static top action buttons replaced by the FAB */
  #btn-new-order,
  #btn-new-task,
  #btn-new-wiki,
  #btn-new-customer,
  #btn-add-step-to-order,
  #btn-add-element,
  .steps-action-group,
  .quick-create-dropdown {
    display: none !important;
  }

  /* Remove ugly scrollbar overlap on rounded pill controls */
  .segmented-control,
  .step-filter-pills,
  .wiki-category-chips {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
  }

  .segmented-control::-webkit-scrollbar,
  .step-filter-pills::-webkit-scrollbar,
  .wiki-category-chips::-webkit-scrollbar {
    display: none !important;
  }

  /* Orders & Tasks Subnav Layout on Tablet & Mobile: View Toggles placed neatly below tabs */
  .orders-subnav-row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 20px;
  }

  .orders-subnav-row .scroll-fade-container {
    width: 100%;
  }

  .orders-subnav-row .view-display-toggles {
    align-self: flex-start;
    margin-left: 0;
  }

  /* Ample bottom padding so FAB & bottom nav bar NEVER obscure cards, tables or buttons */
  .app-container {
    padding: 12px 14px 160px 14px;
  }

  .tab-view,
  .subtab-content,
  .orders-grid,
  .steps-clean-list,
  .elements-table-wrapper,
  .customer-info-hub,
  .photos-gallery-grid,
  .tasks-enhanced-list,
  .kanban-board,
  .wiki-cards-grid,
  .wiki-full-reader-card,
  .customers-grid,
  .settings-tab-layout {
    padding-bottom: 80px;
  }

  .view-header-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .header-action-group {
    width: 100%;
    flex-direction: column;
  }

  .header-action-group .search-input-wrapper {
    width: 100%;
  }

  .steps-toolbar {
    margin-bottom: 12px;
  }

  .order-detail-topbar {
    padding: 12px 14px;
    flex-direction: column;
    align-items: stretch;
  }

  .order-topbar-left {
    width: 100%;
    justify-content: space-between;
  }

  .order-topbar-right {
    width: 100%;
    justify-content: flex-end;
  }

  .wiki-full-reader-card {
    padding: 18px 16px 80px 16px;
  }

  .subtabs-bar {
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 6px;
  }

  /* Settings Mobile Layout */
  .settings-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .settings-card {
    padding: 16px;
  }

  .settings-card-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .settings-header-actions {
    margin-left: 0;
    width: 100%;
    flex-direction: column;
    gap: 8px;
  }

  .settings-header-actions .btn-primary,
  .settings-header-actions .btn-secondary {
    width: 100%;
    justify-content: center;
  }

  .template-add-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .template-role-btn-group {
    width: 100%;
    display: flex;
    gap: 8px;
  }

  .template-role-select {
    flex: 1;
    width: auto;
  }

  .btn-add-step-submit {
    flex: 1;
    justify-content: center;
  }

  .team-cards-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .tag-add-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .tag-add-bar button {
    width: 100%;
    justify-content: center;
  }
}

/* ========================================================== */
/* DEDICATED PRINT STYLES */
/* ========================================================== */
.printable-order-container {
  display: none;
}
@media print {
  @page {
    size: A4 portrait;
    margin: 8mm 10mm 10mm 10mm;
  }

  html, body {
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    color: #000000 !important;
    font-family: Arial, Helvetica, sans-serif !important;
    font-size: 9.5pt !important;
    line-height: 1.3 !important;
    height: auto !important;
    min-height: 0 !important;
  }

  /* Hide everything except the print sheet */
  body > *:not(.printable-order-container) {
    display: none !important;
  }

  /* Show dedicated printable sheet flush at top */
  .printable-order-container {
    display: block !important;
    position: static !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    color: #000000 !important;
    background: #ffffff !important;
  }

  .print-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 2px solid #000000;
    padding-bottom: 6px;
    margin-bottom: 10px;
  }

  .print-logo-title {
    font-size: 15pt;
    font-weight: bold;
    color: #000000;
    margin: 0;
  }

  .print-sub {
    font-size: 8pt;
    color: #444444;
    margin-top: 2px;
  }

  .print-doc-meta {
    text-align: right;
    font-size: 8.5pt;
  }

  .print-meta-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 10px;
    margin-bottom: 12px;
  }

  .print-card {
    border: 1px solid #000000;
    border-radius: 3px;
    padding: 6px 8px;
  }

  .print-card h4 {
    margin: 0 0 4px 0;
    font-size: 9pt;
    font-weight: bold;
    border-bottom: 1px solid #cccccc;
    padding-bottom: 2px;
  }

  .print-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 12px;
    font-size: 8.5pt;
  }

  .print-table th,
  .print-table td {
    border: 1px solid #000000;
    padding: 4px 6px;
    text-align: left;
  }

  .print-table th {
    background: #f0f0f0 !important;
    font-weight: bold;
  }

  .print-attachment-section {
    page-break-inside: avoid;
    margin-top: 10px;
    margin-bottom: 12px;
  }

  .print-attachment-title {
    font-weight: bold;
    font-size: 9pt;
    margin-bottom: 4px;
  }

  .print-attachment-img {
    max-width: 100% !important;
    max-height: 440px !important;
    width: auto;
    display: block;
    border: 1px solid #888888;
    object-fit: contain;
    page-break-inside: avoid;
  }

  .print-footer {
    margin-top: 16px;
    padding-top: 6px;
    border-top: 1px solid #cccccc;
    display: flex;
    justify-content: space-between;
    font-size: 7.5pt;
    color: #555555;
  }
}

/* ========================================================== */
/* NOTIFICATION CENTER (HEADER BELL & REALTIME ALERTS) */
/* ========================================================== */
.notification-bell-widget {
  position: relative;
}

.btn-notification-bell {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
}

.btn-notification-bell:hover {
  background: var(--bg-card);
  border-color: var(--amber-light);
  color: var(--amber-light);
}

.notif-badge-count {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--red-danger);
  color: white;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: var(--radius-full);
  border: 2px solid var(--bg-darkest);
  display: none;
  animation: pulse-badge 2s infinite;
}

.notif-badge-count.visible {
  display: inline-block;
}

@keyframes pulse-badge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); box-shadow: 0 0 10px rgba(239, 68, 68, 0.6); }
}

.notification-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 380px;
  max-width: 90vw;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: fadeIn 0.15s ease-out;
}

.notif-dropdown-header {
  padding: 12px 16px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.notif-dropdown-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: white;
  display: flex;
  align-items: center;
  gap: 8px;
}

.notif-dropdown-list {
  max-height: 380px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.notif-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background 0.15s ease;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.notif-item:hover {
  background: rgba(245, 158, 11, 0.05);
}

.notif-item.is-problem {
  border-left: 3px solid var(--red-danger);
  background: rgba(239, 68, 68, 0.04);
}

.notif-item-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.notif-item-icon.problem {
  background: var(--red-glow);
  color: var(--red-danger);
}

.notif-item-icon.done {
  background: rgba(16, 185, 129, 0.15);
  color: var(--green-success);
}

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

.notif-item-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: white;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notif-item-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.35;
  margin-bottom: 4px;
}

.notif-item-time {
  font-size: 0.7rem;
  color: var(--text-dim);
}

/* ========================================================== */
/* DASHBOARD COCKPIT (WERKSTATT LEITSTAND) */
/* ========================================================== */
.dashboard-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--md-sys-color-surface-container-high);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-lg);
  padding: 20px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all var(--md-sys-motion-duration-short) ease;
  position: relative;
  overflow: hidden;
  box-shadow: var(--md-sys-elevation-level1);
}

.kpi-card:hover {
  border-color: var(--md-sys-color-primary);
  transform: translateY(-2px);
  box-shadow: var(--md-sys-elevation-level2);
}

.kpi-card.kpi-problem {
  background: var(--md-sys-color-error-container);
  border-color: var(--md-sys-color-error);
}

.kpi-card.kpi-problem .kpi-value {
  color: var(--md-sys-color-error);
}

.kpi-card.kpi-problem .kpi-label {
  color: var(--md-sys-color-on-error-container);
}

.kpi-icon-box {
  width: 48px;
  height: 48px;
  border-radius: var(--md-sys-shape-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.kpi-card.kpi-problem .kpi-icon-box { background: rgba(239, 68, 68, 0.25); color: var(--md-sys-color-error); }
.kpi-card.kpi-montage .kpi-icon-box { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-secondary); }
.kpi-card.kpi-done .kpi-icon-box { background: var(--md-sys-color-tertiary-container); color: var(--md-sys-color-tertiary); }
.kpi-card.kpi-werkstatt .kpi-icon-box { background: var(--md-sys-color-primary-container); color: var(--md-sys-color-primary); }

.kpi-value {
  font-size: 1.8rem;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  color: white;
  line-height: 1;
  margin-bottom: 4px;
}

.kpi-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.dashboard-main-columns {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

@media (max-width: 1024px) {
  .dashboard-main-columns {
    grid-template-columns: 1fr;
  }
}

.dash-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
}

.dash-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.dash-panel-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: white;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dash-problem-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dash-problem-card {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.08), var(--bg-surface));
  border: 1px solid var(--red-danger);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dash-problem-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.dash-problem-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dash-problem-order {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: #fca5a5;
  font-size: 0.85rem;
}

.dash-problem-note {
  font-size: 0.86rem;
  color: #fef2f2;
  font-weight: 600;
}

.dash-problem-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.activity-stream {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
}

.activity-stream::before {
  content: '';
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 17px;
  width: 2px;
  background: var(--border-subtle);
}

.activity-stream-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  position: relative;
  z-index: 1;
}

.activity-dot {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  border: 2px solid var(--amber-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--amber-light);
  flex-shrink: 0;
  font-size: 0.8rem;
  font-weight: 800;
}

.activity-dot.done {
  border-color: var(--green-success);
  color: var(--green-success);
  background: rgba(16, 185, 129, 0.1);
}

.activity-dot.problem {
  border-color: var(--red-danger);
  color: var(--red-danger);
  background: var(--red-glow);
}

.activity-body {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}

.activity-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: white;
  margin-bottom: 2px;
}

.activity-meta {
  font-size: 0.76rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

.dashboard-bottom-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.quick-action-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.dash-qa-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.dash-qa-btn:hover {
  background: var(--bg-card);
  border-color: var(--amber-light);
  color: var(--amber-light);
  transform: translateY(-2px);
}

/* Role Badges */
.user-role-badge,
.role-badge-generic {
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.role-badge-aushilfe {
  background: rgba(148, 163, 184, 0.15);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.role-badge-azubi,
.role-badge-lehrling {
  background: rgba(20, 184, 166, 0.15);
  color: #5eead4;
  border: 1px solid rgba(20, 184, 166, 0.35);
}

.role-badge-mitarbeiter,
.role-badge-werkstatt {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.role-badge-montage {
  background: rgba(56, 189, 248, 0.15);
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.role-badge-meister {
  background: rgba(168, 85, 247, 0.15);
  color: #d8b4fe;
  border: 1px solid rgba(168, 85, 247, 0.35);
}

.role-badge-buero {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

/* Reklamation Highlight Styles */
.reklamation-pill {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.25), rgba(220, 38, 38, 0.4));
  color: #fecaca;
  border: 1px solid #ef4444;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  animation: pulse-badge 2s infinite;
}

.reklamation-card-item {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.08), var(--bg-surface));
  border: 1.5px solid var(--red-danger);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 12px;
  position: relative;
  overflow: hidden;
}

.reklamation-card-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 5px;
  height: 100%;
  background: var(--red-danger);
}

.reklamation-header-banner {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* Archived Order Styles */
.order-card.is-archived {
  opacity: 0.75;
  border-color: rgba(255, 255, 255, 0.05);
  background: var(--bg-darkest);
}

.order-archived-tag {
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.3);
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
}

/* Role Management Grid */
.roles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.role-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.2s ease;
}

.role-card:hover {
  border-color: var(--amber-light);
  transform: translateY(-2px);
}

.role-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.role-level-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-darkest);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.role-desc-text {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.role-members-list {
  font-size: 0.76rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* ========================================================== */
/* DESKTOP NAVIGATION RAIL & SIDEBAR LAYOUT (M3)             */
/* ========================================================== */
@media (min-width: 1024px) {
  body {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    min-height: 100vh;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .nav-tabs-bar {
    grid-column: 1;
    grid-row: 1 / -1;
    position: sticky;
    top: 0;
    height: 100vh;
    border-bottom: none;
    border-right: 1px solid var(--md-sys-color-outline-variant);
    background: var(--md-sys-color-surface-container-lowest);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    z-index: 100;
  }

  .nav-tabs-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    margin: 0;
  }

  .nav-tab-btn {
    width: 100%;
    justify-content: flex-start;
    padding: 12px 18px;
    font-size: 0.92rem;
  }

  .nav-tab-btn .tab-badge {
    margin-left: auto;
  }

  .app-header {
    grid-column: 2;
    grid-row: 1;
    position: sticky;
    top: 0;
    z-index: 90;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .app-container {
    grid-column: 2;
    grid-row: 2;
    max-width: 100%;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 28px 36px;
    margin: 0;
  }
}
