/*
 * ERP — Oracle Cloud ERP (Redwood Design System)
 * Enterprise UI · Clean · Information-dense · Oracle Fusion inspired
 */

/* ══════════════════════════════════════════════════════════════
   1. DESIGN TOKENS — Oracle Redwood
   ══════════════════════════════════════════════════════════════ */
:root {
  --ui-font: "Oracle Sans", "Noto Sans", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --ui-mono: "JetBrains Mono", "Cascadia Mono", "SFMono-Regular", Menlo, Consolas, monospace;

  /* ─ Page & surface ─ */
  --ui-bg:            #f5f5f8;
  --ui-bg-accent:     #ebe8ff;
  --ui-surface:       #ffffff;
  --ui-surface-solid: #ffffff;
  --ui-surface-2:     #f9f9fb;
  --ui-filter-bg:     #f0f0f8;

  /* ─ Shell header (Oracle dark charcoal-purple) ─ */
  --ui-shell-bg:      #201e28;
  --ui-shell-text:    #ffffff;
  --ui-shell-icon:    rgba(255,255,255,0.78);
  --ui-shell-hover:   rgba(255,255,255,0.10);
  --ui-shell-border:  rgba(255,255,255,0.18);
  --ui-shell-product: rgba(255,255,255,0.95);

  /* ─ Oracle brand red ─ */
  --oracle-red:       #c74634;
  --oracle-red-hover: #a83828;

  /* ─ Sidebar ─ */
  --ui-nav-bg:          #ffffff;
  --ui-nav-width:       240px;
  --ui-nav-text:        #1a1b2e;
  --ui-nav-text-hover:  #0070e0;
  --ui-nav-hover-bg:    #f0f0f8;
  --ui-nav-active-bg:   #e0e8ff;
  --ui-nav-active-text: #0050a8;
  --ui-nav-section:     #6f7278;
  --ui-nav-divider:     #e6e6ea;
  --ui-nav-icon:        #6f7278;

  /* ─ Layout spacing ─ */
  --ui-content-pad:   1.125rem 1.5rem;

  /* ─ Border & shadow ─ */
  --ui-border:        #dfe3e8;
  --ui-border-strong: #b8bcc4;
  --ui-shadow-sm:     0 1px 3px rgba(30,24,50,0.07), 0 1px 2px rgba(30,24,50,0.04);
  --ui-shadow-md:     0 2px 8px rgba(30,24,50,0.12), 0 1px 4px rgba(30,24,50,0.06);

  /* ─ Typography ─ */
  --ui-text:      #1a1b2e;
  --ui-text-soft: #3d4a5c;
  --ui-muted:     #6f7278;

  /* ─ Accent (Oracle Fusion blue) ─ */
  --ui-accent:        #0070e0;
  --ui-accent-hover:  #005bbb;
  --ui-accent-press:  #004898;
  --ui-accent-light:  #e6f1ff;
  --ui-accent-border: #aaceff;

  /* ─ Danger ─ */
  --ui-danger:        #c74634;
  --ui-danger-hover:  #a83828;
  --ui-danger-bg:     #fff2f0;
  --ui-danger-border: #fcc8c0;

  /* ─ Semantic status ─ */
  --ui-success-bg:     #e8f8ed;
  --ui-success-text:   #1a6633;
  --ui-success-border: #aadcba;

  --ui-warning-bg:     #fff8e6;
  --ui-warning-text:   #7a5200;
  --ui-warning-border: #f5d68a;

  --ui-info-bg:     #e6f1ff;
  --ui-info-text:   #0050a8;
  --ui-info-border: #aaceff;

  /* ─ Table rows ─ */
  --ui-row:          #ffffff;
  --ui-row-alt:      #f9f9fb;
  --ui-row-hover:    #eef1ff;
  --ui-row-selected: #dce8ff;
  --ui-head:         #f0f0f8;

  /* ─ Radii (Oracle Redwood — minimal radius) ─ */
  --ui-radius-sm: 3px;
  --ui-radius-md: 4px;
  --ui-radius-lg: 6px;

  /* ─ Table typography ─ */
  --table-head-size:   11.5px;
  --table-head-line:   1.3;
  --table-head-weight: 700;
}

/* ══════════════════════════════════════════════════════════════
   2. DARK MODE TOKENS
   ══════════════════════════════════════════════════════════════ */
html[data-theme="dark"],
html[data-bs-theme="dark"],
body.theme-dark {
  --ui-bg: #111827;
  --ui-bg-accent: #1a2436;
  --ui-surface: #1f2937;
  --ui-surface-solid: #1f2937;
  --ui-surface-2: #1a2332;
  --ui-filter-bg: #1a2332;

  --ui-shell-bg: #1a1830;
  --ui-shell-text: #ffffff;
  --ui-shell-icon: rgba(255,255,255,0.70);
  --ui-shell-hover: rgba(255,255,255,0.10);
  --ui-shell-border: rgba(255,255,255,0.15);

  --ui-nav-bg: #1c2030;
  --ui-nav-text: #c8ccd8;
  --ui-nav-text-hover: #70b0ff;
  --ui-nav-hover-bg: rgba(255,255,255,0.06);
  --ui-nav-active-bg: rgba(0,112,224,0.22);
  --ui-nav-active-text: #70b0ff;
  --ui-nav-section: rgba(255,255,255,0.35);
  --ui-nav-divider: rgba(255,255,255,0.10);

  --ui-border: #374151;
  --ui-border-strong: #4b5563;
  --ui-shadow-sm: 0 1px 3px rgba(0,0,0,.28);
  --ui-shadow-md: 0 4px 16px rgba(0,0,0,.38);

  --ui-text: #f9fafb;
  --ui-text-soft: #d1d5db;
  --ui-muted: #9ca3af;

  --ui-accent: #3b82f6;
  --ui-accent-hover: #2563eb;
  --ui-accent-press: #1d4ed8;
  --ui-accent-light: #1e3a5f;
  --ui-accent-border: #1e40af;

  --ui-danger: #ef4444;
  --ui-danger-hover: #dc2626;
  --ui-danger-bg: #450a0a;
  --ui-danger-border: #7f1d1d;

  --ui-success-bg: #052e16;
  --ui-success-text: #4ade80;
  --ui-success-border: #14532d;

  --ui-warning-bg: #1c1004;
  --ui-warning-text: #fbbf24;
  --ui-warning-border: #78350f;

  --ui-info-bg: #0c1a3a;
  --ui-info-text: #93c5fd;
  --ui-info-border: #1e3a5f;

  --ui-row: #1f2937;
  --ui-row-alt: #1a2332;
  --ui-row-hover: #1e3050;
  --ui-row-selected: #1e3a5f;
  --ui-head: #1a2332;
}

/* ── Dark-mode overrides for Tailwind slate utilities ─────────────────────
   Tailwind generates concrete hex values — they don't follow CSS variables.
   We remap the full slate scale here so every slate-* class adapts to dark.
   ──────────────────────────────────────────────────────────────────────── */
html[data-theme="dark"] .bg-slate-50,
html[data-theme="dark"] .\!bg-slate-50,
html[data-bs-theme="dark"] .bg-slate-50,
html[data-bs-theme="dark"] .\!bg-slate-50,
body.theme-dark .bg-slate-50,
body.theme-dark .\!bg-slate-50 {
  background-color: var(--ui-surface-solid) !important;
}
html[data-theme="dark"] .bg-slate-100,
html[data-theme="dark"] .\!bg-slate-100,
html[data-bs-theme="dark"] .bg-slate-100,
html[data-bs-theme="dark"] .\!bg-slate-100,
body.theme-dark .bg-slate-100,
body.theme-dark .\!bg-slate-100 {
  background-color: var(--ui-row-alt) !important;
}
html[data-theme="dark"] .bg-slate-200,
html[data-theme="dark"] .\!bg-slate-200,
html[data-bs-theme="dark"] .bg-slate-200,
html[data-bs-theme="dark"] .\!bg-slate-200,
body.theme-dark .bg-slate-200,
body.theme-dark .\!bg-slate-200 {
  background-color: var(--ui-row-hover) !important;
}

html[data-theme="dark"] .hover\:bg-slate-50:hover,
html[data-bs-theme="dark"] .hover\:bg-slate-50:hover,
body.theme-dark .hover\:bg-slate-50:hover {
  background-color: var(--ui-row-hover) !important;
}
html[data-theme="dark"] .hover\:bg-slate-100:hover,
html[data-bs-theme="dark"] .hover\:bg-slate-100:hover,
body.theme-dark .hover\:bg-slate-100:hover {
  background-color: var(--ui-row-selected) !important;
}

html[data-theme="dark"] .text-slate-900,
html[data-bs-theme="dark"] .text-slate-900,
body.theme-dark .text-slate-900 {
  color: var(--ui-text) !important;
}
html[data-theme="dark"] .text-slate-800,
html[data-bs-theme="dark"] .text-slate-800,
body.theme-dark .text-slate-800 {
  color: #dde8ff !important;
}
html[data-theme="dark"] .text-slate-700,
html[data-bs-theme="dark"] .text-slate-700,
body.theme-dark .text-slate-700 {
  color: #c4d4ee !important;
}
html[data-theme="dark"] .text-slate-600,
html[data-bs-theme="dark"] .text-slate-600,
body.theme-dark .text-slate-600 {
  color: var(--ui-muted) !important;
}
html[data-theme="dark"] .text-slate-500,
html[data-bs-theme="dark"] .text-slate-500,
body.theme-dark .text-slate-500 {
  color: #8fa4c0 !important;
}
html[data-theme="dark"] .text-slate-400,
html[data-bs-theme="dark"] .text-slate-400,
body.theme-dark .text-slate-400 {
  color: #7a94b8 !important;
}

html[data-theme="dark"] .hover\:text-slate-700:hover,
html[data-bs-theme="dark"] .hover\:text-slate-700:hover,
body.theme-dark .hover\:text-slate-700:hover {
  color: var(--ui-text) !important;
}

html[data-theme="dark"] .border-slate-100,
html[data-bs-theme="dark"] .border-slate-100,
body.theme-dark .border-slate-100 {
  border-color: #2d3d57 !important;
}
html[data-theme="dark"] .border-slate-200,
html[data-bs-theme="dark"] .border-slate-200,
body.theme-dark .border-slate-200 {
  border-color: var(--ui-border) !important;
}
html[data-theme="dark"] .border-slate-300,
html[data-bs-theme="dark"] .border-slate-300,
body.theme-dark .border-slate-300 {
  border-color: var(--ui-border-strong) !important;
}

/* ══════════════════════════════════════════════════════════════
   3. BASE
   ══════════════════════════════════════════════════════════════ */
*,
*::before,
*::after { box-sizing: border-box; }

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--ui-font);
  color: var(--ui-text);
  background-color: var(--ui-bg);
}

body,
.app-shell,
.main-column,
main {
  background-color: var(--ui-bg) !important;
  color: var(--ui-text) !important;
}

/* ══════════════════════════════════════════════════════════════
   4. APP SHELL
   ══════════════════════════════════════════════════════════════ */
/* Desktop app shell layout: sub-nav on top, content below (SAP Fiori style) */
.app-shell {
  display: flex;
  flex-direction: column !important;
  min-height: calc(100vh - 3.5rem);
}

.main-column {
  min-width: 0;
}

/* ── Oracle Cloud page column ── */
.page-column {
  padding: 1rem 1.375rem 2rem;
  min-width: 0;
}

/* ── Page container: strip double padding from view wrappers ── */
.max-w-\[1400px\],
.max-w-\[1200px\],
.max-w-7xl,
.max-w-6xl {
  max-width: 100% !important;
  width: 100% !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* ── Oracle page header (title + action row) ── */
.page-header,
.mb-4.flex.items-center.justify-between,
.mb-6.flex.items-center.justify-between {
  padding-bottom: 0.75rem !important;
  margin-bottom: 0.875rem !important;
  border-bottom: 1px solid var(--ui-border) !important;
}

a {
  color: color-mix(in srgb, var(--ui-accent) 84%, #ffffff 16%);
}

a:hover {
  color: var(--ui-accent-hover);
}

.text-muted,
.text-slate-400,
.text-slate-500,
.text-slate-600,
.text-slate-700 {
  color: var(--ui-muted) !important;
}

.max-w-\[1400px\] {
  max-width: 100% !important;
  width: 100% !important;
}

/* Global filter sizing: align filter sections with table width */
form[method="get"] .card {
  width: 100% !important;
  max-width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  position: static !important;
}

/* ══════════════════════════════════════════════════════════════
   5. SURFACE CARDS
   ══════════════════════════════════════════════════════════════ */
.card,
.card-header,
.card-body,
.card-footer,
.bg-white,
.\!bg-white,
.bg-slate-50,
.\!bg-slate-50,
.bg-slate-100,
.\!bg-slate-100,
.dropdown-menu,
.modal-content,
.offcanvas,
.overflow-x-auto,
.overflow-auto,
.table-responsive,
.erp-table-shell,
.erp-filter-one-row,
.table-controls-toolbar {
  background: var(--ui-surface) !important;
  color: var(--ui-text) !important;
  border: 1px solid #d1d9e6 !important;
  border-radius: var(--ui-radius-md) !important;
  box-shadow: 0 1px 3px rgba(26,46,74,0.06), 0 1px 2px rgba(26,46,74,0.04) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.card-header {
  background: var(--ui-surface-2) !important;
  border-bottom: 1px solid var(--ui-border) !important;
  border-left: none !important;
  border-right: none !important;
  border-top: none !important;
  border-radius: var(--ui-radius-md) var(--ui-radius-md) 0 0 !important;
  padding: 0.75rem 1rem !important;
  font-weight: 600;
  font-size: 0.875rem;
}

/* Prevent double frame artifacts */
.card > .card-body {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  border-radius: inherit !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* ── Dropdown menu items ── */
.dropdown-menu {
  padding: 0.35rem 0 !important;
  min-width: 200px;
}
.dropdown-item {
  display: flex !important;
  align-items: center !important;
  gap: 0.55rem !important;
  padding: 0.44rem 1rem !important;
  font-size: 0.8125rem !important;
  color: var(--ui-text-soft) !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  text-decoration: none !important;
  width: 100%;
  cursor: pointer;
  transition: background 70ms ease, color 70ms ease;
  white-space: nowrap;
}
.dropdown-item i { font-size: 0.85rem; width: 1rem; text-align: center; flex-shrink: 0; }
.dropdown-item:hover,
.dropdown-item:focus {
  background: var(--ui-surface-2) !important;
  color: var(--ui-text) !important;
}
.dropdown-item.text-danger { color: var(--ui-danger) !important; }
.dropdown-item.text-danger:hover { background: var(--ui-danger-bg) !important; color: var(--ui-danger) !important; }

.dropdown-header {
  font-size: 0.72rem !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  color: var(--ui-muted) !important;
  padding: 0.55rem 1rem 0.25rem !important;
}
.dropdown-divider {
  margin: 0.25rem 0 !important;
  border-top: 1px solid var(--ui-border) !important;
  background: none !important;
  box-shadow: none !important;
}

/* ── Enterprise page header ── */
.page-title,
h1.page-title {
  font-size: 1.125rem !important;
  font-weight: 700 !important;
  color: var(--ui-text) !important;
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin: 0 0 0.1rem !important;
}
.page-subtitle {
  font-size: 0.8rem;
  color: var(--ui-muted);
  margin: 0;
}
/* Page header area */
.page-header,
.mb-4.flex.items-center.justify-between,
.mb-6.flex.items-center.justify-between {
  padding-bottom: 0.875rem !important;
  border-bottom: 1px solid var(--ui-border) !important;
  margin-bottom: 1rem !important;
}

html[data-theme="dark"] .\!bg-slate-50,
html[data-theme="dark"] .\!bg-white,
html[data-bs-theme="dark"] .\!bg-slate-50,
html[data-bs-theme="dark"] .\!bg-white,
body.theme-dark .\!bg-slate-50,
body.theme-dark .\!bg-white {
  background: var(--ui-surface) !important;
  color: var(--ui-text) !important;
  border-color: var(--ui-border) !important;
}

/* Filter containers (kontejneri filtera): identical to Finance .erp-filter-shell in dark mode.
   Targets any card wrapping a GET filter form, regardless of its bg utility
   (!bg-slate-50, !bg-slate-100, !bg-sky-100, bg-white, ...). */
html[data-theme="dark"] .card:has(form[method="get"]),
html[data-bs-theme="dark"] .card:has(form[method="get"]),
body.theme-dark .card:has(form[method="get"]) {
  background: color-mix(in srgb, var(--ui-surface-solid) 90%, #0a111f 10%) !important;
  border: 1px solid color-mix(in srgb, var(--ui-border-strong) 78%, #1d2d46 22%) !important;
  box-shadow: 0 14px 34px rgba(2, 8, 20, 0.42) !important;
}

html[data-theme="dark"] .card:has(form[method="get"]) > .card-body,
html[data-theme="dark"] .card:has(form[method="get"]) > .p-4,
html[data-bs-theme="dark"] .card:has(form[method="get"]) > .card-body,
html[data-bs-theme="dark"] .card:has(form[method="get"]) > .p-4,
body.theme-dark .card:has(form[method="get"]) > .card-body,
body.theme-dark .card:has(form[method="get"]) > .p-4 {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

/* ══════════════════════════════════════════════════════════════
   6. ORACLE CLOUD ERP / REDWOOD SHELL BAR
   ══════════════════════════════════════════════════════════════ */
.app-navbar {
  background: var(--ui-shell-bg) !important;
  border-bottom: 3px solid var(--oracle-red) !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.30) !important;
  backdrop-filter: none !important;
  border-radius: 0 !important;
  height: 56px !important;
}

/* Force inner div to match height */
.app-navbar > div { height: 56px !important; }

/* Sticky sidebar — offset and height for 56px (3.5rem) shell */
.app-sidebar {
  top: 3.5rem !important;
  height: calc(100vh - 3.5rem) !important;
  overflow-y: auto;
}

/* Product logo / brand */
.navbar-home-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 1.25rem 0 0.5rem;
  padding: 0 0.75rem 0 0.25rem;
  color: var(--ui-shell-product) !important;
  text-decoration: none;
  border-right: 1px solid var(--ui-shell-border);
  height: 100%;
}

.navbar-home-brand__icon {
  flex: 0 0 auto;
}

.navbar-home-brand__text {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ui-shell-product);
  line-height: 1;
}

.navbar-home-brand:hover { opacity: 0.88; }

/* ── Hamburger/sandwich toggle — mobile only ── */
.navbar-mobile-toggle {
  display: none !important; /* hidden on desktop by default */
  align-items: center !important;
  justify-content: center !important;
  width: 44px !important;
  height: 100% !important;
  flex-shrink: 0;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  color: var(--ui-shell-icon) !important;
  font-size: 1.35rem !important;
  cursor: pointer;
  padding: 0 !important;
  transition: background 80ms ease, color 80ms ease;
  border-radius: 0 !important;
}
.navbar-mobile-toggle:hover {
  background: var(--ui-shell-hover) !important;
  color: var(--ui-shell-text) !important;
}
@media (max-width: 767px) {
  .navbar-mobile-toggle { display: inline-flex !important; }
}

/* ── Right-side layout container ── */
.navbar-right {
  display: flex !important;
  align-items: stretch !important;
  margin-left: auto !important;
  flex-shrink: 0;
  height: 100%;
}
.navbar-right-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex !important;
  align-items: stretch !important;
  gap: 0;
  height: 100%;
}
.navbar-right-item {
  display: flex !important;
  align-items: stretch !important;
}

/* ── Module selector tabs ── */
.navbar-module-tabs {
  display: flex !important;
  align-items: stretch !important;
  flex: 1 1 0 !important;
  min-width: 0 !important;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.navbar-module-tabs::-webkit-scrollbar { display: none; }

.module-tab {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.4rem !important;
  padding: 0 0.8rem !important;
  height: 100% !important;
  color: rgba(255,255,255,0.65) !important;
  text-decoration: none !important;
  font-size: 0.78rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.04em !important;
  white-space: nowrap;
  background: transparent !important;
  border: 0 !important;
  border-bottom: 3px solid transparent !important;
  transition: color 80ms ease, background 80ms ease, border-color 80ms ease;
}
.module-tab:hover {
  background: rgba(255,255,255,0.09) !important;
  color: rgba(255,255,255,0.92) !important;
  border-bottom-color: rgba(255,255,255,0.3) !important;
}
.module-tab--active {
  color: #ffffff !important;
  background: rgba(255,255,255,0.11) !important;
  border-bottom-color: var(--oracle-red) !important;
}
.module-tab__icon {
  font-size: 0.88rem !important;
  opacity: 0.85;
}
.module-tab--active .module-tab__icon { opacity: 1; }
.module-tab__label { font-size: 0.78rem !important; }

/* ── Omni-search button ── */
.navbar-search-btn {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
  height: 28px !important;
  padding: 0 0.75rem !important;
  margin: auto 0.5rem !important;
  background: rgba(255,255,255,0.08) !important;
  border: 1px solid rgba(255,255,255,0.16) !important;
  border-radius: var(--ui-radius-sm) !important;
  box-shadow: none !important;
  color: rgba(255,255,255,0.78) !important;
  font-size: 0.78rem !important;
  cursor: pointer;
  transition: background 80ms ease, border-color 80ms ease;
  white-space: nowrap;
}
.navbar-search-btn:hover {
  background: rgba(255,255,255,0.13) !important;
  border-color: rgba(255,255,255,0.26) !important;
  color: #ffffff !important;
}
.navbar-search-label { font-size: 0.78rem; }
.navbar-search-kbd {
  font-size: 0.68rem;
  padding: 0.1em 0.35em;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.20);
  border-radius: 2px;
  font-family: var(--ui-mono);
  color: rgba(255,255,255,0.55);
  line-height: 1.4;
}

/* ── Nav icon buttons (chat, notifications, etc.) ── */
.navbar-btn {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.35rem !important;
  padding: 0 0.75rem !important;
  height: 100% !important;
  color: var(--ui-shell-icon) !important;
  text-decoration: none !important;
  font-size: 0.8rem !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  cursor: pointer;
  transition: background 80ms ease, color 80ms ease;
  white-space: nowrap;
}
.navbar-btn:hover,
.navbar-btn--active {
  background: var(--ui-shell-hover) !important;
  color: var(--ui-shell-text) !important;
  text-decoration: none !important;
}
.navbar-label-md { font-size: 0.8rem; }

/* ── User dropdown trigger container ── */
.navbar-user-li {
  display: flex !important;
  align-items: stretch !important;
}
.navbar-user-btn {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
  padding: 0 0.875rem !important;
  height: 100% !important;
  color: var(--ui-shell-icon) !important;
  text-decoration: none !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  cursor: pointer;
  transition: background 80ms ease, color 80ms ease;
  border-left: 1px solid var(--ui-shell-border) !important;
}
.navbar-user-btn:hover,
.navbar-user-btn.show {
  background: var(--ui-shell-hover) !important;
  color: var(--ui-shell-text) !important;
  text-decoration: none !important;
}
.navbar-user-btn:hover .navbar-user-name,
.navbar-user-btn.show .navbar-user-name {
  color: var(--ui-shell-text) !important;
}

/* ── Avatar circle with initials ── */
.user-avatar {
  width: 28px !important;
  height: 28px !important;
  border-radius: 50% !important;
  background: var(--oracle-red) !important;
  color: #ffffff !important;
  font-size: 0.65rem !important;
  font-weight: 700 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0;
  letter-spacing: 0.02em;
  line-height: 1;
  border: 1.5px solid rgba(255,255,255,0.25) !important;
  box-shadow: none !important;
}

/* ── Username text next to avatar ── */
.navbar-user-name {
  font-size: 0.79rem !important;
  font-weight: 500 !important;
  color: rgba(255,255,255,0.85) !important;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ══════════════════════════════════════════════════════════════
   7. SIDEBAR — Oracle Cloud Navigation Panel
   ══════════════════════════════════════════════════════════════ */
/* ── SAP Fiori horizontal sub-nav bar ── */
.app-sidebar {
  display: block !important;
  background: var(--ui-nav-bg) !important;
  border-right: none !important;
  border-bottom: 1px solid var(--ui-border) !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06) !important;
  width: 100% !important;
  height: auto !important;
  overflow: visible !important;
  flex-shrink: 0;
}
/* Inner scroll wrapper: horizontal only */
.app-sidebar > div {
  height: auto !important;
  overflow-x: auto !important;
  overflow-y: visible !important;
  padding: 0 !important;
  scrollbar-width: none;
}
.app-sidebar > div::-webkit-scrollbar { display: none; }
/* Hide collapse toggle — irrelevant in horizontal mode */
.sidebar-collapse-handle { display: none !important; }
/* Horizontal accordion list */
#sidebar-accordion {
  display: flex !important;
  flex-direction: row !important;
  align-items: stretch !important;
  flex-wrap: nowrap !important;
  gap: 0;
  padding: 0 0.75rem !important;
  margin: 0 !important;
  min-height: 40px;
  list-style: none;
}
/* Each group: horizontal row with right-side divider */
#sidebar-accordion > .nav-item.sidebar-group {
  display: flex !important;
  flex-direction: row !important;
  align-items: stretch !important;
  border-right: 1px solid var(--ui-border);
  margin-right: 0.125rem;
  padding-right: 0.125rem;
}
#sidebar-accordion > .nav-item.sidebar-group:last-child { border-right: none; margin-right: 0; padding-right: 0; }
/* Section labels: hidden in horizontal mode */
.app-sidebar .sidebar-group-section,
#sidebar-accordion .sidebar-group-section { display: none !important; }
/* Subnav: horizontal flex */
.app-sidebar .sidebar-subnav,
#sidebar-accordion .sidebar-subnav {
  display: flex !important;
  flex-direction: row !important;
  align-items: stretch !important;
  padding: 0 !important;
  margin: 0 !important;
  list-style: none;
}
/* Horizontal nav link overrides */
#sidebar-accordion .nav-link,
.app-sidebar .nav-link {
  height: 40px !important;
  padding: 0 0.85rem !important;
  border-left: none !important;
  border-right: none !important;
  border-top: none !important;
  border-bottom: 2px solid transparent !important;
  border-radius: 0 !important;
  font-size: 0.79rem !important;
  white-space: nowrap !important;
  overflow: visible !important;
}
#sidebar-accordion .nav-link:hover,
.app-sidebar .nav-link:hover {
  background: var(--ui-nav-hover-bg) !important;
  color: var(--ui-nav-text-hover) !important;
  border-left: none !important;
  border-bottom: 2px solid var(--ui-accent-border) !important;
}
#sidebar-accordion .nav-link:hover i,
.app-sidebar .nav-link:hover i { color: var(--ui-accent) !important; }
#sidebar-accordion .nav-link.active,
.app-sidebar .nav-link.active {
  background: var(--ui-nav-active-bg) !important;
  color: var(--ui-nav-active-text) !important;
  border-left: none !important;
  border-bottom: 2px solid var(--ui-accent) !important;
  font-weight: 600 !important;
  box-shadow: none !important;
}
#sidebar-accordion .nav-link.active i,
.app-sidebar .nav-link.active i { color: var(--ui-accent) !important; }
/* Dashboard home link (not inside sidebar-group) */
#sidebar-accordion > .nav-item:not(.sidebar-group) {
  display: flex !important;
  align-items: stretch !important;
  border-right: 1px solid var(--ui-border);
  margin-right: 0.25rem;
}

/* Mobile offcanvas: also light */
.sidebar-offcanvas {
  background: var(--ui-nav-bg) !important;
}

/* ── Nav links: SAP Fiori left-border style ── */
#sidebar-accordion .nav-link,
.app-sidebar .nav-link,
.sidebar-offcanvas .nav-link {
  display: flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
  color: var(--ui-nav-text) !important;
  border-radius: 0 !important;
  font-size: 0.8125rem;
  font-weight: 400;
  line-height: 1.35;
  padding: 0.44rem 1rem 0.44rem 1.125rem !important;
  margin: 0 !important;
  transition: background-color 80ms ease, color 80ms ease;
  border: none !important;
  border-left: 3px solid transparent !important;
  box-shadow: none !important;
  background: transparent !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#sidebar-accordion .nav-link i,
.app-sidebar .nav-link i,
.sidebar-offcanvas .nav-link i {
  color: var(--ui-nav-icon) !important;
  font-size: 0.875rem;
  width: 1rem;
  flex-shrink: 0;
  text-align: center;
}

/* ── Hover ── */
#sidebar-accordion .nav-link:hover,
.app-sidebar .nav-link:hover,
.sidebar-offcanvas .nav-link:hover {
  background: var(--ui-nav-hover-bg) !important;
  color: var(--ui-nav-text-hover) !important;
  border-left-color: var(--ui-accent-border) !important;
  border-radius: 0 !important;
}
#sidebar-accordion .nav-link:hover i,
.app-sidebar .nav-link:hover i,
.sidebar-offcanvas .nav-link:hover i {
  color: var(--ui-accent) !important;
}

/* ── Active: SAP Fiori left blue border ── */
#sidebar-accordion .nav-link.active,
.app-sidebar .nav-link.active,
.sidebar-offcanvas .nav-link.active {
  background: var(--ui-nav-active-bg) !important;
  color: var(--ui-nav-active-text) !important;
  border-left: 3px solid var(--ui-accent) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  font-weight: 600 !important;
}
#sidebar-accordion .nav-link.active i,
.app-sidebar .nav-link.active i,
.sidebar-offcanvas .nav-link.active i {
  color: var(--ui-accent) !important;
}

/* ── Section group labels ── */
.app-sidebar .sidebar-group-section,
#sidebar-accordion .sidebar-group-section,
.sidebar-offcanvas .sidebar-group-section {
  display: block;
  color: var(--ui-nav-section) !important;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.85rem 1rem 0.3rem !important;
  margin: 0 !important;
  user-select: none;
}

/* ── Dividers ── */
.app-sidebar .sidebar-divider,
#sidebar-accordion .sidebar-divider,
.sidebar-offcanvas .sidebar-divider {
  background: var(--ui-nav-divider) !important;
  border: none !important;
  height: 1px !important;
  margin: 0.25rem 0 !important;
  box-shadow: none !important;
}

/* ── Report links ── */
#sidebar-accordion .sidebar-subnav--reports .nav-link,
.app-sidebar .sidebar-subnav--reports .nav-link,
#sidebar-accordion .nav-report-item .nav-link,
.app-sidebar .nav-report-item .nav-link {
  border: none !important;
  border-left: 3px solid transparent !important;
}
#sidebar-accordion .sidebar-subnav--reports .nav-link.active,
.app-sidebar .sidebar-subnav--reports .nav-link.active,
#sidebar-accordion .nav-report-item .nav-link.active,
.app-sidebar .nav-report-item .nav-link.active {
  background: var(--ui-nav-active-bg) !important;
  color: var(--ui-nav-active-text) !important;
  border-left: 3px solid var(--ui-accent) !important;
}

/* ══════════════════════════════════════════════════════════════
   HORIZONTAL SUBNAV BAR — definitive overrides
   These must come AFTER all sidebar nav-link rules to win the cascade.
   ══════════════════════════════════════════════════════════════ */

/* Nav-links in horizontal bar: bottom-border indicator, no left border */
.app-sidebar .nav-link,
#sidebar-accordion .nav-link {
  height: 42px !important;
  padding: 0 0.9rem !important;
  border: none !important;
  border-bottom: 2px solid transparent !important;
  border-left: none !important;
  border-radius: 0 !important;
  white-space: nowrap !important;
  overflow: visible !important;
  text-overflow: unset !important;
}
.app-sidebar .nav-link:hover,
#sidebar-accordion .nav-link:hover {
  background: var(--ui-nav-hover-bg) !important;
  color: var(--ui-nav-text-hover) !important;
  border-left: none !important;
  border-bottom: 2px solid var(--ui-accent-border) !important;
}
.app-sidebar .nav-link:hover i,
#sidebar-accordion .nav-link:hover i { color: var(--ui-accent) !important; }
.app-sidebar .nav-link.active,
#sidebar-accordion .nav-link.active {
  background: var(--ui-nav-active-bg) !important;
  color: var(--ui-nav-active-text) !important;
  font-weight: 600 !important;
  border-left: none !important;
  border-bottom: 2px solid var(--ui-accent) !important;
  box-shadow: none !important;
}
.app-sidebar .nav-link.active i,
#sidebar-accordion .nav-link.active i { color: var(--ui-accent) !important; }

/* Dividers: vertical separators (not horizontal 1px strips) */
.app-sidebar .sidebar-divider,
#sidebar-accordion .sidebar-divider {
  width: 1px !important;
  height: 22px !important;
  min-height: 22px !important;
  margin: 0 0.375rem !important;
  padding: 0 !important;
  background: var(--ui-border) !important;
  border: none !important;
  align-self: center !important;
  flex-shrink: 0;
}

/* Hide the in-page procurement toolbar on desktop — sidebar handles navigation */
@media (min-width: 768px) {
  .erp-module-toolbar { display: none !important; }
}

.navbar-group-tabs {
  flex: 1 1 0 !important;
  min-width: 0 !important;
}

.navbar-group-tabs .nav-group-tab {
  flex: 1 1 0 !important;
  justify-content: center !important;
  text-align: center !important;
  min-width: 0 !important;
}

.nav-group-tab .module-link-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 0.65rem;
  font-size: 1.6rem;
  flex-shrink: 0;
  background: transparent !important;
}

.nav-group-tab .module-link-text {
  display: inline-flex;
}

.module-link-icon--finance { color: #1d4ed8 !important; }
.module-link-icon--crm { color: #0c4a6e !important; }
.module-link-icon--procurement { color: #15803d !important; }
.module-link-icon--wms { color: #7c3aed !important; }
.module-link-icon--tms { color: #b45309 !important; }
.module-link-icon--manufacturing { color: #be123c !important; }
.module-link-icon--hrm { color: #4338ca !important; }
.module-link-icon--fsm { color: #4d7c0f !important; }
.module-link-icon--reports { color: #d97706 !important; }
.module-link-icon--platform { color: #0f172a !important; }

.app-footer {
  padding-block: calc(var(--spacing) * 1.5) !important;
}

/* Top-bar main menu tabs */
.nav-group-tab {
  color: var(--ui-shell-icon) !important;
  font-size: 0.78rem !important;
  letter-spacing: 0.01em;
  transition: background-color 80ms ease, color 80ms ease;
}

.nav-group-tab:hover {
  background: var(--ui-shell-hover) !important;
  color: var(--ui-shell-text) !important;
}

.nav-group-tab.active {
  background: rgba(255,255,255,0.18) !important;
  color: #ffffff !important;
}

/* ══════════════════════════════════════════════════════════════
   20. ELECTRON WINDOW CONTROLS
   ══════════════════════════════════════════════════════════════ */
/* Electron top line tuning (menu, search, user + window controls) */
html.electron .app-navbar {
  font-size: 14px !important;
  -webkit-app-region: drag;
}

html.electron .app-navbar a,
html.electron .app-navbar button,
html.electron .app-navbar input,
html.electron .app-navbar [role="button"],
html.electron .app-navbar .nav-group-tab,
html.electron .app-navbar .navbar-home-brand,
html.electron .app-navbar .omni-search-trigger,
html.electron .app-navbar #userDropdown,
html.electron .app-navbar .win-ctrl,
html.electron .app-navbar .dropdown-menu,
html.electron .electron-nav-btns {
  -webkit-app-region: no-drag;
}

html.electron .app-navbar .nav-group-tab,
html.electron .app-navbar .omni-search-trigger,
html.electron .app-navbar #userDropdown,
html.electron .app-navbar .navbar-home-brand,
html.electron .app-navbar .btn {
  font-size: 0.78rem !important;
}

html.electron .app-navbar .nav-group-tab {
  padding-left: 0.5rem !important;
  padding-right: 0.5rem !important;
}

html.electron .app-navbar .omni-search-trigger i,
html.electron .app-navbar #userDropdown i,
html.electron .app-navbar .nav-group-tab i {
  font-size: 14px !important;
}

html.electron .app-navbar .nav-group-tab .module-link-icon {
  width: 2.6rem !important;
  height: 2.6rem !important;
  font-size: 1.6rem !important;
}

html.electron .electron-window-controls,
html.electron .electron-standalone-controls {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.25rem !important;
}

html.electron .electron-window-controls .win-ctrl,
html.electron .electron-standalone-controls .win-ctrl,
html.electron .app-navbar .win-ctrl {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 34px !important;
  height: 34px !important;
  min-width: 34px !important;
  min-height: 34px !important;
  padding: 0 !important;
  margin: 0 !important;
  color: var(--ui-text) !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  outline: none !important;
}

html.electron .electron-window-controls .win-ctrl:hover,
html.electron .electron-window-controls .win-ctrl:focus,
html.electron .electron-window-controls .win-ctrl:active,
html.electron .electron-standalone-controls .win-ctrl:hover,
html.electron .electron-standalone-controls .win-ctrl:focus,
html.electron .electron-standalone-controls .win-ctrl:active,
html.electron .app-navbar .win-ctrl:hover,
html.electron .app-navbar .win-ctrl:focus,
html.electron .app-navbar .win-ctrl:active {
  background: color-mix(in srgb, var(--ui-surface-solid) 94%, var(--ui-surface)) !important;
}

/* Reusable filter and toolbar strips */
.erp-filter-one-row,
.table-controls-toolbar {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  margin-bottom: 0.6rem !important;
  padding: 0.55rem 0.68rem !important;
}

.erp-filter-one-row > * {
  flex: 0 0 auto;
}

.erp-filter-actions,
.table-controls-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  white-space: nowrap;
}

/* ══════════════════════════════════════════════════════════════
   10. FILTER PANELS — Distinct from content panels
   ══════════════════════════════════════════════════════════════ */
/* Any card wrapping a GET filter form */
.card:has(form[method="get"]),
.erp-filter-shell {
  background: var(--ui-filter-bg) !important;
  border: 1px solid var(--ui-border) !important;
  border-left: 3px solid var(--oracle-red) !important;
  border-radius: var(--ui-radius-md) !important;
  box-shadow: none !important;
  margin-bottom: 0.875rem !important;
}

.card:has(form[method="get"]) .card-body,
.erp-filter-shell .card-body,
.erp-filter-shell > .p-4 {
  padding: 0.75rem 1rem !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

/* Finance filter shells: avoid double-framed card-body in dark mode */
.erp-filter-shell > .card-body,
.erp-filter-shell > .p-4 {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .erp-filter-shell,
html[data-bs-theme="dark"] .erp-filter-shell,
body.theme-dark .erp-filter-shell {
  background: color-mix(in srgb, var(--ui-surface-solid) 90%, #0a111f 10%) !important;
  border-color: color-mix(in srgb, var(--ui-border-strong) 78%, #1d2d46 22%) !important;
  box-shadow: 0 14px 34px rgba(2, 8, 20, 0.42) !important;
}

html[data-theme="dark"] .erp-filter-shell .form-label,
html[data-bs-theme="dark"] .erp-filter-shell .form-label,
body.theme-dark .erp-filter-shell .form-label {
  color: color-mix(in srgb, var(--ui-text) 86%, var(--ui-accent) 14%) !important;
}

/* Filter section inputs: lighter background in dark mode for better contrast */
html[data-theme="dark"] .erp-filter-one-row .form-control,
html[data-theme="dark"] .erp-filter-one-row .form-select,
html[data-theme="dark"] .erp-filter-one-row input:not([type="hidden"]),
html[data-theme="dark"] .erp-filter-one-row select,
html[data-theme="dark"] .erp-filter-shell .form-control,
html[data-theme="dark"] .erp-filter-shell .form-select,
html[data-theme="dark"] .erp-filter-shell input:not([type="hidden"]),
html[data-theme="dark"] .erp-filter-shell select,
html[data-theme="dark"] form[method="get"] .form-control,
html[data-theme="dark"] form[method="get"] .form-select,
html[data-theme="dark"] form[method="get"] input:not([type="hidden"]):not([type="submit"]),
html[data-theme="dark"] form[method="get"] select,
html[data-bs-theme="dark"] .erp-filter-one-row .form-control,
html[data-bs-theme="dark"] .erp-filter-one-row .form-select,
html[data-bs-theme="dark"] .erp-filter-one-row input:not([type="hidden"]),
html[data-bs-theme="dark"] .erp-filter-one-row select,
html[data-bs-theme="dark"] .erp-filter-shell .form-control,
html[data-bs-theme="dark"] .erp-filter-shell .form-select,
html[data-bs-theme="dark"] .erp-filter-shell input:not([type="hidden"]),
html[data-bs-theme="dark"] .erp-filter-shell select,
html[data-bs-theme="dark"] form[method="get"] .form-control,
html[data-bs-theme="dark"] form[method="get"] .form-select,
html[data-bs-theme="dark"] form[method="get"] input:not([type="hidden"]):not([type="submit"]),
html[data-bs-theme="dark"] form[method="get"] select,
body.theme-dark .erp-filter-one-row .form-control,
body.theme-dark .erp-filter-one-row .form-select,
body.theme-dark .erp-filter-one-row input:not([type="hidden"]),
body.theme-dark .erp-filter-one-row select,
body.theme-dark .erp-filter-shell .form-control,
body.theme-dark .erp-filter-shell .form-select,
body.theme-dark .erp-filter-shell input:not([type="hidden"]),
body.theme-dark .erp-filter-shell select,
body.theme-dark form[method="get"] .form-control,
body.theme-dark form[method="get"] .form-select,
body.theme-dark form[method="get"] input:not([type="hidden"]):not([type="submit"]),
body.theme-dark form[method="get"] select {
  background: var(--ui-row-hover) !important;
  border: 1px solid var(--ui-border-strong) !important;
  color: var(--ui-text) !important;
}

/* ══════════════════════════════════════════════════════════════
   12. BUTTONS — Oracle Cloud ERP style
   ══════════════════════════════════════════════════════════════ */
.btn,
button.btn,
a.btn {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.35rem !important;
  height: 30px !important;
  padding: 0 0.875rem !important;
  font-size: 0.8125rem !important;
  font-weight: 600 !important;
  font-family: var(--ui-font) !important;
  line-height: 1 !important;
  border-radius: var(--ui-radius-sm) !important;
  border: 1px solid var(--ui-border) !important;
  background: var(--ui-surface) !important;
  color: var(--ui-text-soft) !important;
  box-shadow: var(--ui-shadow-sm) !important;
  cursor: pointer;
  text-decoration: none !important;
  white-space: nowrap;
  transition: background-color 100ms ease, border-color 100ms ease, color 100ms ease;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.btn:hover,
button.btn:hover,
a.btn:hover {
  background: var(--ui-surface-2) !important;
  border-color: var(--ui-border-strong) !important;
  color: var(--ui-text) !important;
  box-shadow: var(--ui-shadow-sm) !important;
}

.btn:active,
button.btn:active,
a.btn:active {
  transform: translateY(0.5px);
  box-shadow: none !important;
}

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

/* Primary — Oracle uses their blue for primary actions */
.btn-primary,
.btn-nav-active {
  background: var(--ui-accent) !important;
  border-color: var(--ui-accent-hover) !important;
  color: #ffffff !important;
  box-shadow: 0 1px 3px rgba(0,80,168,.30) !important;
}

.btn-primary:hover,
.btn-nav-active:hover {
  background: var(--ui-accent-hover) !important;
  border-color: var(--ui-accent-press) !important;
  color: #ffffff !important;
}

.btn-primary:active,
.btn-nav-active:active {
  background: var(--ui-accent-press) !important;
  border-color: var(--ui-accent-press) !important;
  color: #ffffff !important;
}

/* Secondary */
.btn-secondary,
.btn-outline-secondary {
  background: var(--ui-surface) !important;
  border-color: var(--ui-border) !important;
  color: var(--ui-text-soft) !important;
}

.btn-secondary:hover,
.btn-outline-secondary:hover {
  background: var(--ui-surface-2) !important;
  border-color: var(--ui-border-strong) !important;
  color: var(--ui-text) !important;
}

/* Danger */
.btn-danger,
.btn-outline-danger {
  border-color: var(--ui-danger) !important;
  color: var(--ui-danger) !important;
}

.btn-danger {
  background: var(--ui-danger) !important;
  color: #ffffff !important;
}

.btn-danger:hover {
  background: var(--ui-danger-hover) !important;
  border-color: var(--ui-danger-hover) !important;
  color: #ffffff !important;
}

.btn-outline-danger {
  background: var(--ui-surface) !important;
}

.btn-outline-danger:hover {
  background: var(--ui-danger-bg) !important;
}

/* Sizes */
.btn-sm { height: 24px !important; padding: 0 0.55rem !important; font-size: 0.75rem !important; }
.btn-lg { height: 40px !important; padding: 0 1.1rem !important; font-size: 0.9rem !important; }

/* Square icon button */
.btn-sq,
.btn-icon {
  width: 30px !important;
  height: 30px !important;
  padding: 0 !important;
  justify-content: center !important;
  flex-shrink: 0;
}
.btn-sm.btn-sq,
.btn-sm.btn-icon { width: 24px !important; height: 24px !important; }

/* ══════════════════════════════════════════════════════════════
   13. FORMS — Clean, corporate inputs
   ══════════════════════════════════════════════════════════════ */
.form-control,
.form-select,
.input-group-text,
input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="range"]),
select,
textarea {
  background: var(--ui-surface) !important;
  border: 1px solid var(--ui-border) !important;
  color: var(--ui-text) !important;
  border-radius: var(--ui-radius-sm) !important;
  box-shadow: none !important;
  font-size: 0.8275rem !important;
  height: 32px !important;
  padding: 0 0.6rem !important;
  font-family: var(--ui-font) !important;
  backdrop-filter: none !important;
  transition: border-color 100ms ease, box-shadow 100ms ease;
}

textarea,
.form-control[rows],
.form-control.is-multiline {
  height: auto !important;
  padding: 0.5rem 0.6rem !important;
}

/* Numeric/date consistency */
input[type="number"],
input[inputmode="numeric"],
input[inputmode="decimal"] {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
  font-family: var(--ui-mono) !important;
  width: 100px !important;
}

/* Amount inputs: override with width for 12 digits */
input.erp-amount-input,
input[data-amount="true"],
input[data-amount-field="true"],
input[inputmode="decimal"].erp-amount-input {
  width: 160px !important;
}

/* Date inputs: minimal width */
input[type="date"],
input[type="datetime-local"],
input[type="month"],
input[type="time"],
time,
.erp-mono-value,
.erp-amount {
  font-family: var(--ui-mono) !important;
  font-variant-numeric: tabular-nums;
}

input[type="date"],
input[type="datetime-local"],
input[type="month"],
input[type="time"] {
  width: auto !important;
}

/* Calendar icon for date inputs */
input[type="date"],
input[type="datetime-local"],
input[type="month"] {
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23607496' stroke-width='2'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 0.5rem center !important;
  background-size: 1.2rem auto !important;
  padding-right: 2.2rem !important;
}

/* Remove default calendar icon from webkit browsers */
input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  background: transparent;
}

input[type="date"]::-webkit-outer-spin-button,
input[type="date"]::-webkit-inner-spin-button {
  display: none;
}

/* Calendar icon for flatpickr inputs */
input.flatpickr-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23607496' stroke-width='2'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 0.5rem center !important;
  background-size: 1.2rem auto !important;
  padding-right: 2.2rem !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  width: fit-content !important;
  min-width: 110px !important;
  max-width: 130px !important;
}

/* Hide native browser calendar for alt input */
input.flatpickr-input::-webkit-calendar-picker-indicator {
  display: none !important;
}

input.flatpickr-input::-webkit-outer-spin-button,
input.flatpickr-input::-webkit-inner-spin-button {
  display: none !important;
}

.erp-amount {
  white-space: nowrap;
}

.form-control::placeholder,
input::placeholder,
textarea::placeholder {
  color: var(--ui-muted) !important;
}

/* Product autocomplete - full width filter, no horizontal scroll */
#stock_levels_filter_form {
  width: 100% !important;
}

#stock_levels_filter_form .card {
  width: 100% !important;
  overflow-x: visible !important;
}

#stock_levels_filter_form .card-body {
  overflow-x: visible !important;
}

input.pac-text[data-purpose="stock-filter"] {
  width: 100% !important;
}

.pac-wrapper[data-purpose="stock-filter"] input.pac-text {
  width: 100% !important;
}

/* Remove buttons - square icon only */
.remove-nested-field,
.remove-line,
.remove-line-item,
.remove-claim-line {
  width: 40px !important;
  height: 40px !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0;
  line-height: 1 !important;
  font-size: 0 !important;
}

.remove-nested-field i,
.remove-nested-field .bi,
.remove-line i,
.remove-line .bi,
.remove-line-item i,
.remove-line-item .bi,
.remove-claim-line i,
.remove-claim-line .bi {
  font-size: 1.1rem !important;
  margin: 0 !important;
}

.form-control:focus,
.form-select:focus,
input:focus,
select:focus,
textarea:focus {
  border-color: var(--ui-accent) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ui-accent) 28%, transparent) !important;
  outline: none;
}

/* Select dropdown carrots */
.form-select,
select {
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23607496' d='M6 9L1 4h10z'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 0.75rem center !important;
  background-size: 1rem auto !important;
  padding-right: 2.5rem !important;
}

/* ══════════════════════════════════════════════════════════════
   11. DATA TABLES
   ══════════════════════════════════════════════════════════════ */
table,
.table,
table.min-w-full,
.min-w-full.divide-y,
.min-w-full.text-sm {
  width: 100%;
  border-collapse: separate !important;
  border-spacing: 0;
  margin-bottom: 0;
  color: var(--ui-text) !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
}

/* Table header cells */
table thead th,
.table thead th,
.table-light,
.min-w-full.divide-y > thead > tr > th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--ui-head) !important;
  border-top: 0 !important;
  border-bottom: 2px solid var(--oracle-red) !important;
  border-left: none !important;
  border-right: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  color: var(--ui-text-soft) !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0.45rem 0.75rem !important;
  font-size: var(--table-head-size) !important;
  font-weight: var(--table-head-weight) !important;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* Column separator lines */
table thead th + th,
.table thead th + th,
.min-w-full.divide-y > thead > tr > th + th {
  border-left: 1px solid var(--ui-border) !important;
}

/* Table body cells */
table td,
table th,
.table td,
.table th,
.min-w-full tbody td,
.min-w-full tbody th {
  padding: 0.5rem 0.75rem !important;
  border-top: 0 !important;
  border-left: none !important;
  border-right: none !important;
  border-bottom: 1px solid var(--ui-border) !important;
  vertical-align: middle;
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  font-size: 0.8125rem;
}

/* Row backgrounds */
table tbody tr td,
.table tbody tr td,
.min-w-full tbody tr td { background: var(--ui-row) !important; }

table tbody tr:nth-child(even) td,
.table tbody tr:nth-child(even) td,
.min-w-full tbody tr:nth-child(even) td { background: var(--ui-row-alt) !important; }

table tbody tr:hover td,
.table tbody tr:hover td,
.table-hover tbody tr:hover td,
.min-w-full tbody tr:hover td { background: var(--ui-row-hover) !important; cursor: default; }

/* Selected row */
table tbody tr.is-selected td,
table tbody tr[aria-selected="true"] td,
.table tbody tr.is-selected td,
.table tbody tr[aria-selected="true"] td,
.min-w-full tbody tr.is-selected td,
.min-w-full tbody tr[aria-selected="true"] td {
  background: var(--ui-row-selected) !important;
  box-shadow: inset 3px 0 0 var(--ui-accent) !important;
}

/* Table header font lock */
table thead th,
table thead th *,
.table thead th,
.table thead th *,
.table-light,
.table-light *,
.min-w-full.divide-y > thead > tr > th,
.min-w-full.divide-y > thead > tr > th * {
  font-size: var(--table-head-size) !important;
  line-height: var(--table-head-line) !important;
  font-weight: var(--table-head-weight) !important;
  font-family: var(--ui-font) !important;
  text-transform: uppercase !important;
  letter-spacing: 0.04em !important;
}

table thead th a,
table thead th a *,
.table thead th a,
.table thead th a *,
.min-w-full.divide-y > thead > tr > th a,
.min-w-full.divide-y > thead > tr > th a * {
  font-size: var(--table-head-size) !important;
  line-height: var(--table-head-line) !important;
  font-weight: var(--table-head-weight) !important;
  font-family: var(--ui-font) !important;
  letter-spacing: 0.04em !important;
}

/* Pagination */
.pagy a,
.pagy span,
nav[aria-label="pagination"] a,
nav[aria-label="pagination"] span {
  border-radius: var(--ui-radius-sm) !important;
  border: 1px solid var(--ui-border) !important;
  background: var(--ui-surface) !important;
  color: var(--ui-text) !important;
  box-shadow: var(--ui-shadow-sm) !important;
}

.pagy .current,
nav[aria-label="pagination"] [aria-current="page"] {
  background: var(--ui-accent) !important;
  border-color: var(--ui-accent) !important;
  color: #ffffff !important;
}

/* ══════════════════════════════════════════════════════════════
   14. STATUS BADGES — SAP style (rectangular, not pill)
   ══════════════════════════════════════════════════════════════ */
.badge,
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.18em 0.6em !important;
  font-size: 0.7rem !important;
  font-weight: 600 !important;
  border-radius: 100px !important;
  line-height: 1.4;
  border: 1px solid transparent;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.badge.bg-success,
.status-success {
  background: var(--ui-success-bg) !important;
  color: var(--ui-success-text) !important;
  border-color: var(--ui-success-border) !important;
}

.badge.bg-warning,
.status-warning {
  background: var(--ui-warning-bg) !important;
  color: var(--ui-warning-text) !important;
  border-color: var(--ui-warning-border) !important;
}

.badge.bg-info,
.status-info,
.status-primary {
  background: var(--ui-info-bg) !important;
  color: var(--ui-info-text) !important;
  border-color: var(--ui-info-border) !important;
}

.badge.bg-danger,
.status-danger,
.status-error {
  background: var(--ui-danger-bg) !important;
  color: var(--ui-danger) !important;
  border-color: var(--ui-danger-border) !important;
}

.badge.bg-secondary,
.status-secondary {
  background: var(--ui-surface-2) !important;
  color: var(--ui-muted) !important;
  border-color: var(--ui-border) !important;
}

.badge.bg-primary {
  background: var(--ui-accent-light) !important;
  color: var(--ui-accent) !important;
  border-color: var(--ui-accent-border) !important;
}

/* Utility essentials */
.win-ctrl.is-hidden {
  display: none;
}

.col-checkbox.col-checkbox-fixed {
  width: 2rem;
}

.no-scrollbar-width {
  scrollbar-width: none;
}

.no-scrollbar-width::-webkit-scrollbar {
  display: none;
}

.app-flash-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

#flash_messages {
  position: absolute;
  right: 0.75rem;
  left: auto;
  bottom: 20px;
  z-index: 1100;
  width: min(26rem, calc(100vw - 1.5rem));
  pointer-events: none;
}

.app-shell #flash_messages,
.auth-main #flash_messages {
  position: absolute !important;
  bottom: 20px !important;
}

#flash_messages .app-flash-container {
  align-items: flex-end;
}

#flash_messages .toast-item {
  width: 100%;
  pointer-events: auto;
}

.toast-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.8rem 0.9rem;
  overflow: hidden;
  border-radius: var(--ui-radius-md) !important;
  border: 1px solid var(--ui-border) !important;
  border-left-width: 4px !important;
  background: var(--ui-surface) !important;
  color: var(--ui-text) !important;
  box-shadow: var(--ui-shadow-md, 0 14px 34px rgba(2, 8, 20, 0.22));
}

/* Accent stripe per kind */
.toast-item--success { border-left-color: #16a34a !important; }
.toast-item--warning { border-left-color: #f59e0b !important; }
.toast-item--danger  { border-left-color: #dc2626 !important; }
.toast-item--info,
.toast-item--notice  { border-left-color: var(--ui-accent) !important; }

.toast-icon {
  flex: 0 0 auto;
  margin-top: 0.05rem;
  font-size: 1.15rem;
  line-height: 1.3;
}
.toast-item--success .toast-icon { color: #16a34a; }
.toast-item--warning .toast-icon { color: #f59e0b; }
.toast-item--danger  .toast-icon { color: #dc2626; }
.toast-item--info    .toast-icon,
.toast-item--notice  .toast-icon { color: var(--ui-accent); }

.toast-body {
  flex: 1 1 auto;
  min-width: 0;
}
.toast-title {
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.25;
  margin-bottom: 0.1rem;
}
.toast-message {
  font-size: 0.85rem;
  line-height: 1.35;
  color: color-mix(in srgb, var(--ui-text) 78%, transparent);
  overflow-wrap: anywhere;
}

.toast-close {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0 !important;
  border: 0 !important;
  border-radius: var(--ui-radius-sm) !important;
  background: transparent !important;
  color: color-mix(in srgb, var(--ui-text) 60%, transparent) !important;
  box-shadow: none !important;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  transition: background-color 60ms ease, color 60ms ease;
}
.toast-close:hover {
  background: color-mix(in srgb, var(--ui-text) 10%, transparent) !important;
  color: var(--ui-text) !important;
}

.toast-progress {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 3px;
  transform-origin: left center;
  background: currentColor;
  opacity: 0.5;
}
.toast-item--success .toast-progress { color: #16a34a; }
.toast-item--warning .toast-progress { color: #f59e0b; }
.toast-item--danger  .toast-progress { color: #dc2626; }
.toast-item--info    .toast-progress,
.toast-item--notice  .toast-progress { color: var(--ui-accent); }

.erp-win11-alert-backdrop {
  position: fixed;
  inset: 0;
  z-index: 3200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.3);
  backdrop-filter: blur(6px);
}

.erp-win11-alert-backdrop.is-open {
  display: flex;
}

.erp-win11-alert {
  width: min(28rem, calc(100vw - 2rem));
  border: 1px solid color-mix(in srgb, var(--ui-border) 70%, #ffffff 30%);
  border-radius: 14px;
  background: color-mix(in srgb, var(--ui-surface) 92%, #ffffff 8%);
  color: var(--ui-text);
  box-shadow: 0 26px 54px rgba(15, 23, 42, 0.28);
  transform: translateY(8px) scale(0.985);
  opacity: 0;
  animation: erpWin11DialogIn 160ms ease-out forwards;
}

.erp-win11-alert__header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.9rem 1rem 0.65rem;
}

.erp-win11-alert__icon {
  color: #2563eb;
  font-size: 1.05rem;
}

.erp-win11-alert__icon--confirm {
  color: #f59e0b;
}

.erp-win11-alert__title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 600;
}

.erp-win11-alert__message {
  padding: 0 1rem 0.8rem;
  font-size: 0.95rem;
  line-height: 1.35;
}

.erp-win11-alert__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.8rem 1rem 1rem;
}

.erp-win11-alert__button {
  border: 1px solid color-mix(in srgb, var(--ui-border) 82%, #ffffff 18%);
  border-radius: 999px;
  padding: 0.4rem 0.95rem;
  background: color-mix(in srgb, var(--ui-surface) 94%, #ffffff 6%);
  color: var(--ui-text);
  font-weight: 600;
  transition: background 60ms ease, border-color 60ms ease, transform 60ms ease;
}

.erp-win11-alert__button:hover {
  background: color-mix(in srgb, var(--ui-surface) 86%, #dbeafe 14%);
}

.erp-win11-alert__button--primary {
  border-color: #2563eb;
  background: linear-gradient(180deg, #4f8fff 0%, #2f6ee6 100%);
  color: #ffffff;
}

.erp-win11-alert__button--primary:hover {
  background: linear-gradient(180deg, #5a98ff 0%, #3475f0 100%);
}

.erp-win11-alert__button:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: 2px;
}

@keyframes erpWin11DialogIn {
  from {
    transform: translateY(8px) scale(0.985);
    opacity: 0;
  }

  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@media (max-width: 768px) {
  .erp-filter-one-row,
  .table-controls-toolbar {
    padding: 0.45rem 0.5rem !important;
    gap: 0.4rem;
  }

  table td,
  .table td,
  .min-w-full tbody td {
    font-size: 0.83rem;
    padding: 0.52rem 0.58rem !important;
  }

  table thead th,
  .table thead th,
  .min-w-full.divide-y > thead > tr > th,
  table thead th *,
  .table thead th *,
  .min-w-full.divide-y > thead > tr > th * {
    font-size: 14px !important;
    line-height: 1.2 !important;
  }
}

/* ══════════════════════════════════════════════════════════════
   22. OFFCANVAS + DROPDOWN FUNCTIONAL FIXES
   ══════════════════════════════════════════════════════════════ */

/* Show offcanvas on ALL screen sizes when open (md:hidden is overridden) */
.sidebar-offcanvas.is-open {
  display: block !important;
}
.sidebar-offcanvas-backdrop.is-open {
  display: block !important;
}

/* User dropdown menu — NO !important on right/left so JS pinTopbarDropdown can override */
.navbar-user-menu {
  right: 0;
  left: auto;
  top: calc(100% + 2px);
  min-width: 220px !important;
  border: 1px solid var(--ui-border) !important;
  box-shadow: var(--ui-shadow-md) !important;
}

/* ══════════════════════════════════════════════════════════════
   21. DARK MODE — Surface & filter overrides
   ══════════════════════════════════════════════════════════════ */
html[data-theme="dark"] .card,
html[data-theme="dark"] .card-header,
html[data-theme="dark"] .bg-white,
html[data-theme="dark"] .\!bg-white,
html[data-bs-theme="dark"] .card,
html[data-bs-theme="dark"] .card-header,
html[data-bs-theme="dark"] .bg-white,
html[data-bs-theme="dark"] .\!bg-white,
body.theme-dark .card,
body.theme-dark .card-header,
body.theme-dark .bg-white,
body.theme-dark .\!bg-white {
  background: var(--ui-surface) !important;
  border-color: var(--ui-border) !important;
  color: var(--ui-text) !important;
}

html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="range"]),
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-bs-theme="dark"] .form-control,
html[data-bs-theme="dark"] .form-select,
html[data-bs-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="range"]),
html[data-bs-theme="dark"] select,
html[data-bs-theme="dark"] textarea,
body.theme-dark .form-control,
body.theme-dark .form-select,
body.theme-dark input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="range"]),
body.theme-dark select,
body.theme-dark textarea {
  background: var(--ui-row-alt) !important;
  border-color: var(--ui-border) !important;
  color: var(--ui-text) !important;
}

/* Dark mode buttons */
html[data-theme="dark"] .btn,
html[data-bs-theme="dark"] .btn,
body.theme-dark .btn {
  background: var(--ui-surface) !important;
  border-color: var(--ui-border) !important;
  color: var(--ui-text-soft) !important;
}
html[data-theme="dark"] .btn-primary,
html[data-bs-theme="dark"] .btn-primary,
body.theme-dark .btn-primary {
  background: var(--ui-accent) !important;
  border-color: var(--ui-accent) !important;
  color: #ffffff !important;
}
html[data-theme="dark"] .btn-danger,
html[data-bs-theme="dark"] .btn-danger,
body.theme-dark .btn-danger {
  background: var(--ui-danger) !important;
  border-color: var(--ui-danger) !important;
  color: #ffffff !important;
}

/* ══════════════════════════════════════════════════════════════
   21b. DARK MODE — Navbar, dropdown, toolbar
   ══════════════════════════════════════════════════════════════ */
html[data-theme="dark"] .app-navbar,
html[data-bs-theme="dark"] .app-navbar,
body.theme-dark .app-navbar {
  background: var(--ui-surface) !important;
  border-bottom-color: var(--ui-border) !important;
}

html[data-theme="dark"] .dropdown-menu,
html[data-bs-theme="dark"] .dropdown-menu,
body.theme-dark .dropdown-menu {
  background: var(--ui-surface) !important;
  border-color: var(--ui-border) !important;
  color: var(--ui-text) !important;
}

html[data-theme="dark"] .dropdown-item,
html[data-bs-theme="dark"] .dropdown-item,
body.theme-dark .dropdown-item {
  color: var(--ui-text) !important;
}

html[data-theme="dark"] .dropdown-item:hover,
html[data-bs-theme="dark"] .dropdown-item:hover,
body.theme-dark .dropdown-item:hover {
  background: var(--ui-surface-2) !important;
  color: var(--ui-text) !important;
}

html[data-theme="dark"] .dropdown-header,
html[data-bs-theme="dark"] .dropdown-header,
body.theme-dark .dropdown-header {
  color: var(--ui-muted) !important;
}

html[data-theme="dark"] .dropdown-divider,
html[data-bs-theme="dark"] .dropdown-divider,
body.theme-dark .dropdown-divider {
  border-color: var(--ui-border) !important;
}

html[data-theme="dark"] table tbody tr td,
html[data-bs-theme="dark"] table tbody tr td,
body.theme-dark table tbody tr td { background: var(--ui-row) !important; }

html[data-theme="dark"] table tbody tr:nth-child(even) td,
html[data-bs-theme="dark"] table tbody tr:nth-child(even) td,
body.theme-dark table tbody tr:nth-child(even) td { background: var(--ui-row-alt) !important; }

html[data-theme="dark"] table tbody tr:hover td,
html[data-bs-theme="dark"] table tbody tr:hover td,
body.theme-dark table tbody tr:hover td { background: var(--ui-row-hover) !important; }

html[data-theme="dark"] table thead th,
html[data-bs-theme="dark"] table thead th,
body.theme-dark table thead th {
  background: var(--ui-head) !important;
  color: var(--ui-text-soft) !important;
  border-bottom-color: var(--ui-border-strong) !important;
}

html[data-theme="dark"] .modal-content,
html[data-bs-theme="dark"] .modal-content,
body.theme-dark .modal-content {
  background: var(--ui-surface) !important;
  border-color: var(--ui-border) !important;
  color: var(--ui-text) !important;
}

html[data-theme="dark"] .modal-header,
html[data-bs-theme="dark"] .modal-header,
body.theme-dark .modal-header {
  background: var(--ui-surface-2) !important;
  border-bottom-color: var(--ui-border) !important;
}

html[data-theme="dark"] .modal-footer,
html[data-bs-theme="dark"] .modal-footer,
body.theme-dark .modal-footer {
  background: var(--ui-surface-2) !important;
  border-top-color: var(--ui-border) !important;
}

/* ══════════════════════════════════════════════════════════════
   SUBNAV GROUP DROPDOWNS
   Section headers become clickable dropdown buttons; subnav lists
   appear as positioned dropdown menus on click.
   JS wraps each section+subnav pair in a .sg-item container.
   ══════════════════════════════════════════════════════════════ */

/* Hide subnav lists inside sidebar-groups immediately so they don't flash inline
   before JS wraps them into .sg-item dropdown containers. The more-specific
   .sg-item rules below take over once JS has run. */
#sidebar-accordion > .nav-item.sidebar-group > .sidebar-subnav {
  display: none !important;
}

/* Show section headers as group-button triggers */
#sidebar-accordion .sidebar-group-section {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.25rem !important;
  padding: 0 0.8rem !important;
  height: 42px !important;
  font-size: 0.71rem !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  color: var(--ui-nav-text) !important;
  border-bottom: 2px solid transparent !important;
  border-left: none !important;
  white-space: nowrap !important;
  cursor: pointer !important;
  user-select: none !important;
  background: transparent !important;
  transition: background 80ms, color 80ms !important;
}
#sidebar-accordion .sidebar-group-section:hover {
  background: var(--ui-nav-hover-bg) !important;
  color: var(--ui-nav-text-hover) !important;
}

/* Container wrapping one section + its subnav(s) */
.sg-item {
  position: relative;
  display: inline-flex;
  align-items: stretch;
}

/* Active-group: highlight the button */
.sg-item--active > .sidebar-group-section,
.sg-item--open > .sidebar-group-section {
  color: var(--ui-nav-active-text) !important;
  border-bottom-color: var(--ui-accent) !important;
}

/* Dropdown: hidden by default.
   position:fixed is set by JS (getBoundingClientRect) so the panel escapes
   the overflow:auto clipping context of .app-sidebar > div. */
#sidebar-accordion .sg-item .sidebar-subnav {
  display: none !important;
  position: fixed !important;
  z-index: 9999 !important;
  flex-direction: column !important;
  min-width: 224px !important;
  padding: 0.3rem 0 !important;
  margin: 0 !important;
  background: var(--ui-bg) !important;
  border: 1px solid var(--ui-border) !important;
  border-top: 2px solid var(--ui-accent) !important;
  border-radius: 0 0 var(--ui-radius-sm) var(--ui-radius-sm) !important;
  box-shadow: 0 6px 24px rgba(0,0,0,0.18) !important;
  list-style: none !important;
}

/* Show dropdown when parent .sg-item has --open */
#sidebar-accordion .sg-item--open .sidebar-subnav {
  display: flex !important;
}

/* Nav-links inside the dropdown: vertical SAP-style (left border, auto height) */
#sidebar-accordion .sg-item .nav-link {
  height: auto !important;
  min-height: 36px !important;
  padding: 0.42rem 1rem 0.42rem 1rem !important;
  border-bottom: none !important;
  border-left: 3px solid transparent !important;
  border-radius: 0 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  display: flex !important;
  align-items: center !important;
  gap: 0.45rem !important;
}
#sidebar-accordion .sg-item .nav-link:hover {
  border-bottom: none !important;
  border-left-color: var(--ui-accent-border) !important;
}
#sidebar-accordion .sg-item .nav-link.active {
  border-bottom: none !important;
  border-left: 3px solid var(--ui-accent) !important;
}
#sidebar-accordion .sg-item .nav-link.active i {
  color: var(--ui-accent) !important;
}

/* Chevron indicator on section-button (CSS pseudo-element) */
#sidebar-accordion .sidebar-group-section::after {
  content: '';
  display: inline-block;
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid currentColor;
  margin-left: 0.3rem;
  opacity: 0.6;
  transition: transform 120ms;
}
.sg-item--open > .sidebar-group-section::after {
  transform: rotate(180deg);
  opacity: 1;
}

/* Report-style links inside dropdown keep same SAP style */
#sidebar-accordion .sg-item .sidebar-subnav--reports .nav-link {
  border-left: 3px solid transparent !important;
  border-bottom: none !important;
}
#sidebar-accordion .sg-item .sidebar-subnav--reports .nav-link.active {
  border-left: 3px solid var(--ui-accent) !important;
  border-bottom: none !important;
}

/* ── Filter side-drawer ─────────────────────────────────────────────────── */

/* Trigger tab — sticks to the left edge of the content area */
.fp-trigger {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 201;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 10px;
  background: #3b82f6;
  color: #fff;
  border: none;
  border-radius: 0 14px 14px 0;
  box-shadow: 4px 0 20px rgba(59, 130, 246, 0.45);
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}
.fp-trigger:hover { background: #2563eb; box-shadow: 4px 0 24px rgba(37, 99, 235, 0.55); }
.fp-trigger--open { background: #1d4ed8; }

.fp-trigger-icon    { font-size: 1.1rem; }
.fp-trigger-chevron { font-size: 0.62rem; transition: transform 0.22s; }
.fp-trigger-label {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

/* Drawer panel */
.fp-drawer {
  position: fixed;
  top: 0;
  height: 100vh;
  z-index: 200;
  background: var(--ui-bg, #fff);
  border-right: 1px solid var(--ui-border, #e2e8f0);
  box-shadow: 6px 0 40px rgba(0, 0, 0, 0.18);
  transform: translateX(-110%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.fp-drawer--open { transform: translateX(0); }

.fp-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--ui-border, #e2e8f0);
  flex-shrink: 0;
}
.fp-drawer-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ui-text, #0f172a);
}
.fp-drawer-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  color: #64748b;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0;
  transition: background 0.1s, color 0.1s;
}
.fp-drawer-close:hover { background: #f1f5f9; color: #0f172a; }

.fp-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
}
/* Strip card/wrapper chrome — the form fields are the content */
.fp-drawer-body > .card,
.fp-drawer-body > div[class*="rounded"],
.fp-drawer-body > div[class*="border"] {
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
  margin-bottom: 0 !important;
  padding: 0 !important;
}
.fp-drawer-body > .card > .card-body,
.fp-drawer-body > div[class*="rounded"] > div,
.fp-drawer-body > div[class*="border"] > div { padding: 0 !important; }

/* ── Drawer form: one field per row ────────────────────────────────────── */
/* Convert any grid/row inside the drawer to a simple vertical flex stack  */
.fp-drawer-body .grid,
.fp-drawer-body [class*="grid-cols"],
.fp-drawer-body .row {
  display: flex !important;
  flex-direction: column !important;
  gap: 0.875rem !important;
  flex-wrap: nowrap !important;
  align-items: stretch !important;
}

/* Ensure every column child goes full width regardless of span class */
.fp-drawer-body [class*="col-"],
.fp-drawer-body [class*="col-span"],
.fp-drawer-body .grid > div,
.fp-drawer-body .row > div {
  width: 100% !important;
  max-width: 100% !important;
  flex: none !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

/* Date range pair: from + to side by side */
.fp-date-pair {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 0.5rem !important;
  width: 100% !important;
  align-items: end;
}
.fp-date-pair > * {
  width: auto !important;
  max-width: none !important;
  flex: none !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

/* Action row (submit / reset) — pinned at the bottom with a separator */
.fp-submit-row {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  gap: 0.5rem !important;
  padding-top: 1rem !important;
  margin-top: 0.25rem !important;
  border-top: 1px solid var(--ui-border, #e2e8f0) !important;
  width: 100% !important;
}
.fp-submit-row .btn { flex: 1 1 auto; min-width: 80px; }

/* ══════════════════════════════════════════════════════════════
   OMNI-SEARCH (Ctrl+K)
   ══════════════════════════════════════════════════════════════ */
.omni-search-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
}
.omni-search-overlay.d-none { display: none !important; }

.omni-search-dialog {
  width: 100%;
  max-width: 600px;
  background: var(--ui-bg);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-md);
  box-shadow: 0 20px 60px rgba(0,0,0,0.25), 0 4px 16px rgba(0,0,0,0.12);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 70vh;
  margin: 0 1rem;
}

.omni-search-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 1rem;
  border-bottom: 1px solid var(--ui-border);
  flex-shrink: 0;
}

.omni-search-input-icon {
  color: var(--ui-muted);
  font-size: 1rem;
  flex-shrink: 0;
}

.omni-search-input {
  flex: 1;
  border: none !important;
  outline: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0.875rem 0;
  font-size: 1rem;
  color: var(--ui-text);
  min-width: 0;
}
.omni-search-input::placeholder { color: var(--ui-muted); }

.omni-search-kbd {
  font-size: 0.68rem;
  padding: 0.15rem 0.4rem;
  background: var(--ui-surface-2);
  border: 1px solid var(--ui-border);
  border-radius: 4px;
  color: var(--ui-muted);
  flex-shrink: 0;
  font-family: var(--ui-mono);
}

.omni-search-results {
  overflow-y: auto;
  flex: 1;
}

.omni-search-group {
  padding: 0.5rem 1rem 0.2rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ui-muted);
}

.omni-search-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  text-decoration: none;
  color: var(--ui-text);
  transition: background 60ms;
  cursor: pointer;
}
.omni-search-item:hover,
.omni-search-item.selected {
  background: var(--ui-accent-light);
  color: var(--ui-accent);
  text-decoration: none;
}
.omni-search-item:hover .omni-search-icon,
.omni-search-item.selected .omni-search-icon { color: var(--ui-accent); }

.omni-search-icon {
  font-size: 0.9rem;
  color: var(--ui-muted);
  flex-shrink: 0;
  width: 1rem;
  text-align: center;
}

.omni-search-item-text { flex: 1; min-width: 0; }

.omni-search-title {
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.omni-search-enter {
  font-size: 0.78rem;
  color: var(--ui-muted);
  opacity: 0;
  flex-shrink: 0;
}
.omni-search-item:hover .omni-search-enter,
.omni-search-item.selected .omni-search-enter { opacity: 1; }

.omni-search-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 2rem 1rem;
  font-size: 0.85rem;
  color: var(--ui-muted);
}

.fp-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 199;
  background: rgba(15, 23, 42, 0.3);
  backdrop-filter: blur(2px);
}
.fp-backdrop--visible { display: block; }
