/* ============================================================
   Farm — Modern UI (wiki_neu design language)
   Single stylesheet. Replaces app.css + farm-backend.css.
   ============================================================ */

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --primary-glow: rgba(99, 102, 241, 0.35);

  --success: #22c55e;
  --success-bg: #dcfce7;
  --danger: #ef4444;
  --danger-bg: #fee2e2;
  --warning: #f59e0b;
  --warning-bg: #fef3c7;
  --info: #3b82f6;
  --info-bg: #dbeafe;

  --bg: #f0f2f7;
  --bg-card: rgba(255, 255, 255, 0.82);
  --bg-card-solid: #ffffff;
  --bg-sidebar: #12103d;
  --text: #1e293b;
  --text-light: #64748b;
  --text-sidebar: #c7c4f0;
  --border: rgba(226, 232, 240, 0.85);
  --border-solid: #e2e8f0;

  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06), 0 1px 4px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.12), 0 8px 20px rgba(0, 0, 0, 0.06);

  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 0.12s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);

  --sidebar-width: 270px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;

  --gradient-primary: linear-gradient(135deg, #6366f1, #8b5cf6);
  --gradient-success: linear-gradient(135deg, #22c55e, #16a34a);
  --gradient-danger: linear-gradient(135deg, #ef4444, #dc2626);
  --gradient-warning: linear-gradient(135deg, #f59e0b, #d97706);
  --gradient-info: linear-gradient(135deg, #3b82f6, #2563eb);
  --gradient-bg: linear-gradient(135deg, #eff1f7 0%, #e8e4f3 50%, #eef0fa 100%);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1220;
  --bg-card: #1a1e33;
  --bg-card-solid: #1a1e33;
  --bg-sidebar: #080a14;
  --text: #e8eaf0;
  --text-light: #9aa3c2;
  --text-sidebar: #b8bcd8;
  --border: #2a2f47;
  --border-solid: #2a2f47;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.55);
  --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.65);
  --gradient-bg: #0f1220;
  --primary-glow: rgba(99, 102, 241, 0.4);
  --success-bg: rgba(34, 197, 94, 0.18);
  --danger-bg: rgba(239, 68, 68, 0.18);
  --warning-bg: rgba(245, 158, 11, 0.18);
  --info-bg: rgba(59, 130, 246, 0.18);
}

html[data-theme="light"] { color-scheme: light; }

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  background: var(--gradient-bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'kern' 1, 'liga' 1, 'cv11' 1;
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--primary-dark); }

h1, h2, h3, h4, h5 { margin: 0; font-weight: 700; letter-spacing: -0.02em; line-height: 1.25; color: var(--text); }
p { margin: 0; }
img { max-width: 100%; height: auto; }

::selection { background: var(--primary-glow); color: var(--text); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-solid); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

a:focus-visible, button:focus-visible, [tabindex]:focus-visible,
[role="button"]:focus-visible, [role="radio"]:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}
/* Form inputs handle focus via their own border + glow (defined below) — no extra outline. */
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  z-index: 10000;
  padding: 10px 16px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}
.skip-link:focus { left: 12px; top: 0; }

/* ----- Animations ----- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ============================================================
   APP SHELL — sidebar + topbar + main
   Supports both wiki naming (.app-shell, .app-sidebar, .app-main)
   AND legacy theresa naming (.farm-shell, .farm-aside, .farm-work, .farm-main)
   ============================================================ */
.app-shell, .farm-shell { min-height: 100vh; display: block; }

/* Sidebar */
.app-sidebar, .farm-aside.farm-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  color: var(--text-sidebar);
  z-index: 100;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  transition: transform var(--transition);
}

.app-sidebar::before, .farm-aside::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at top left, rgba(99, 102, 241, 0.18), transparent 60%),
    radial-gradient(ellipse at bottom right, rgba(139, 92, 246, 0.12), transparent 60%);
  z-index: 0;
}

.app-sidebar > *, .farm-aside > * { position: relative; z-index: 1; }

.sidebar-header, .farm-brand-link {
  padding: 1.25rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  text-decoration: none;
  color: inherit;
}

.logo-icon, .farm-brand-mark {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  background: var(--gradient-primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 17px;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
  transition: transform var(--transition-spring);
}
.farm-brand-link:hover .farm-brand-mark { transform: rotate(-6deg) scale(1.05); }

.sidebar-header h2, .brand-text {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  background: linear-gradient(135deg, #c7c4f0, #a78bfa, #c084fc);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  letter-spacing: -0.02em;
}

.farm-sidebar-scroll, .sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0.85rem 0.75rem 1rem;
}

.farm-nav-rail-label, .sidebar-title {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.35);
  padding: 0.5rem 0.85rem 0.4rem;
  margin: 0;
}

/* Sidebar nav — works for legacy nav-sidebar list AND wiki list */
.nav-sidebar, .sidebar-nav {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-sidebar > .nav-item > .nav-link,
.sidebar-nav a,
.app-sidebar a {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.9rem;
  color: var(--text-sidebar);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 450;
  border-radius: var(--radius-sm);
  position: relative;
  transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

.nav-sidebar .nav-link > .nav-icon,
.nav-sidebar .nav-link > i,
.sidebar-nav a > i,
.app-sidebar a > i {
  opacity: 0.7;
  width: 18px;
  flex-shrink: 0;
  text-align: center;
  font-size: 14px;
  transition: opacity var(--transition-fast), color var(--transition-fast);
}

.nav-sidebar .nav-link p { margin: 0; font: inherit; }

.nav-sidebar .nav-link:hover,
.sidebar-nav a:hover,
.app-sidebar a:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  text-decoration: none;
  transform: translateX(2px);
}
.nav-sidebar .nav-link:hover > .nav-icon,
.nav-sidebar .nav-link:hover > i,
.sidebar-nav a:hover > i,
.app-sidebar a:hover > i { opacity: 1; }

.nav-sidebar .nav-link.active,
.sidebar-nav a.is-active,
.app-sidebar a.is-active {
  background: rgba(99, 102, 241, 0.18);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 0 22px rgba(99, 102, 241, 0.12);
}
.nav-sidebar .nav-link.active > .nav-icon,
.nav-sidebar .nav-link.active > i,
.sidebar-nav a.is-active > i,
.app-sidebar a.is-active > i { opacity: 1; color: #a5b4fc; }

.nav-sidebar .nav-link.active::before,
.sidebar-nav a.is-active::before,
.app-sidebar a.is-active::before {
  content: '';
  position: absolute;
  left: -0.6rem;
  top: 22%;
  height: 56%;
  width: 3px;
  border-radius: 0 4px 4px 0;
  background: var(--gradient-primary);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.6);
}

.farm-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(3px);
  z-index: 95;
  border: 0;
  padding: 0;
}

/* Work area / main */
.farm-work, .app-main {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition);
}

.farm-work { flex: 1; min-width: 0; background: transparent; }

/* Topbar */
.farm-bar, .farm-topbar, .app-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0.85rem 1.5rem;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: 56px;
}

html[data-theme="dark"] .farm-topbar,
html[data-theme="dark"] .app-topbar {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background: var(--bg);
}

.farm-icon-btn {
  width: 38px;
  height: 38px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-light);
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.farm-icon-btn:hover { background: var(--bg-card-solid); color: var(--primary); border-color: var(--border); }

.farm-sidebar-toggle { display: none; }

.farm-topbar .navbar-nav {
  list-style: none;
  margin: 0 0 0 auto;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.farm-topbar .nav-item { display: flex; align-items: center; }
.farm-topbar .nav-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0.4rem 0.7rem;
  color: var(--text);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  background: transparent;
  cursor: pointer;
  transition: background var(--transition-fast);
}
.farm-topbar .nav-link:hover { background: var(--bg-card-solid); color: var(--primary); }
.farm-theme-toggle {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-light);
  padding: 0.45rem 0.55rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.farm-theme-toggle:hover { background: var(--bg-card-solid); color: var(--primary); border-color: var(--border); }

/* Topbar dropdown (Bootstrap 4 markup) */
.farm-topbar .dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 220px;
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 0.5rem;
  display: none;
  z-index: 200;
  list-style: none;
}
.farm-topbar .dropdown-menu.show { display: block; animation: fadeInUp 0.18s ease; }
.farm-topbar .dropdown-menu-right { right: 0; left: auto; }
.farm-topbar .dropdown-item-text { display: block; padding: 0.45rem 0.7rem; color: var(--text-light); font-size: 0.78rem; }
.farm-topbar .dropdown-divider { height: 1px; background: var(--border); margin: 0.35rem 0; border: 0; }
.farm-logout-form { padding: 0.35rem 0.5rem; margin: 0; }
.farm-logout-btn {
  width: 100%;
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.7rem;
  cursor: pointer;
  font-weight: 600;
  transition: background var(--transition-fast);
}
.farm-logout-btn:hover { background: rgba(239, 68, 68, 0.18); }

/* Breadcrumb */
.farm-breadcrumb-row { background: transparent; padding: 0.6rem 1rem 0; }
.farm-breadcrumb-inner { padding: 0; }
.farm-breadcrumb-col { padding-left: 0.5rem; padding-right: 0.5rem; }
.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-light);
}
.breadcrumb-item { display: inline-flex; align-items: center; }
.breadcrumb-item + .breadcrumb-item::before { content: '›'; margin: 0 6px; color: var(--text-light); }
.breadcrumb-item a { color: var(--text-light); }
.breadcrumb-item a:hover { color: var(--primary); }
.breadcrumb-item.active { color: var(--text); font-weight: 600; }

/* Main */
.farm-main, .app-main .page-content {
  flex: 1;
  padding: 1.5rem 1.75rem 3rem;
  animation: fadeIn 0.3s ease;
}
.farm-main-inner { padding: 0; }
.container-fluid { width: 100%; padding-right: 0.75rem; padding-left: 0.75rem; margin: 0 auto; }
.farm-main .container-fluid { padding: 0; }

/* Footer */
.farm-footer, .app-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.75rem 1.5rem;
  color: var(--text-light);
  font-size: 0.82rem;
  flex-wrap: wrap;
}

/* ============================================================
   PAGE HEAD
   ============================================================ */
.page-head, .farm-subpage > .page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.subpage-head-text, .dashboard-head-main { flex: 1; min-width: 0; }
.page-head h1 {
  font-size: clamp(1.5rem, 3vw, 1.85rem);
  font-weight: 750;
  line-height: 1.15;
  margin: 0;
}
.eyebrow {
  margin: 0 0 6px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--primary);
}
.lead {
  margin: 8px 0 0;
  color: var(--text-light);
  font-size: 0.92rem;
  max-width: 60ch;
  line-height: 1.55;
}
.muted { color: var(--text-light); }
.hint { font-size: 0.82rem; color: var(--text-light); margin: 6px 0 0; }

.subpage-head-actions,
.dashboard-quick-actions,
.actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ============================================================
   CARDS / PANELS
   ============================================================ */
.card, .card-outline {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
  transition: box-shadow var(--transition), border-color var(--transition);
}
html[data-theme="dark"] .card,
html[data-theme="dark"] .card-outline {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background: var(--bg-card-solid);
}
.card:hover, .card-outline:hover { box-shadow: var(--shadow-md); }
.card.shadow-sm { box-shadow: var(--shadow); }
.card-pad, .card.pad, form.card.pad { padding: 1.25rem 1.35rem; }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 0 0.9rem;
  margin-bottom: 0.9rem;
  border-bottom: 1px solid var(--border);
}
.card-header h2, .card-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

/* Legacy card-outline border helpers — render as subtle primary tinted top edge */
.card-outline.card-indigo {
  border-top: 3px solid var(--primary);
}
.card-outline.card-secondary { border-top: 3px solid var(--border-solid); }

.callout {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--info);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1.1rem;
  margin-bottom: 1rem;
  font-size: 0.88rem;
}
.callout h5 { font-size: 0.92rem; font-weight: 700; margin: 0 0 4px; }
.callout-info { border-left-color: var(--info); }
.callout-success { border-left-color: var(--success); }
.callout-warning { border-left-color: var(--warning); }
.callout-danger { border-left-color: var(--danger); }
.callout code { background: var(--bg-card-solid); padding: 1px 6px; border-radius: 4px; font-size: 0.85em; font-family: var(--font-mono); }

/* ============================================================
   STAT / SMALL-BOX (dashboard KPIs)
   ============================================================ */
.small-box {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 130px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
html[data-theme="dark"] .small-box { backdrop-filter: none; background: var(--bg-card-solid); }
.small-box:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.small-box::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--gradient-primary);
}
.small-box.bg-purple::before { background: linear-gradient(135deg, #8b5cf6, #c084fc); }
.small-box.bg-info::before { background: var(--gradient-info); }
.small-box.bg-indigo::before { background: var(--gradient-primary); }

.small-box .inner {
  position: relative;
  z-index: 2;
  padding: 1.1rem 1.2rem 0.8rem;
  flex: 1;
}
.small-box .inner h3 {
  font-size: 1.65rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
  color: var(--text);
}
.small-box .inner p { color: var(--text-light); font-size: 0.85rem; font-weight: 600; margin: 0 0 6px; }
.small-box .small-box-caption {
  display: block;
  font-size: 0.78rem;
  color: var(--text-light);
  line-height: 1.45;
  margin-top: 4px;
}
.small-box .small-box-caption strong { color: var(--text); font-weight: 600; }
.small-box .icon {
  position: absolute;
  top: 0.9rem;
  right: 1rem;
  z-index: 1;
  font-size: 2.4rem;
  color: var(--primary);
  opacity: 0.18;
}
.small-box .small-box-footer {
  position: relative;
  z-index: 2;
  display: block;
  padding: 0.55rem 1rem;
  margin-top: auto;
  background: rgba(99, 102, 241, 0.06);
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  border-top: 1px solid var(--border);
  transition: background var(--transition-fast);
}
.small-box .small-box-footer:hover { background: rgba(99, 102, 241, 0.12); text-decoration: none; }
.small-box .small-box-footer i { margin-left: 4px; }

/* ============================================================
   BUTTONS — supports .btn / .btn-primary / .btn-outline /
   .btn-danger AND legacy .btn.primary / .btn.danger / .btn.small
   ============================================================ */
.btn, a.btn, button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card-solid);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 550;
  text-decoration: none;
  cursor: pointer;
  line-height: 1.4;
  letter-spacing: 0.01em;
  transition: transform var(--transition-fast), box-shadow var(--transition), background var(--transition), border-color var(--transition), color var(--transition);
  box-shadow: var(--shadow);
}
.btn:hover, a.btn:hover, button.btn:hover {
  transform: translateY(-1px);
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}
.btn:active { transform: translateY(0) scale(0.98); }
.btn:disabled, .btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none;
}

.btn.primary, .btn-primary {
  background: var(--gradient-primary);
  color: #fff;
  border: none;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}
.btn.primary:hover, .btn-primary:hover {
  color: #fff;
  border: none;
  box-shadow: 0 6px 22px rgba(99, 102, 241, 0.4);
}

.btn.danger, .btn-danger {
  background: var(--gradient-danger);
  color: #fff;
  border: none;
  box-shadow: 0 2px 10px rgba(239, 68, 68, 0.28);
}
.btn.danger:hover, .btn-danger:hover {
  color: #fff;
  border: none;
  box-shadow: 0 6px 22px rgba(239, 68, 68, 0.38);
}

.btn-success {
  background: var(--gradient-success);
  color: #fff;
  border: none;
  box-shadow: 0 2px 10px rgba(34, 197, 94, 0.28);
}
.btn-success:hover { color: #fff; box-shadow: 0 6px 22px rgba(34, 197, 94, 0.38); }

.btn-outline {
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

.btn-ghost, .btn-link {
  background: transparent;
  border: 1px solid transparent;
  box-shadow: none;
  color: var(--text-light);
}
.btn-ghost:hover, .btn-link:hover { background: var(--bg-card-solid); color: var(--primary); border-color: transparent; box-shadow: none; }

.btn.small, .btn-sm {
  padding: 0.32rem 0.7rem;
  font-size: 0.78rem;
  border-radius: var(--radius-xs);
}
.btn-block { width: 100%; }
.btn-lg { padding: 0.75rem 1.4rem; font-size: 0.95rem; border-radius: var(--radius-sm); }

/* Button group (legacy from Bootstrap 4) */
.btn-group { display: inline-flex; }
.btn-group .btn { box-shadow: none; }
.btn-group .btn + .btn { margin-left: -1px; }
.btn-group .btn:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.btn-group .btn:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }

/* ============================================================
   FORMS
   ============================================================ */
.field, .form-group { margin-bottom: 1.1rem; }
.field-label, .form-group > label,
body label:not(.check):not(.btn) {
  display: block;
  font-size: 0.76rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text);
  margin-bottom: 0.35rem;
}
.field-required { color: var(--danger); margin-left: 2px; }
.field-hint, .form-text { color: var(--text-light); font-size: 0.8rem; margin-top: 4px; }

.field-input, .form-control,
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not([type="button"]):not([type="file"]):not([type="reset"]):not([type="image"]):not([type="range"]):not([type="color"]),
select, textarea {
  width: 100%;
  padding: 0.55rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.9rem;
  background: var(--bg-card-solid);
  color: var(--text);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}
.field-input:hover, .form-control:hover,
input:hover, select:hover, textarea:hover { border-color: var(--text-light); }

.field-input:focus, .form-control:focus,
input:focus, select:focus, textarea:focus {
  outline: 0;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

input[type="checkbox"], input[type="radio"] {
  width: auto;
  margin-right: 6px;
  accent-color: var(--primary);
}

textarea { resize: vertical; min-height: 90px; line-height: 1.55; }

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M4.646 5.646a.5.5 0 0 1 .708 0L8 8.293l2.646-2.647a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-3-3a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  padding-right: 2.25rem;
}
html[data-theme="dark"] select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%239aa3c2' viewBox='0 0 16 16'%3E%3Cpath d='M4.646 5.646a.5.5 0 0 1 .708 0L8 8.293l2.646-2.647a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-3-3a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
}

label.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  font-size: 0.88rem;
}
label.check input { width: auto; }

.stack { display: flex; flex-direction: column; gap: 0.95rem; }
.form-row, .row.gx-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 0.85rem; }

.form-actions, .form-footer-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
html[data-theme="dark"] .table-wrap { backdrop-filter: none; background: var(--bg-card-solid); }
.table-wrap.sticky-head { max-height: min(72vh, 640px); overflow-y: auto; }
.pad-top { padding-top: 1rem; }

table.tbl, table.table, .farm-main table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
table.tbl caption.sr-only,
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
table.tbl thead th, table.table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 0.7rem 0.95rem;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-light);
  background: var(--bg-card-solid);
  border-bottom: 1.5px solid var(--border);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
  white-space: nowrap;
}
table.tbl tbody td, table.table tbody td {
  padding: 0.75rem 0.95rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
  vertical-align: middle;
}
table.tbl tbody tr, table.table tbody tr { transition: background var(--transition-fast); }
table.tbl tbody tr:nth-child(even),
table.tbl-zebra tbody tr:nth-child(even) { background: rgba(99, 102, 241, 0.025); }
html[data-theme="dark"] table.tbl tbody tr:nth-child(even),
html[data-theme="dark"] table.tbl-zebra tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.018); }
table.tbl tbody tr:hover, table.table tbody tr:hover { background: rgba(99, 102, 241, 0.06); }
table.tbl tbody tr:last-child td, table.table tbody tr:last-child td { border-bottom: 0; }
table.tbl-compact td, table.tbl-compact th { padding: 0.55rem 0.7rem; font-size: 0.82rem; }

th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.nowrap, th.nowrap, .nowrap { white-space: nowrap; }
.cell-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.subpage-row { cursor: default; }
.subpage-name-link { color: var(--text); font-weight: 600; }
.subpage-name-link:hover { color: var(--primary); text-decoration: none; }

/* ============================================================
   PILLS / BADGES / STATUS
   ============================================================ */
.pill, .badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 650;
  background: var(--bg-card-solid);
  color: var(--text-light);
  border: 1px solid var(--border);
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.pill.small { font-size: 0.68rem; padding: 0.15rem 0.5rem; }
.pill-strong, .pill.strong {
  background: var(--gradient-primary);
  color: #fff;
  border-color: transparent;
  font-weight: 700;
}

.status-offen, .pill.status-offen { background: var(--info-bg); color: var(--info); border-color: transparent; }
.status-in_bearbeitung, .pill.status-in_bearbeitung { background: var(--warning-bg); color: var(--warning); border-color: transparent; }
.status-erledigt, .pill.status-erledigt { background: var(--success-bg); color: var(--success); border-color: transparent; }
.status-storniert, .pill.status-storniert { background: var(--bg-card-solid); color: var(--text-light); border-color: var(--border); opacity: 0.85; }
.status-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.status-dot.status-offen { background: var(--info); }
.status-dot.status-in_bearbeitung { background: var(--warning); }
.status-dot.status-erledigt { background: var(--success); }
.status-dot.status-storniert { background: var(--text-light); opacity: 0.6; }

.bit-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.bit-pill.bit-yes { background: var(--success-bg); color: var(--success); }
.bit-pill.bit-no { background: var(--bg-card-solid); color: var(--text-light); border: 1px solid var(--border); }

.count-pill {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary);
  border: 1px solid rgba(99, 102, 241, 0.18);
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.25);
  color: var(--primary);
}

/* ============================================================
   FLASH / ALERTS
   ============================================================ */
.alert, .flash {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.8rem 1.1rem;
  border-radius: var(--radius-sm);
  border-left: 4px solid transparent;
  background: var(--bg-card-solid);
  color: var(--text);
  margin: 0 0 1rem;
  font-size: 0.88rem;
  font-weight: 500;
  animation: slideInDown 0.3s ease backwards;
}
.alert.alert-success, .flash.success { background: var(--success-bg); color: #166534; border-left-color: var(--success); }
.alert.alert-danger, .flash.danger, .alert.alert-error { background: var(--danger-bg); color: #991b1b; border-left-color: var(--danger); }
.alert.alert-warning, .flash.warning { background: var(--warning-bg); color: #92400e; border-left-color: var(--warning); }
.alert.alert-info, .flash.info { background: var(--info-bg); color: #1e40af; border-left-color: var(--info); }
html[data-theme="dark"] .alert.alert-success, html[data-theme="dark"] .flash.success { color: #86efac; }
html[data-theme="dark"] .alert.alert-danger, html[data-theme="dark"] .flash.danger { color: #fca5a5; }
html[data-theme="dark"] .alert.alert-warning, html[data-theme="dark"] .flash.warning { color: #fcd34d; }
html[data-theme="dark"] .alert.alert-info, html[data-theme="dark"] .flash.info { color: #93c5fd; }
.flash-close, .alert .close {
  margin-left: auto;
  background: none;
  border: 0;
  color: inherit;
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0.6;
  padding: 0 0.4rem;
}
.flash-close:hover, .alert .close:hover { opacity: 1; }
.alert-dismissible { padding-right: 2.5rem; position: relative; }
.alert-dismissible .close { position: absolute; right: 0.5rem; top: 50%; transform: translateY(-50%); }

/* ============================================================
   DASHBOARD specific
   ============================================================ */
.dashboard-stats { margin-bottom: 1.5rem; }
.dashboard-status-card { padding: 1.25rem 1.35rem; }
.dashboard-status-header { padding-bottom: 0.75rem; margin-bottom: 0.85rem; }
.status-strip-wrap { display: flex; flex-direction: column; gap: 0.85rem; }
.status-strip {
  display: flex;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
}
.status-strip-seg { display: block; }
.status-strip-seg.status-offen { background: var(--info); }
.status-strip-seg.status-in_bearbeitung { background: var(--warning); }
.status-strip-seg.status-erledigt { background: var(--success); }
.status-strip-seg.status-storniert { background: var(--text-light); opacity: 0.5; }
.status-legend {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 1.2rem;
  flex-wrap: wrap;
}
.status-legend li { display: inline-flex; align-items: center; gap: 6px; font-size: 0.82rem; color: var(--text-light); }
.status-legend-val { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }

.grid { display: grid; gap: 1.25rem; }
.grid.two, .dashboard-charts-row { grid-template-columns: 2fr 1fr; }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.dashboard-panel { padding: 1.25rem 1.35rem; }
.dashboard-panel-head { padding-bottom: 0.75rem; margin-bottom: 0.85rem; }
.dashboard-panel-head .panel-sub { font-size: 0.82rem; color: var(--text-light); margin: 4px 0 0; }
.panel-badge {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--primary);
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  padding: 4px 10px;
  border-radius: 999px;
}
.panel-empty { padding: 1rem; text-align: center; }

.bar-list { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; font-size: 0.82rem; }
.bar-row-date { color: var(--text-light); font-variant-numeric: tabular-nums; }
.bar-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.08);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: 999px;
  transition: width 0.5s ease;
}
.bar-val { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); }
.bar-count { color: var(--text-light); font-weight: 400; font-size: 0.78rem; }

.dashboard-day-table { margin-top: 1rem; max-height: 320px; }
.dashboard-side-table, .dashboard-month-table, .dashboard-recent-table { max-height: 360px; }

.dashboard-api-note { margin-top: 1rem; }
.dashboard-recent-empty { padding: 2rem 1rem; }

.recent-amount { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.recent-when { font-size: 0.82rem; color: var(--text-light); font-variant-numeric: tabular-nums; }
.recent-title-muted a { font-style: italic; color: var(--text-light); }

/* ============================================================
   ORDERS / LIST PAGES
   ============================================================ */
.farm-subpage { display: flex; flex-direction: column; }
.persons-page, .orders-page, .dashboard-page, .companies-page, .users-page, .price-list-page, .leistungen-page { display: contents; }
.orders-toolbar, .orders-toolbar-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
html[data-theme="dark"] .orders-toolbar { background: var(--bg-card-solid); }
.orders-sum { display: flex; flex-direction: column; gap: 4px; min-width: 200px; }
.orders-sum-label { font-size: 0.7rem; font-weight: 650; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-light); }
.orders-sum-value {
  font-family: var(--font-mono);
  font-size: clamp(1.3rem, 3vw, 1.65rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.orders-sum-hint { font-size: 0.8rem; color: var(--text-light); }
.orders-amount { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.orders-date { font-variant-numeric: tabular-nums; white-space: nowrap; }
.orders-info-snippet { color: var(--text-light); font-size: 0.82rem; }
.orders-plants-summary { display: inline-flex; gap: 6px; align-items: center; }

/* ============================================================
   ORDERS LIST — klassische breite Tabelle
   ============================================================ */
.orders-table thead th {
  font-size: 0.68rem;
  padding: 0.6rem 0.8rem;
  white-space: nowrap;
}
.orders-table tbody td {
  padding: 0.65rem 0.8rem;
  vertical-align: middle;
  font-size: 0.84rem;
  white-space: nowrap;
}
.orders-table tbody td.muted { white-space: normal; max-width: 200px; }
.orders-table .cell-id a { font-family: var(--font-mono); font-weight: 600; color: var(--primary); text-decoration: none; }
.orders-table .cell-title { max-width: 220px; white-space: normal; }
.orders-table .cell-title a { color: var(--text); font-weight: 600; text-decoration: none; }
.orders-table .cell-title a:hover { color: var(--primary); }
.orders-table .cell-title-muted a { color: var(--text-light); font-style: italic; font-weight: 500; }
.orders-table .orders-date { font-variant-numeric: tabular-nums; }
.orders-table .cell-actions { display: flex; gap: 4px; justify-content: flex-end; }

/* Zahlen-Spalten: Mono, tabular-nums, rechtsbündig. */
.orders-table td.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.84rem;
}

/* Menge × Betrag — beides untereinander in einer Zelle, rechtsbündig.
   Menge oben (klein, muted), Betrag unten (fett). Beide haben die gleiche
   rechte Kante, so dass sie in jeder Zeile sauber untereinander stehen. */
.orders-table .orders-qty-amount {
  text-align: right;
  line-height: 1.25;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}
.oqa-qty {
  font-size: 0.78rem;
  color: var(--text-light);
  font-variant-numeric: tabular-nums;
}
.oqa-amount {
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

.empty-state {
  text-align: center;
  padding: 2.5rem 1.25rem;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text-light);
}
.empty-state h3, .empty-state h2 { color: var(--text); margin-bottom: 0.4rem; }

/* ============================================================
   AUTH / LOGIN
   ============================================================ */
body.guest, body.guest .guest-bg {
  background: var(--gradient-bg);
  min-height: 100vh;
}
body.guest {
  display: flex;
  flex-direction: column;
  margin: 0;
}
.guest-bg {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.guest-bg::before, .guest-bg::after {
  content: '';
  position: absolute;
  pointer-events: none;
  z-index: 0;
}
.guest-bg::before {
  top: -20%;
  left: -10%;
  width: 60%;
  height: 70%;
  background: radial-gradient(ellipse, rgba(99, 102, 241, 0.18), transparent 70%);
}
.guest-bg::after {
  bottom: -20%;
  right: -15%;
  width: 70%;
  height: 70%;
  background: radial-gradient(ellipse, rgba(139, 92, 246, 0.14), transparent 70%);
}

.guest-inner {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2rem 1rem 3rem;
}

.guest-flash-stack { width: min(440px, 100%); margin-bottom: 1rem; }

.auth-panel {
  width: min(960px, 100%);
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 0;
  border-radius: calc(var(--radius) + 4px);
  overflow: hidden;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xl);
  animation: fadeInUp 0.5s ease;
}
html[data-theme="dark"] .auth-panel { background: var(--bg-card-solid); backdrop-filter: none; }

.auth-aside {
  padding: 2.75rem 2.25rem;
  background: linear-gradient(160deg, rgba(99, 102, 241, 0.10), rgba(139, 92, 246, 0.08));
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.25rem;
  border-right: 1px solid var(--border);
}
.auth-aside-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.5rem;
}
.auth-aside-brand .farm-brand-mark {
  width: 44px;
  height: 44px;
  font-size: 19px;
  animation: float 3.4s ease-in-out infinite;
}
.auth-aside-brand-name {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}
.auth-aside h2 {
  font-size: 1.5rem;
  font-weight: 750;
  background: linear-gradient(135deg, var(--primary), #a78bfa, #c084fc);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  letter-spacing: -0.025em;
  line-height: 1.2;
}
.auth-aside p { color: var(--text-light); font-size: 0.92rem; max-width: 38ch; line-height: 1.55; }
.auth-aside-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.auth-aside-list li {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 0.88rem;
  color: var(--text);
}
.auth-aside-list li::before {
  content: '✓';
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.78rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.auth-card-main {
  padding: 2.75rem 2.5rem;
  background: var(--bg-card-solid);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.auth-card-main .eyebrow { color: var(--primary); margin-bottom: 8px; }
.auth-card-main h1 {
  font-size: 1.7rem;
  font-weight: 750;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--primary), #a78bfa, #c084fc);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  margin-bottom: 0.4rem;
}
.auth-card-main .muted { margin-bottom: 1.5rem; }
.auth-card-main form.stack label {
  text-transform: none;
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0;
  color: var(--text);
}
.auth-card-main .btn.primary, .auth-card-main .btn-primary {
  width: 100%;
  justify-content: center;
  padding: 0.75rem;
  font-size: 0.95rem;
  margin-top: 4px;
}

.auth-card-simple {
  width: min(440px, 100%);
  padding: 2.5rem 2.25rem;
  border-radius: calc(var(--radius) + 4px);
  border: 1px solid var(--border);
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-xl);
  animation: fadeInUp 0.5s ease;
}
html[data-theme="dark"] .auth-card-simple { background: var(--bg-card-solid); backdrop-filter: none; }

.guest-theme-toggle {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 60;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  color: var(--text-light);
  box-shadow: var(--shadow);
  cursor: pointer;
}
.guest-theme-toggle:hover { color: var(--primary); border-color: var(--primary); }

/* Error pages (404 / 500) */
body.error-shell {
  margin: 0;
  min-height: 100vh;
  background: var(--gradient-bg);
  font-family: var(--font);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}
.error-shell-inner {
  width: 100%;
  max-width: 560px;
  text-align: center;
}
.error-shell-inner h1, .error-shell-inner .h4 {
  font-size: 1.7rem;
  font-weight: 750;
  letter-spacing: -0.025em;
  background: linear-gradient(135deg, var(--primary), #a78bfa);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  margin-bottom: 0.5rem;
}
.error-shell-inner p { color: var(--text-light); margin-bottom: 1rem; }
.error-shell-inner .card {
  padding: 2rem;
  border-radius: var(--radius);
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}
body.error-shell .btn-primary {
  background: var(--gradient-primary);
  border: none;
  color: #fff;
}
.error-theme-fab {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 60;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  color: var(--text-light);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
}

/* ============================================================
   BOOTSTRAP-4 GRID BRIDGE (since we drop the BS4 stylesheet)
   Only the minimum used in this app.
   ============================================================ */
.container, .container-sm, .container-md, .container-lg, .container-xl {
  width: 100%;
  margin-right: auto;
  margin-left: auto;
  padding-right: 0.75rem;
  padding-left: 0.75rem;
}
.row {
  display: flex;
  flex-wrap: wrap;
  margin-right: -0.75rem;
  margin-left: -0.75rem;
}
.row > [class^="col-"], .row > [class*=" col-"] {
  position: relative;
  width: 100%;
  padding-right: 0.75rem;
  padding-left: 0.75rem;
}
.col-12 { flex: 0 0 100%; max-width: 100%; }
.col-6, .col-md-6 { flex: 0 0 50%; max-width: 50%; }
@media (max-width: 767.98px) { .col-md-6 { flex: 0 0 100%; max-width: 100%; } }
.col-xl-4 { flex: 0 0 33.3333%; max-width: 33.3333%; }
@media (max-width: 1199.98px) { .col-xl-4 { flex: 0 0 50%; max-width: 50%; } }
@media (max-width: 767.98px) { .col-xl-4 { flex: 0 0 100%; max-width: 100%; } }

/* Spacing helpers used in views */
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mr-1 { margin-right: 0.25rem !important; }
.mr-2 { margin-right: 0.5rem !important; }
.ml-auto { margin-left: auto !important; }
.mr-auto { margin-right: auto !important; }
.py-2 { padding-top: 0.5rem !important; padding-bottom: 0.5rem !important; }
.py-1 { padding-top: 0.25rem !important; padding-bottom: 0.25rem !important; }
.px-3 { padding-left: 1rem !important; padding-right: 1rem !important; }
.px-2 { padding-left: 0.5rem !important; padding-right: 0.5rem !important; }
.d-flex { display: flex !important; }
.d-none { display: none !important; }
.d-block { display: block !important; }
.flex-row { flex-direction: row !important; }
.flex-column { flex-direction: column !important; }
.align-items-center { align-items: center !important; }
.align-items-stretch { align-items: stretch !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-end { justify-content: flex-end !important; }
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }
.text-muted { color: var(--text-light) !important; }
.text-sm, .small { font-size: 0.82rem; }
.font-weight-bold { font-weight: 700 !important; }
.border-bottom-0 { border-bottom: 0 !important; }
.shadow-sm { box-shadow: var(--shadow) !important; }
.w-100 { width: 100% !important; }
.flex-1 { flex: 1 !important; min-width: 0; }

@media (min-width: 768px) {
  .d-md-inline { display: inline !important; }
  .d-md-block { display: block !important; }
}

/* Bootstrap navbar shims (used in topbar) */
.navbar { padding: 0; margin: 0; }
.navbar-expand { flex-wrap: nowrap; }
.navbar-nav { list-style: none; padding: 0; margin: 0; display: flex; }
.navbar-nav .nav-item { list-style: none; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .grid.two, .dashboard-charts-row { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .auth-panel { grid-template-columns: 1fr; }
  .auth-aside { border-right: 0; border-bottom: 1px solid var(--border); padding: 2rem; }
  .auth-card-main { padding: 2rem; }
}

@media (max-width: 860px) {
  :root { --sidebar-width: 0px; }
  .app-sidebar, .farm-aside.farm-sidebar {
    transform: translateX(-100%);
    width: 270px;
    box-shadow: var(--shadow-xl);
  }
  .farm-shell.farm-sidebar-open .farm-aside.farm-sidebar,
  .app-shell.is-sidebar-open .app-sidebar,
  .farm-aside.farm-sidebar.is-open { transform: translateX(0); }
  .farm-work, .app-main { margin-left: 0; }
  .farm-sidebar-toggle { display: inline-flex; }
  .farm-shell.farm-sidebar-open .farm-backdrop,
  .app-shell.is-sidebar-open .farm-backdrop { display: block; }
  .farm-main, .app-main .page-content { padding: 1.1rem 1rem 2.5rem; }
  body.farm-mobile-nav-open { overflow: hidden; }
}

@media (max-width: 640px) {
  .page-head { align-items: stretch; }
  .farm-topbar { padding: 0.6rem 0.85rem; }
  .grid.stats { grid-template-columns: 1fr; }
  .small-box { min-height: 110px; }
  .small-box .inner h3 { font-size: 1.4rem; }
  .order-form-layout { display: block !important; }
  .orders-toolbar { padding: 0.85rem; }
  .orders-sum-value { font-size: 1.2rem; }
}

/* ============================================================
   MISC LEGACY HELPERS (still referenced by views)
   ============================================================ */
.inline-form { display: inline; }
.responsive { width: 100%; overflow-x: auto; }
.farm-subpage > * + * { margin-top: 1.25rem; }
.farm-subpage > .page-head + * { margin-top: 0; }
.order-form-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}
.order-form-card { padding: 1.25rem 1.35rem; }
.order-form-progress {
  list-style: none;
  padding: 0;
  margin: 0.85rem 0 0;
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: var(--text-light);
}
.order-form-progress li { display: inline-flex; align-items: center; gap: 6px; }
.order-form-progress-ix {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.12);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.72rem;
}

.price-list-table .price-list-price { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ============================================================
   ORDER FORM specifics
   ============================================================ */
.form-section-title,
.form-section-title-inline {
  margin: 0 0 0.65rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-light);
}
.form-section-title-inline { margin-bottom: 0.35rem; }
.op-fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem;
  margin: 0 0 1rem;
  background: var(--bg-card-solid);
}
.op-fieldset > legend {
  padding: 0 8px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.farm-row { display: flex; flex-wrap: wrap; gap: 0.85rem; align-items: flex-end; }
.farm-row > * { flex: 1 1 200px; min-width: 0; }
.grow { flex: 1 1 0; min-width: 0; }

/* Segmented radio group */
.choice-radios { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.choice-radios label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card-solid);
  font-size: 0.85rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast);
  margin-bottom: 0;
}
.choice-radios label:has(input:checked) {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.08);
  color: var(--primary);
}
.choice-radios input[type="radio"] { margin: 0; }

.choice-radios--segmented,
.choice-radios--segmented-inline {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.choice-radios--segmented label,
.choice-radios--segmented-inline label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0.36rem 0.85rem;
  border: 0;
  border-radius: calc(var(--radius-sm) - 3px);
  background: transparent;
  color: var(--text-light);
  font-weight: 600;
  font-size: 0.83rem;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.choice-radios--segmented label:hover:not(:has(input:checked)),
.choice-radios--segmented-inline label:hover:not(:has(input:checked)) {
  background: rgba(99, 102, 241, 0.08);
  color: var(--primary);
}
.choice-radios--segmented label:has(input:checked),
.choice-radios--segmented-inline label:has(input:checked) {
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}
.choice-radios--segmented label:has(input:focus-visible),
.choice-radios--segmented-inline label:has(input:focus-visible) {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.choice-radios--segmented input[type="radio"],
.choice-radios--segmented-inline input[type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* Order metrics block (qty, amount, etc.) */
.order-form-metrics-wrap {
  display: grid;
  gap: 0.85rem;
  margin-top: 0.4rem;
}
.order-form-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
}
.order-form-metric-amount {
  font-family: var(--font-mono);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.order-form-hint { font-size: 0.8rem; color: var(--text-light); margin-top: 4px; }

/* Filters card */
.filters-card { padding: 1.1rem 1.25rem; margin-bottom: 1.25rem; }
.filters-form-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}
.filters-form-title { margin: 0; font-size: 0.92rem; font-weight: 700; }
.filters-form-meta { font-size: 0.78rem; color: var(--text-light); }
.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem;
  align-items: end;
}
.filters-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 0.4rem;
}

/* Bootstrap-style outline button used in some forms */
.btn-outline-secondary {
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  color: var(--text-light);
  box-shadow: none;
  font-weight: 500;
}
.btn-outline-secondary:hover { border-color: var(--primary); color: var(--primary); }

/* ============================================================
   ORDER FORM — full layout (Neuer Auftrag / Bearbeiten)
   ============================================================ */
.order-form-page { display: flex; flex-direction: column; gap: 1.25rem; }

.order-form-head { gap: 0.85rem; }
.order-form-head-text { flex: 1; min-width: 0; }
.order-form-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.order-form-progress {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  list-style: none;
  padding: 0;
  margin: 0.85rem 0 0;
}
.order-form-progress li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.07);
  border: 1px solid rgba(99, 102, 241, 0.15);
  font-size: 0.82rem;
  color: var(--text);
}
.order-form-progress-ix {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.72rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Form card */
.order-form-card.card {
  padding: 1.5rem 1.5rem 1.25rem;
  margin-bottom: 0;
}
.order-form-card.card.card-indigo { border-top: 3px solid var(--primary); }

/* Two-column layout */
.order-form-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}
@media (max-width: 980px) {
  .order-form-layout { grid-template-columns: 1fr; gap: 1.25rem; }
}

.order-form-pane {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  min-width: 0;
}
.order-form-pane--contacts { padding-right: 0.25rem; }
.order-form-pane--order {
  padding-left: 1.25rem;
  border-left: 1px solid var(--border);
}
@media (max-width: 980px) {
  .order-form-pane--order { padding-left: 0; border-left: 0; padding-top: 1rem; border-top: 1px solid var(--border); }
}

.order-form-pane .order-form-pane-title,
.order-form-pane > .order-form-pane-title {
  margin: 0;
  padding: 0;
  border-top: 0;
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  text-transform: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.order-form-pane .order-form-pane-title::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 16px;
  border-radius: 2px;
  background: var(--gradient-primary);
  flex-shrink: 0;
}
.order-form-pane-intro {
  margin: 0 0 0.25rem;
  font-size: 0.85rem;
  color: var(--text-light);
}
.small-stack { line-height: 1.5; }
.spaced-check { margin-top: 0.5rem; }
.order-form-req {
  color: var(--danger);
  font-weight: 700;
  text-decoration: none;
  margin-left: 2px;
  border: 0;
}

/* Form-section sub-headers inside a pane */
.order-form-pane .form-section-title {
  margin: 1rem 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-light);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border-top: 0;
}
.order-form-pane .form-section-title::before {
  content: '';
  display: inline-block;
  width: 14px;
  height: 1.5px;
  border-radius: 1px;
  background: var(--primary);
  opacity: 0.7;
}
.order-form-pane > .form-section-title:first-of-type { margin-top: 0.4rem; }

.order-form-pane label:not(.check):not(.btn) {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--text);
  margin-bottom: 0.3rem;
}
.order-form-pane label .muted { font-weight: 400; font-size: 0.82rem; }

/* Fieldsets (Person / Unternehmen / Pflanzen) */
.order-section,
.participant-block,
.order-plants-fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin: 0;
  background: var(--bg-card-solid);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
html[data-theme="dark"] .order-section,
html[data-theme="dark"] .participant-block,
html[data-theme="dark"] .order-plants-fieldset { background: var(--bg); }
.order-section > legend,
.participant-block > legend,
.order-plants-fieldset > legend {
  padding: 0 0.5rem;
  margin-left: -0.5rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.005em;
  text-transform: none;
}

/* The op-fieldset (Stamm-Felder) sits inside the participant-block */
.participant-block .op-fieldset {
  margin-top: 0.4rem;
  background: var(--bg);
  border: 1px dashed var(--border);
  padding: 0.85rem 1rem;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.participant-block .op-fieldset > legend {
  padding: 0 6px;
  margin-left: -4px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-light);
}
.participant-block .op-fieldset[hidden] { display: none; }

.participant-panel { display: flex; flex-direction: column; gap: 0.55rem; }
.participant-panel[hidden] { display: none; }

/* Segmented choice — full-width within form panes (Person/Unternehmen choice) */
.order-form-pane .choice-radios--segmented { width: 100%; }
.order-form-pane .choice-radios--segmented label {
  flex: 1 1 0;
  min-width: 0;
  padding: 0.45rem 0.7rem;
}

/* Inline segmented (Yes/No) — tighter, fixed-width buttons */
.choice-radios--segmented-inline.yn-inline label {
  min-width: 64px;
  padding: 0.32rem 0.95rem;
  font-size: 0.82rem;
}

/* Yes / No grid (Saatgut + In Summen) */
.yn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 0.85rem;
  padding: 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
html[data-theme="dark"] .yn-grid { background: rgba(255, 255, 255, 0.02); }
.yn-field { display: flex; flex-direction: column; gap: 0.45rem; }
.yn-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}
.yn-label .muted { font-weight: 400; font-size: 0.78rem; }
.yn-hint {
  margin: 4px 0 0;
  font-size: 0.78rem;
  color: var(--text-light);
  line-height: 1.45;
}
.seeds-qty-field { margin-top: 0.35rem; }
.seeds-qty-field[hidden] { display: none; }
.seeds-qty-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
}
.seeds-qty-label input {
  margin-top: 0.3rem;
  max-width: 200px;
}
.seeds-received-note-label { margin-top: 0.5rem; display: block; }

/* Metrics grid: Datum / Anzahl / Betrag / Status */
.order-form-metrics-wrap { margin-top: 0.4rem; }
.order-form-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
  gap: 0.75rem;
  padding: 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
html[data-theme="dark"] .order-form-metrics { background: rgba(255, 255, 255, 0.02); }
.order-form-metrics > label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-light);
}
.order-form-metrics > label .muted {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  font-size: 0.76rem;
  color: var(--text-light);
}
.order-form-metric-amount input {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.order-form-metric-amount-head {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.amount-auto-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.14);
  color: var(--primary);
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1px solid rgba(99, 102, 241, 0.25);
  animation: fadeIn 0.2s ease;
}
.amount-auto-badge[hidden] { display: none; }

/* Plant cards */
.order-plants-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.7rem;
  margin-top: 0.25rem;
}
.order-plant-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.75rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}
.order-plant-card:hover { border-color: var(--text-light); }
.order-plant-card .order-plant-fields input,
.order-plant-card .order-plant-fields label { cursor: auto; }
.order-plant-card--active {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.06);
  box-shadow: 0 2px 12px rgba(99, 102, 241, 0.1);
}
.order-plant-head {
  margin: 0;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
}
.order-plant-name { font-weight: 600; }
.order-plant-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.4rem;
  padding-left: 1.5rem;
  font-size: 0.8rem;
}
.order-plant-card:not(.order-plant-card--active) .order-plant-fields {
  opacity: 0.5;
  pointer-events: none;
}
.order-plant-fields label:not(.check) {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  font-size: 0.76rem;
  color: var(--text-light);
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.order-plant-qty { max-width: 100px; padding: 0.35rem 0.55rem; font-size: 0.85rem; }
.order-plant-mini {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-light);
  text-transform: none;
  letter-spacing: 0;
  margin: 0;
}

/* Submit row at the bottom of the form */
.order-form-submit {
  margin-top: 1.25rem;
  padding-top: 1rem;
}
.order-form-submit-inner {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
  align-items: center;
}
.order-form-submit-inner .btn.primary { min-width: 200px; }

/* check label generic refinement inside order form */
.order-form-pane label.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-weight: 500;
  font-size: 0.85rem;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  cursor: pointer;
}
.order-form-pane label.check.spaced-check { display: flex; align-items: flex-start; padding: 0.5rem 0.6rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); }

/* ============================================================
   STAMM-FORM PATTERN (Person / Unternehmen / Leistung)
   Shared layout: identity header + sectioned fieldsets + meta footer.
   ============================================================ */
.stamm-form.card { padding: 0; overflow: hidden; }
.stamm-form.card.card-outline.card-secondary { border-top: 3px solid var(--primary); }

.stamm-form-identity {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  background: linear-gradient(160deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.05));
  border-bottom: 1px solid var(--border);
}
html[data-theme="dark"] .stamm-form-identity {
  background: linear-gradient(160deg, rgba(99, 102, 241, 0.12), rgba(139, 92, 246, 0.07));
}
.stamm-form-avatar {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  border-radius: var(--radius);
  background: var(--gradient-primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
}
.stamm-form-avatar i { font-size: 1.7rem; }
.stamm-form-identity-info { flex: 1; min-width: 0; }
.stamm-form-identity-eyebrow {
  margin: 0 0 2px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--primary);
}
.stamm-form-identity-name {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stamm-form-identity-sub {
  margin: 2px 0 0;
  font-size: 0.83rem;
  color: var(--text-light);
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: center;
}
.stamm-form-identity-sub > * { display: inline-flex; align-items: center; gap: 4px; }
.stamm-form-identity-sub .stamm-id {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary);
}

/* Form body wrapper */
.stamm-form-body {
  padding: 1.25rem 1.5rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Sections inside the stamm-form */
.stamm-form-section {
  margin: 0;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card-solid);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
html[data-theme="dark"] .stamm-form-section { background: rgba(255, 255, 255, 0.018); }
.stamm-form-section > legend,
.stamm-form-section-head {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-light);
}
.stamm-form-section > legend i,
.stamm-form-section-head i {
  font-size: 0.95rem;
  color: var(--primary);
  opacity: 0.85;
}

/* Field grid inside a section */
.stamm-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  gap: 0.75rem;
}
.stamm-form-section > label:not(.check),
.stamm-form-section .stamm-row > label:not(.check) {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text);
}
.stamm-form-section label .muted { font-weight: 400; font-size: 0.78rem; }

/* Input group with leading icon */
.input-group-icon {
  position: relative;
  display: flex;
  align-items: stretch;
}
.input-group-icon > i {
  position: absolute;
  top: 50%;
  left: 0.7rem;
  transform: translateY(-50%);
  color: var(--text-light);
  pointer-events: none;
  font-size: 0.92rem;
}
.input-group-icon > input,
.input-group-icon > select {
  padding-left: 2.1rem;
  width: 100%;
}

/* Suffix variant (e.g., €) */
.input-group-suffix { position: relative; display: flex; }
.input-group-suffix > input { padding-right: 2.1rem; width: 100%; }
.input-group-suffix > .suffix {
  position: absolute;
  top: 50%;
  right: 0.85rem;
  transform: translateY(-50%);
  color: var(--text-light);
  font-weight: 600;
  pointer-events: none;
}

/* Meta footer (when editing) */
.stamm-form-meta {
  display: flex;
  align-items: center;
  gap: 1.15rem;
  flex-wrap: wrap;
  padding: 0.75rem 1.5rem;
  margin: 0.5rem 0 0;
  border-top: 1px dashed var(--border);
  font-size: 0.78rem;
  color: var(--text-light);
}
.stamm-form-meta > * { display: inline-flex; align-items: center; gap: 5px; }
.stamm-form-meta i { font-size: 0.88rem; opacity: 0.75; }

/* Submit row override for stamm forms */
.stamm-form-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 1rem 1.5rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
html[data-theme="dark"] .stamm-form-actions { background: rgba(255, 255, 255, 0.02); }
.stamm-form-actions .btn.primary { min-width: 200px; }
.stamm-form-actions .btn:not(.primary) {
  background: transparent;
  border: 1px solid transparent;
  box-shadow: none;
  color: var(--text-light);
}
.stamm-form-actions .btn:not(.primary):hover {
  background: var(--bg-card-solid);
  border-color: var(--border);
  color: var(--primary);
}
