/* ═══════════════════════════════════════════════════════════════════════════
   NextRise Admin — Design System v2 (Tailwind-Inspired + Dark Mode)
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Fonts ──────────────────────────────────────────────────────────────── */
/* Self-hosted from this origin only. No CDN, no third-party request, no cookie.
   Both families are SIL Open Font License 1.1; see public/fonts/FONT-LICENSES.txt.

   Archivo carries two variation axes in a single file:
     wght 100..900   weight
     wdth  62..125   width  <- the identity's signature axis
   Martian Mono carries wght 100..800 and wdth 75..112.5. */

@font-face {
  font-family: "Archivo Variable";
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url("../fonts/archivo-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Archivo Variable";
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url("../fonts/archivo-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
    U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF,
    U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Martian Mono Variable";
  font-style: normal;
  font-weight: 100 800;
  font-stretch: 75% 112.5%;
  font-display: swap;
  src: url("../fonts/martianmono-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Martian Mono Variable";
  font-style: normal;
  font-weight: 100 800;
  font-stretch: 75% 112.5%;
  font-display: swap;
  src: url("../fonts/martianmono-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
    U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF,
    U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ─── Light Theme Tokens ─────────────────────────────────────────────────── */
:root {
  /* Brand — NextRise (type-only identity: black, white, and opacity tiers).
     The identity carries no hue. Any brand surface that introduces one is
     off-brand. The semantic block below is the deliberate exception: those
     colours signal state, not brand, and stay coloured for legibility. */
  --color-accent: #000000;
  --color-accent-hover: #2b2b2b;
  --color-accent-light: rgba(0, 0, 0, 0.07);
  --color-accent-50: rgba(0, 0, 0, 0.035);
  --color-accent-ring: rgba(0, 0, 0, 0.2);

  /* 27 places across the views ask for --color-primary, which this design
     system never defined — so every one of them silently fell through to its
     hardcoded fallback (mostly #0d9488 teal, left over from a pre-Nexaro
     brand) or to nothing at all. Aliasing it onto the accent fixes them all
     and keeps them theme-aware. */
  --color-primary: var(--color-accent);

  /* Text/icon colour for anything sitting ON the accent. Must invert with it:
     the accent is black in light mode and white in dark, so a hardcoded #fff
     here disappears completely on a dark-mode button. */
  --color-on-accent: #ffffff;

  /* Secondary emphasis — was brand gold; now a graphite tier, not a hue. */
  --color-gold: #52525b;
  --color-gold-hover: #3f3f46;
  --color-gold-light: rgba(0, 0, 0, 0.06);

  /* Text — neutral greys, no blue cast */
  --color-text: #18181b;
  --color-text-secondary: #52525b;
  --color-text-muted: #71717a;

  /* Backgrounds */
  --color-bg: #f4f4f5;
  --color-bg-card: #ffffff;
  --color-bg-hover: #f4f4f5;
  --color-bg-active: rgba(0, 0, 0, 0.05);
  --color-bg-sidebar: #ffffff;
  --color-bg-navbar: #ffffff;
  --color-bg-input: #ffffff;
  --color-bg-modal: #ffffff;

  /* Borders */
  --color-border: #d4d4d8;
  --color-border-hover: #a1a1aa;
  --color-border-focus: var(--color-accent);

  /* Semantic */
  --color-danger: #ef4444;
  --color-danger-light: #fef2f2;
  --color-danger-text: #dc2626;
  --color-warning: #f59e0b;
  --color-warning-light: #fffbeb;
  --color-success: #10b981;
  --color-success-light: #ecfdf5;
  --color-success-text: #059669;
  --color-info: #3b82f6;
  --color-info-light: #eff6ff;

  /* Typography — NextRise (Archivo throughout, Martian Mono for data) */
  --font-sans:
    "Archivo Variable", -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  --font-heading: "Archivo Variable", sans-serif;
  --font-mono:
    "Martian Mono Variable", ui-monospace, "SFMono-Regular", monospace;

  --text-2xs: 0.65rem;
  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-base: 0.875rem;
  --text-md: 0.9375rem;
  --text-lg: 1rem;
  --text-xl: 1.125rem;
  --text-2xl: 1.25rem;
  --text-3xl: 1.5rem;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
  --shadow-sm:
    0 1px 3px 0 rgba(0, 0, 0, 0.06), 0 1px 2px -1px rgba(0, 0, 0, 0.06);
  --shadow-md:
    0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg:
    0 10px 15px -3px rgba(0, 0, 0, 0.06), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl:
    0 20px 25px -5px rgba(0, 0, 0, 0.06), 0 8px 10px -6px rgba(0, 0, 0, 0.03);

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Layout */
  --sidebar-width: 280px;
}

/* ─── Dark Theme Tokens ──────────────────────────────────────────────────── */
[data-theme="dark"] {
  /* White on black, using the identity's opacity tiers verbatim:
     1.00 primary · 0.70 secondary · 0.54 tertiary · 0.28 lines · 0.14 · 0.07 */
  --color-accent: #ffffff;
  --color-accent-hover: rgba(255, 255, 255, 0.7);
  --color-accent-light: rgba(255, 255, 255, 0.14);
  --color-accent-50: rgba(255, 255, 255, 0.07);
  --color-accent-ring: rgba(255, 255, 255, 0.28);
  --color-on-accent: #09090b;

  --color-gold: #a1a1aa;
  --color-gold-hover: #d4d4d8;
  --color-gold-light: rgba(255, 255, 255, 0.1);

  --color-text: #ffffff;
  --color-text-secondary: rgba(255, 255, 255, 0.7);
  --color-text-muted: rgba(255, 255, 255, 0.54);

  --color-bg: #000000;
  --color-bg-card: #101012;
  --color-bg-hover: #1c1c1f;
  --color-bg-active: rgba(255, 255, 255, 0.1);
  --color-bg-sidebar: #101012;
  --color-bg-navbar: #101012;
  --color-bg-input: #101012;
  --color-bg-modal: #101012;

  --color-border: #27272a;
  --color-border-hover: #3f3f46;
  --color-border-focus: var(--color-accent);

  --color-danger: #f87171;
  --color-danger-light: rgba(248, 113, 113, 0.1);
  --color-danger-text: #f87171;
  --color-warning: #fbbf24;
  --color-warning-light: rgba(251, 191, 36, 0.1);
  --color-success: #34d399;
  --color-success-light: rgba(52, 211, 153, 0.1);
  --color-success-text: #34d399;
  --color-info: #60a5fa;
  --color-info-light: rgba(161, 161, 170, 0.1);

  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-sm:
    0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px -1px rgba(0, 0, 0, 0.3);
  --shadow-md:
    0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
  --shadow-lg:
    0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.2);
  --shadow-xl:
    0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.2);

  color-scheme: dark;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Base Reset
   ═══════════════════════════════════════════════════════════════════════════ */

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

html {
  height: -webkit-fill-available;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--color-bg);
  min-height: 100vh;
  min-height: -webkit-fill-available;
  color: var(--color-text);
  transition:
    background-color var(--transition-base),
    color var(--transition-base);
}

/* `body` is listed explicitly: Bootstrap sets a font stack on `body`, and a
   type selector outranks the universal one, so `*` alone left body's own text
   nodes on the system stack. */
body,
* {
  font-family: var(--font-sans);
}

/* ─── Bootstrap bridge ───────────────────────────────────────────────────────
   Bootstrap ships its own #0d6efd blue on `--bs-primary` and `--bs-link-color`,
   which surfaces through `.text-primary`, `.link-primary` and every plain <a>.
   `.btn-primary` is already restyled below, but the rest leaked. Repointing the
   variables at the accent catches all of them at once. theme.css loads after
   bootstrap.min.css, so these win at equal specificity. */
:root {
  --bs-primary: #000000;
  --bs-primary-rgb: 0, 0, 0;
  --bs-link-color: #000000;
  --bs-link-color-rgb: 0, 0, 0;
  --bs-link-hover-color: #2b2b2b;
  --bs-focus-ring-color: rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] {
  --bs-primary: #ffffff;
  --bs-primary-rgb: 255, 255, 255;
  --bs-link-color: #ffffff;
  --bs-link-color-rgb: 255, 255, 255;
  --bs-link-hover-color: rgba(255, 255, 255, 0.7);
  --bs-focus-ring-color: rgba(255, 255, 255, 0.28);
}

/* Checkboxes, radios and switches paint their checked state from these two,
   which Bootstrap hardcodes to its blue rather than reading --bs-primary. */
.form-check-input:checked,
.form-check-input[type="checkbox"]:indeterminate {
  background-color: var(--color-accent);
  border-color: var(--color-accent);
}

.form-check-input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 0.25rem var(--color-accent-ring);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 0.25rem var(--color-accent-ring);
}

/* Martian Mono is the identity's data face. Apply to figures that should line
   up column-to-column: amounts, quantities, invoice and order references. */
.data-figure {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

.bi {
  vertical-align: -0.125em;
  pointer-events: none;
  fill: currentColor;
}

.nextrise-hover-tooltip {
  position: fixed;
  z-index: 10920;
  max-width: min(260px, calc(100vw - 20px));
  padding: 7px 10px;
  border-radius: var(--radius-md);
  background: #09090b;
  color: #ffffff;
  box-shadow: var(--shadow-lg);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  opacity: 0;
  transform: translateY(4px) scale(0.98);
  pointer-events: none;
  transition:
    opacity var(--transition-fast),
    transform var(--transition-fast);
}

.nextrise-hover-tooltip::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  width: 10px;
  height: 10px;
  background: inherit;
  transform: translateX(-50%) rotate(45deg);
}

.nextrise-hover-tooltip--below {
  transform: translateY(-4px) scale(0.98);
}

.nextrise-hover-tooltip--below::after {
  top: -5px;
  bottom: auto;
}

.nextrise-hover-tooltip--visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

[data-theme="dark"] .nextrise-hover-tooltip {
  background: #ffffff;
  color: #000000;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Typography
   ═══════════════════════════════════════════════════════════════════════════ */

h1,
h2,
h3,
h4,
h5,
h6,
.h1,
.h2,
.h3,
.h4,
.h5,
.h6 {
  color: var(--color-text);
  font-weight: 600;
  font-family: var(--font-heading) !important;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

p,
.p {
  color: var(--color-text-secondary);
  line-height: 1.6;
}

small {
  font-size: var(--text-sm);
  font-weight: 400;
  line-height: 1.5;
  color: var(--color-text-muted);
}

.fs-7 {
  font-size: var(--text-base);
}

.fw-semibold {
  font-weight: 600;
}

.lh-tight {
  line-height: 1.25;
}

.text-cap {
  text-transform: capitalize !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Layout — Sidebar + Main
   ═══════════════════════════════════════════════════════════════════════════ */

/* Block layout: a fixed sidebar must not also reserve flex row space (avoids gap + horizontal overflow). */
.dash-body {
  position: relative;
  display: block;
  min-height: 100dvh;
}

.dash-body .main-sidebar {
  width: var(--sidebar-width);
  position: fixed;
  left: 0;
  top: 0;
  min-height: 100dvh;
  z-index: 1030;
}

.dash-body main {
  display: block;
  width: calc(100% - var(--sidebar-width));
  max-width: calc(100vw - var(--sidebar-width));
  margin-left: var(--sidebar-width);
  position: relative;
  box-sizing: border-box;
}

/* Desktop sidebar: overlay mode uses left-edge hover peek (no FAB) */
.sidebar-hover-strip {
  display: none;
}

.sidebar-tool-btn {
  padding: 0.2rem 0.35rem;
  line-height: 1;
  color: var(--color-text-secondary);
}

.sidebar-tool-btn:hover:not(:disabled) {
  color: var(--color-accent);
  border-color: var(--color-accent) !important;
}

@media (min-width: 993px) {
  .dash-body .main-sidebar {
    transition:
      transform 0.22s ease,
      background-color var(--transition-base),
      border-color var(--transition-base),
      box-shadow var(--transition-base);
  }

  /* Sticky (docked): sidebar always visible beside content */
  html.nextrise-sidebar-sticky .dash-body .main-sidebar {
    transform: none !important;
    pointer-events: auto !important;
    box-shadow: none !important;
  }

  html.nextrise-sidebar-sticky .dash-body main {
    margin-left: var(--sidebar-width) !important;
    width: calc(100% - var(--sidebar-width)) !important;
    max-width: calc(100vw - var(--sidebar-width)) !important;
  }

  /* Overlay: sidebar off-canvas; main uses full width */
  html.nextrise-sidebar-collapsed-init:not(.nextrise-sidebar-sticky)
    .dash-body
    main,
  html.nextrise-sidebar-collapsed:not(.nextrise-sidebar-sticky) .dash-body main {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
  }

  html.nextrise-sidebar-collapsed-init:not(.nextrise-sidebar-sticky)
    .dash-body
    .main-sidebar,
  html.nextrise-sidebar-collapsed:not(.nextrise-sidebar-sticky)
    .dash-body
    .main-sidebar {
    transform: translateX(-100%);
    pointer-events: none;
  }

  html.nextrise-sidebar-collapsed.nextrise-sidebar-peeking:not(
      .nextrise-sidebar-sticky
    )
    .dash-body
    .main-sidebar,
  html.nextrise-sidebar-collapsed-init.nextrise-sidebar-peeking:not(
      .nextrise-sidebar-sticky
    )
    .dash-body
    .main-sidebar {
    transform: translateX(0);
    pointer-events: auto;
    box-shadow: 8px 0 32px rgba(9, 9, 11, 0.14);
    z-index: 1060;
  }

  html.nextrise-sidebar-collapsed-init:not(.nextrise-sidebar-sticky)
    .sidebar-hover-strip,
  html.nextrise-sidebar-collapsed:not(.nextrise-sidebar-sticky)
    .sidebar-hover-strip {
    display: block;
    position: fixed;
    left: 0;
    top: 0;
    width: 14px;
    height: 100dvh;
    z-index: 1040;
    pointer-events: auto;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Order / offer lifecycle status (shared: orders, offers, invoices, dashboard…)
   ═══════════════════════════════════════════════════════════════════════════ */

.order-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.order-status i {
  font-size: 0.6rem;
  flex-shrink: 0;
}

.order-status.status-active {
  background: var(--color-success-light);
  color: var(--color-success-text);
}

.order-status.status-dispatched {
  background: var(--color-info-light);
  color: var(--color-info);
}

.order-status.status-delivered {
  background: var(--color-accent-light);
  color: var(--color-accent);
}

.order-status.status-cancelled {
  background: var(--color-danger-light);
  color: var(--color-danger-text);
}

.order-status.status-offer,
.order-status.status-expired {
  background: var(--color-warning-light);
  color: #92400e;
}

[data-theme="dark"] .order-status.status-offer,
[data-theme="dark"] .order-status.status-expired {
  color: var(--color-warning);
}

.order-status.status-unknown {
  background: var(--color-bg-subtle, rgba(161, 161, 170, 0.1));
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
  text-transform: none;
  font-weight: 500;
  letter-spacing: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Todo tasks — status & priority (aligned with order-status pills)
   ═══════════════════════════════════════════════════════════════════════════ */

.todo-status,
.todo-priority {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.todo-status .bi,
.todo-priority .bi {
  font-size: 0.65rem;
  flex-shrink: 0;
  opacity: 0.95;
}

.todo-status.todo-st-pending {
  background: var(--color-warning-light);
  color: #92400e;
}

[data-theme="dark"] .todo-status.todo-st-pending {
  color: var(--color-warning);
}

.todo-status.todo-st-in_progress {
  background: var(--color-info-light);
  color: var(--color-info);
}

.todo-status.todo-st-completed {
  background: var(--color-success-light);
  color: var(--color-success-text);
}

.todo-status.todo-st-overdue {
  background: var(--color-danger-light);
  color: var(--color-danger-text);
}

.todo-priority.todo-pr-low {
  background: var(--color-success-light);
  color: var(--color-success-text);
}

.todo-priority.todo-pr-medium {
  background: var(--color-warning-light);
  color: #92400e;
}

[data-theme="dark"] .todo-priority.todo-pr-medium {
  color: var(--color-warning);
}

.todo-priority.todo-pr-high {
  background: var(--color-danger-light);
  color: var(--color-danger-text);
}

.todo-status.todo-st-unknown,
.todo-priority.todo-pr-unknown {
  background: var(--color-bg-subtle, rgba(161, 161, 170, 0.1));
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
  text-transform: none;
  font-weight: 500;
  letter-spacing: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Sidebar
   ═══════════════════════════════════════════════════════════════════════════ */

.main-sidebar {
  background-color: var(--color-bg-sidebar);
  max-height: 100dvh !important;
  border-right: 1px solid var(--color-border);
  transition:
    background-color var(--transition-base),
    border-color var(--transition-base);
  padding: var(--space-5) var(--space-4) var(--space-8) !important;
}

.main-sidebar .header img {
  /* The logotype is a wide 7.5:1, so it is set by width here and left to find
     its own height, keeping clear of the sticky-sidebar control beside it. */
  height: auto;
  width: 168px;
  max-width: 100%;
  vertical-align: middle;
  display: block;
}

/* Logo row: logo + sticky control share one 28px-tall band (no stacked header height) */
.main-sidebar .header .sidebar-brand-toolbar {
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border);
}

.main-sidebar .header .sidebar-brand-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  min-height: 28px;
}

.main-sidebar .header .sidebar-brand-logo {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  padding: 0 !important;
  margin: 0 !important;
  line-height: 0;
}

.main-sidebar .header .sidebar-toolbar-btns {
  display: flex;
  flex-shrink: 0;
  align-items: center;
}

.main-sidebar .header .sidebar-brand-toolbar .sidebar-tool-btn {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  line-height: 1;
  border-radius: var(--radius-md);
  box-sizing: border-box;
}

/* Logo swap for dark mode */
.main-sidebar .header .logo-dark {
  display: none;
}

[data-theme="dark"] .main-sidebar .header .logo-light {
  display: none;
}

[data-theme="dark"] .main-sidebar .header .logo-dark {
  display: block;
}

/* Top-level nav spacing (was 2px — too tight) */
.sidebar-menu > li.mb-1 {
  margin-bottom: var(--space-2) !important;
}

.sidebar-menu > li.mb-1:last-child {
  margin-bottom: 0 !important;
}

.main-sidebar .sidebar-menu {
  max-height: calc(100dvh - 96px);
  overflow-y: auto;
  scrollbar-width: none;
  padding-bottom: var(--space-6);
  padding-top: var(--space-1);
}

.main-sidebar .sidebar-menu::-webkit-scrollbar {
  width: 0px;
}

.main-sidebar .border-bottom {
  border-bottom: 1px solid var(--color-border) !important;
}

/* Sidebar toggle buttons */
.btn-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-2);
  padding: 10px 12px;
  padding-right: 10px;
  color: var(--color-text-secondary);
  background-color: transparent;
  border: 0;
  width: 100%;
  font-size: var(--text-sm) !important;
  font-weight: 500 !important;
  font-family: var(--font-heading) !important;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  min-height: 42px;
  box-sizing: border-box;
}

.btn-toggle i {
  font-size: 1.1rem;
  width: 20px;
  min-width: 20px;
  text-align: center;
  opacity: 0.6;
  transition: opacity var(--transition-fast);
}

.btn-toggle:hover {
  color: var(--color-accent);
  background-color: var(--color-accent-50);
}

.btn-toggle:hover i {
  opacity: 1;
}

.btn-toggle::after {
  content: "\f282";
  font-family: "Bootstrap-icons";
  float: none;
  margin-left: auto;
  flex-shrink: 0;
  transition: transform var(--transition-base);
  font-size: 0.65rem;
  color: var(--color-text-muted);
  padding-left: var(--space-2);
  padding-right: 2px;
  opacity: 0.85;
}

.btn-toggle[aria-expanded="true"]::after {
  transform: rotate(180deg);
}

.btn-toggle[aria-expanded="true"] {
  color: var(--color-accent);
  background-color: var(--color-accent-50);
  box-shadow: inset 3px 0 0 var(--color-accent);
}

.btn-toggle[aria-expanded="true"] i {
  opacity: 1;
}

/* Sidebar links (Dashboard etc) — override .btn { text-align: center } */
.main-sidebar .sidebar-menu > li > .btn-link {
  display: flex !important;
  justify-content: flex-start !important;
  align-items: center !important;
  text-align: left !important;
  width: 100% !important;
}

.btn-link {
  color: var(--color-text-secondary);
  text-decoration: none;
  font-size: var(--text-sm) !important;
  font-weight: 500 !important;
  font-family: var(--font-heading) !important;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  padding: 10px 12px;
  letter-spacing: -0.01em;
  min-height: 42px;
  box-sizing: border-box;
  gap: var(--space-2);
}

.btn-link i {
  font-size: 1.1rem;
  width: 20px;
  min-width: 20px;
  text-align: center;
  opacity: 0.6;
  transition: opacity var(--transition-fast);
}

.btn-link:hover {
  color: var(--color-accent);
  background-color: var(--color-accent-50);
}

.btn-link:hover i {
  opacity: 1;
}

.btn-link.active {
  color: var(--color-accent);
  background-color: var(--color-accent-light);
  font-weight: 600 !important;
  box-shadow: inset 3px 0 0 var(--color-accent);
}

.btn-link.active i {
  opacity: 1;
}

/* Space between parent row and nested links */
.main-sidebar .sidebar-menu .collapse {
  margin-top: var(--space-1);
  margin-bottom: var(--space-1);
}

/* Sidebar sub-menu — left rule only (no bullet dots) */
.btn-toggle-nav {
  margin-left: 12px;
  padding-left: var(--space-3);
  padding-right: var(--space-2);
  margin-top: var(--space-1);
  margin-bottom: var(--space-2);
  border-left: 2px solid var(--color-border);
}

[data-theme="dark"] .btn-toggle-nav {
  border-left-color: var(--color-border-hover);
}

.btn-toggle-nav li {
  list-style: none;
}

.btn-toggle-nav a {
  font-family: var(--font-heading);
  color: var(--color-text-secondary);
  display: flex;
  justify-content: flex-start;
  align-items: center;
  padding: 8px var(--space-3);
  margin-top: 2px;
  text-decoration: none;
  font-size: var(--text-xs);
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  position: relative;
  letter-spacing: -0.005em;
  min-height: 34px;
  line-height: 1.3;
}

.btn-toggle-nav a:hover {
  background-color: var(--color-accent-50) !important;
  color: var(--color-accent) !important;
}

.btn-toggle-nav a.active {
  color: var(--color-accent);
  font-weight: 600;
  background-color: var(--color-accent-light) !important;
  box-shadow: inset 3px 0 0 var(--color-accent);
}

.nav-flush .nav-link {
  border-radius: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Navbar
   ═══════════════════════════════════════════════════════════════════════════ */

nav.navbar {
  border-bottom: 1px solid var(--color-border) !important;
  height: 60px;
  background-color: var(--color-bg-navbar);
  transition:
    background-color var(--transition-base),
    border-color var(--transition-base);
}

nav .dropdown-toggle::after {
  display: none;
}

nav .bi {
  color: var(--color-text-muted);
  font-size: 1.15rem !important;
}

nav .dropdown-menu {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-2);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  background-color: var(--color-bg-card);
}

nav .dropdown-menu .uname {
  font-weight: 600;
  color: var(--color-text);
  text-align: center;
  font-size: var(--text-sm);
  font-family: var(--font-heading);
}

nav .dropdown-menu .role {
  font-size: var(--text-xs);
  color: var(--color-accent);
  text-align: center;
  margin-bottom: var(--space-1);
  font-weight: 500;
}

nav .dropdown-menu .dropdown-item {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  border-radius: var(--radius-sm);
  padding: 6px var(--space-3);
  transition: all var(--transition-fast);
  font-family: var(--font-heading);
}

nav .dropdown-menu .dropdown-item:hover {
  color: var(--color-accent);
  background-color: var(--color-accent-50);
}

nav .dropdown-menu .dropdown-item i {
  font-size: 0.9rem;
}

nav .dropdown-menu .dropdown-item:active,
nav .dropdown-menu .dropdown-item:focus {
  background-color: var(--color-accent-50) !important;
  color: var(--color-accent) !important;
}

.nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  font-size: 1rem;
  color: var(--color-text-secondary);
  position: relative;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.nav-icon i {
  font-size: 1.1rem !important;
}

.nav-icon:hover {
  background-color: var(--color-bg-hover);
  color: var(--color-accent);
}

/* Todo nav: fixed circle; label 1–9 or 9+ (no stretch) */
.todo-nav-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  box-sizing: border-box;
  width: 18px;
  height: 18px;
  min-width: 18px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.5625rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  color: #fff;
  background-color: var(--color-danger);
  border-radius: 50%;
  border: 2px solid var(--color-bg-navbar);
  pointer-events: none;
}

.dropdown-toggle {
  outline: 0;
}

.dropdown-divider {
  border-color: var(--color-border);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Page Content
   ═══════════════════════════════════════════════════════════════════════════ */

.p-45 {
  padding: var(--space-8) var(--space-10);
}

@media screen and (max-width: 576px) {
  .p-45 {
    padding: var(--space-5) var(--space-6);
  }
}

.p-title {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-text);
  font-family: var(--font-heading);
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.p-subtitle {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-weight: 400;
  margin-top: 2px;
}

.px-mp {
  padding-left: var(--space-6);
  padding-right: var(--space-6);
}

.px-25 {
  padding-left: 0.8rem;
  padding-right: 0.8rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Cards
   ═══════════════════════════════════════════════════════════════════════════ */

.card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-bg-card);
  box-shadow: var(--shadow-xs);
  transition: all var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-sm);
}

.card h6 {
  color: var(--color-text);
  font-size: var(--text-lg);
}

.card-header {
  background-color: var(--color-bg-card);
  border-bottom: 1px solid var(--color-border);
  font-weight: 600;
  color: var(--color-text);
  font-size: var(--text-base);
  font-family: var(--font-heading);
  padding: var(--space-4) var(--space-5);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Buttons
   ═══════════════════════════════════════════════════════════════════════════ */

.btn {
  height: 36px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  font-size: var(--text-sm);
  font-weight: 500;
  font-family: var(--font-heading);
  gap: var(--space-1);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  cursor: pointer;
  letter-spacing: -0.005em;
}

.btn.btn-primary {
  background-color: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-on-accent);
  box-shadow: var(--shadow-xs);
}

[data-theme="dark"] .btn.btn-primary {
  color: #09090b;
}

.btn.btn-primary:hover {
  background-color: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

[data-theme="dark"] .btn.btn-primary:hover {
  color: #09090b;
}

.btn.btn-primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-xs);
}

.btn-outline-primary {
  background-color: transparent;
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.btn-outline-primary:hover {
  background-color: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-on-accent);
  transform: translateY(-1px);
}

.btn-outline-secondary {
  background-color: transparent;
  border-color: var(--color-border);
  color: var(--color-text-secondary);
}

.btn-outline-secondary:hover {
  background-color: var(--color-bg-hover);
  border-color: var(--color-border-hover);
  color: var(--color-text);
}

.btn.btn-success {
  background-color: var(--color-success);
  border-color: var(--color-success);
  color: #ffffff;
}

.btn.btn-success:hover {
  filter: brightness(0.9);
  transform: translateY(-1px);
}

.btn.btn-info {
  background-color: var(--color-info);
  border-color: var(--color-info);
  color: #ffffff;
}

.btn.btn-info:hover {
  filter: brightness(0.9);
  transform: translateY(-1px);
}

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

.btn.btn-danger:hover {
  filter: brightness(0.9);
  transform: translateY(-1px);
}

.btn.btn-light {
  background-color: var(--color-bg-hover);
  border-color: var(--color-border);
  color: var(--color-text-secondary);
}

.btn.btn-light:hover {
  background-color: var(--color-border);
  color: var(--color-text);
}

.button-group {
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
}

.button-group .btn {
  width: fit-content;
}

.btn-sm {
  height: auto;
  font-weight: 500;
  padding: 4px 10px;
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Forms
   ═══════════════════════════════════════════════════════════════════════════ */

.form-label {
  font-size: var(--text-sm);
  color: var(--color-text);
  margin-bottom: 5px;
  font-family: var(--font-heading);
  font-weight: 500;
  display: block;
}

.form-label span {
  color: var(--color-text-muted);
}

.fieldset-label {
  font-size: var(--text-xs);
}

.form-title {
  color: var(--color-text);
  font-size: var(--text-lg);
  font-family: var(--font-heading);
  font-weight: 600;
}

.text-error {
  color: var(--color-danger);
}

.form-control,
.form-select {
  background-color: var(--color-bg-input) !important;
  border: 1px solid var(--color-border) !important;
  color: var(--color-text);
  font-size: var(--text-sm);
  padding: 8px var(--space-3);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
}

.form-control::placeholder,
.form-select::placeholder {
  color: var(--color-text-muted);
}

.form-control:focus,
.form-select:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--color-accent-ring) !important;
  border-color: var(--color-border-focus) !important;
}

.form-control:read-only {
  background-color: var(--color-bg) !important;
  border-color: var(--color-border) !important;
}

/* SlimSelect */
.ss-main {
  background-color: var(--color-bg-input) !important;
  border: 1px solid var(--color-border) !important;
  color: var(--color-text);
  font-size: var(--text-sm);
  padding: 8px var(--space-3);
  border-radius: var(--radius-md);
}

.ss-main::placeholder {
  color: var(--color-text-muted);
}

.ss-main:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--color-accent-ring);
  border-color: var(--color-border-focus) !important;
}

.ss-content {
  background-color: var(--color-bg-card) !important;
  border-color: var(--color-border) !important;
}

.ss-content .ss-list .ss-option {
  display: block;
  padding: 7px var(--space-3) !important;
  white-space: normal;
  color: var(--color-text) !important;
  font-size: var(--text-sm) !important;
  cursor: pointer;
  user-select: none;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.ss-content .ss-list .ss-option:hover {
  color: var(--color-on-accent) !important;
  background-color: var(--color-accent) !important;
}

.ss-content .ss-list .ss-option.ss-highlighted,
.ss-content .ss-list .ss-option:not(.ss-disabled).ss-selected {
  color: var(--color-accent) !important;
  background-color: var(--color-accent-50) !important;
}

.ss-value {
  background-color: var(--color-accent) !important;
  border-radius: var(--radius-sm) !important;
}

.ss-value-text {
  font-size: var(--text-xs);
}

.ss-content .ss-search {
  color: var(--color-text);
  font-size: var(--text-xs);
  text-transform: none !important;
}

.ss-option {
  font-family: var(--font-heading);
}

.ss-values {
  text-transform: capitalize !important;
}

.ss-single {
  font-family: var(--font-heading);
  color: var(--color-text) !important;
}

.option {
  text-transform: capitalize !important;
}

form .btn {
  min-width: 140px;
}

form .remove-btn {
  min-width: 25px !important;
}

form .btn-removeImg {
  min-width: fit-content;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Alerts
   ═══════════════════════════════════════════════════════════════════════════ */

.alert {
  font-size: var(--text-sm);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Grid.js Table
   ═══════════════════════════════════════════════════════════════════════════ */

.gridjs-wrapper {
  border-color: transparent !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  overflow-x: unset !important;
}

.gridjs-container {
  overflow-x: unset !important;
}

.gridjs-table {
  table-layout: auto !important;
  width: 100% !important;
}

.gridjs-footer {
  box-shadow: none !important;
  border-top: 1px solid var(--color-border);
  background-color: transparent !important;
}

.td,
.th {
  font-size: var(--text-sm) !important;
  color: var(--color-text) !important;
  border: none !important;
  border-bottom: 1px solid var(--color-border) !important;
  padding: 10px var(--space-4) !important;
  background-color: transparent !important;
}

.td:first-child,
.th:first-child {
  text-transform: capitalize;
}

.gridjs-tr {
  vertical-align: middle;
  transition: background-color var(--transition-fast);
}

.gridjs-tr:hover .td {
  background-color: var(--color-bg-hover) !important;
}

.gridjs thead th {
  color: var(--color-text-muted) !important;
  font-weight: 600;
  font-size: var(--text-xs) !important;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background-color: transparent !important;
  border-bottom: 1px solid var(--color-border) !important;
  padding: 10px var(--space-4) !important;
  font-family: var(--font-heading);
}

.gridjs-search-input {
  border-radius: var(--radius-md) !important;
  border: 1px solid var(--color-border) !important;
  font-size: var(--text-sm) !important;
  padding: 8px var(--space-3) !important;
  transition: all var(--transition-fast);
  background-color: var(--color-bg-input) !important;
  color: var(--color-text) !important;
}

.gridjs-search-input:focus {
  box-shadow: 0 0 0 3px var(--color-accent-ring) !important;
  border-color: var(--color-border-focus) !important;
  outline: none !important;
}

.gridjs-pages button {
  border-radius: var(--radius-sm) !important;
  font-size: var(--text-sm) !important;
  transition: all var(--transition-fast);
  background-color: var(--color-bg-card) !important;
  color: var(--color-text-secondary) !important;
  border-color: var(--color-border) !important;
}

.gridjs-pages button.gridjs-currentPage {
  background-color: var(--color-accent) !important;
  color: var(--color-on-accent) !important;
  border-color: var(--color-accent) !important;
}

.gridjs-summary {
  color: var(--color-text-muted) !important;
  font-size: var(--text-xs) !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Checkboxes (Custom)
   ═══════════════════════════════════════════════════════════════════════════ */

.check-container {
  display: block;
  position: relative;
  padding-left: 22px;
  margin-bottom: 13px;
  cursor: pointer;
  font-size: var(--text-lg);
  user-select: none;
  color: var(--color-text);
  width: fit-content;
}

.check-container .statusText {
  font-size: var(--text-lg);
  height: fit-content;
}

.check-container .statusText.active {
  background-color: transparent;
  color: var(--color-success-text);
}

.check-container .statusText.inactive {
  background-color: transparent;
  color: var(--color-danger-text);
}

.check-container.light {
  color: #ffffff;
}

.check-container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.checkmark {
  position: absolute;
  top: 2px;
  left: 0;
  height: 18px;
  width: 18px;
  background-color: transparent;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--color-text-muted);
  transition: all var(--transition-fast);
}

.check-container:hover input ~ .checkmark {
  background-color: var(--color-bg-hover);
}

.check-container input:checked ~ .checkmark {
  background-color: var(--color-accent);
  border-color: var(--color-accent);
}

.checkmark:after {
  content: "";
  position: absolute;
  display: none;
}

.check-container input:checked ~ .checkmark:after {
  display: block;
}

.check-container .checkmark:after {
  left: 5.5px;
  top: 1.2px;
  width: 6px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.status-check.checkmark {
  top: 2px;
  background-color: transparent;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--color-danger);
}

.check-container .status-check.checkmark:after {
  left: 5.5px;
  top: 1px;
  width: 6px;
  height: 10px;
}

.check-container input:checked ~ .status-check.checkmark {
  background-color: var(--color-success);
  border-color: var(--color-success);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Status Badges — FIXED: proper inline pill badges
   ═══════════════════════════════════════════════════════════════════════════ */

span.statusText {
  display: inline-flex;
  align-items: center;
  font-size: var(--text-xs);
  font-weight: 500;
  font-family: var(--font-heading);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  line-height: 1.4;
  white-space: nowrap;
}

span.statusText.active {
  background-color: var(--color-success-light);
  color: var(--color-success-text);
}

span.statusText.inactive {
  background-color: var(--color-danger-light);
  color: var(--color-danger-text);
}

/* Invoice payment_status column (distinct from generic active/inactive) */
span.statusText.pay-unpaid {
  background-color: var(--color-danger-light);
  color: var(--color-danger-text);
  border: 1px solid rgba(239, 68, 68, 0.22);
}

span.statusText.pay-partial {
  background-color: var(--color-info-light);
  color: var(--color-accent);
  border: 1px solid rgba(113, 113, 122, 0.28);
}

span.statusText.pay-full {
  background-color: var(--color-success-light);
  color: var(--color-success-text);
  border: 1px solid rgba(16, 185, 129, 0.28);
}

[data-theme="dark"] span.statusText.pay-partial {
  background-color: rgba(113, 113, 122, 0.14);
  color: #93c5fd;
  border-color: rgba(147, 197, 253, 0.28);
}

[data-theme="dark"] span.statusText.pay-full {
  background-color: rgba(16, 185, 129, 0.14);
  color: #6ee7b7;
  border-color: rgba(52, 211, 153, 0.28);
}

[data-theme="dark"] span.statusText.pay-unpaid {
  background-color: rgba(248, 113, 113, 0.12);
  color: #fca5a5;
  border-color: rgba(252, 165, 165, 0.28);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Role Labels
   ═══════════════════════════════════════════════════════════════════════════ */

.role-label {
  text-transform: capitalize;
  font-size: var(--text-xs);
  font-weight: 500;
  font-family: var(--font-heading);
  padding: 2px 10px;
  background-color: var(--color-bg-hover);
  border-radius: var(--radius-full);
  width: fit-content;
  letter-spacing: 0.01em;
  line-height: 1.5;
}

.role-label-xl {
  font-size: var(--text-sm);
  font-weight: 500;
  padding: 4px 14px;
  border-radius: var(--radius-full);
  width: fit-content;
}

/* Role badges are categorical, and each one already spells its role out in
   text, so the six hues were decoration. Superadmin keeps a heavier weight and
   a solid ground so the highest-privilege role still stands out; the rest share
   one neutral chip. */
.role-superadmin,
.role-admin,
.role-moderator,
.role-sales,
.role-storage,
.role-accounts {
  color: var(--color-text-secondary);
  background-color: var(--color-accent-light);
}

.role-superadmin {
  color: var(--color-bg-card);
  background-color: var(--color-accent);
  font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Modals
   ═══════════════════════════════════════════════════════════════════════════ */

.modal-content {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  background-color: var(--color-bg-modal);
}

.modal-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border);
}

.modal-body {
  padding: var(--space-5) var(--space-5);
}

.modal-footer {
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--color-border);
}

.modal-title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: var(--text-lg);
  color: var(--color-text);
}

.btn-close {
  opacity: 0.4;
  transition: opacity var(--transition-fast);
  filter: var(--btn-close-filter, none);
}

.btn-close:hover {
  opacity: 0.8;
}

[data-theme="dark"] .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}

.modal-backdrop {
  background-color: rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .modal-backdrop {
  background-color: rgba(0, 0, 0, 0.7);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Auth (Login)
   ═══════════════════════════════════════════════════════════════════════════ */

.auth {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 30px var(--space-4);
  background: var(--color-bg);
}

@media screen and (max-width: 576px) {
  .auth {
    min-height: 100dvh;
  }
}

.auth .logo-wrapper {
  width: 100%;
  max-width: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
}

.auth .logo {
  /* The lockup carries the MINERALS GMBH descriptor under the logotype;
     below ~46px the descriptor stops resolving. */
  max-height: 48px;
  width: auto;
}

/* The logotype is solid black; it must invert on dark grounds or it vanishes. */
.auth .logo.logo-dark {
  display: none;
}

[data-theme="dark"] .auth .logo.logo-light {
  display: none;
}

[data-theme="dark"] .auth .logo.logo-dark {
  display: block;
}

.auth .wrapper {
  width: 100%;
  max-width: 400px;
  background-color: var(--color-bg-card);
  padding: var(--space-8);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--color-border);
}

.auth .hasPassword {
  position: relative;
}

.auth .hasPassword .showPass {
  position: absolute;
  right: 0;
  top: 28px;
  padding: 8px 12px;
  font-size: 1rem;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: color var(--transition-fast);
}

.auth .hasPassword .showPass:hover {
  color: var(--color-accent);
}

.auth .h4 {
  color: var(--color-text-secondary);
  font-size: var(--text-lg);
  font-weight: 500;
}

.auth .p {
  font-size: var(--text-lg);
  color: var(--color-text);
  text-align: center;
  font-weight: 600;
  font-family: var(--font-heading);
}

/* Password toggle (non-auth) */
.hasPassword {
  position: relative;
}

.hasPassword .showPass {
  position: absolute;
  right: 0;
  top: 28px;
  padding: 8px 12px;
  font-size: 1rem;
  color: var(--color-text-muted);
  cursor: pointer;
}

/* ═══════════════════════════════════════════════════════════════════════════
   User Column (used in various list views)
   ═══════════════════════════════════════════════════════════════════════════ */

.user-col {
  border: 1px solid var(--color-border);
  background-color: var(--color-bg);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  max-width: 350px;
}

.user-col .name {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text);
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0;
  text-transform: capitalize;
}

.user-col .email {
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--color-text-secondary);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Image Upload
   ═══════════════════════════════════════════════════════════════════════════ */

.custom-img-input {
  width: 180px;
  height: 80px;
  background-color: var(--color-bg);
  border: 2px dashed var(--color-border-hover);
  border-radius: var(--radius-lg);
  color: var(--color-text);
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.custom-img-input:hover {
  border-color: var(--color-accent);
  background-color: var(--color-accent-50);
}

.custom-img-input i {
  font-size: 1.75rem;
  color: var(--color-accent);
}

.form-image {
  position: relative;
  width: 250px;
}

.form-image img {
  border-radius: var(--radius-md);
  object-fit: contain;
  width: 100%;
  height: auto;
}

.form-image .btn-removeImg {
  position: absolute;
  z-index: 2;
  right: var(--space-2);
  top: var(--space-2);
  border: none;
  background-color: var(--color-danger);
  color: #ffffff;
  border-radius: var(--radius-sm);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.form-image .btn-removeImg:hover {
  filter: brightness(0.9);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Company Profile
   ═══════════════════════════════════════════════════════════════════════════ */

.c-profile-logo {
  max-width: 150px;
  height: auto;
}

.p-edit-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
}

.p-edit-btn .bi {
  font-size: var(--text-base);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Action Buttons
   ═══════════════════════════════════════════════════════════════════════════ */

.actn-btn a {
  text-decoration: none;
}

.actn-btn .btn-ico {
  padding: 4px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Units
   ═══════════════════════════════════════════════════════════════════════════ */

.unit {
  font-size: var(--text-2xs);
  vertical-align: super;
  margin-left: 0.1rem;
}

span.unit-sm {
  font-size: var(--text-2xs);
  vertical-align: super;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Inventory Labels
   ═══════════════════════════════════════════════════════════════════════════ */

.inventory {
  font-size: var(--text-xs);
  font-weight: 500;
  font-family: var(--font-heading);
  color: var(--color-text);
  padding: 2px 10px;
  border-radius: var(--radius-full);
  text-transform: capitalize;
  min-width: 90px;
  max-width: fit-content;
  background-color: var(--color-bg);
  line-height: 1.5;
}

.inventory_added {
  color: #059669;
  background-color: #d1fae5;
}

.inventory_release {
  color: #2563eb;
  background-color: #dbeafe;
}

.inventory_held {
  color: #d97706;
  background-color: #fef3c7;
}

.inventory_removed {
  color: #b91c1c;
  background-color: #fee2e2;
}

.inventory_dispatched {
  color: #7c3aed;
  background-color: #ede9fe;
}

[data-theme="dark"] .inventory_added {
  color: #6ee7b7;
  background-color: rgba(16, 185, 129, 0.12);
}

[data-theme="dark"] .inventory_release {
  color: #93c5fd;
  background-color: rgba(113, 113, 122, 0.12);
}

[data-theme="dark"] .inventory_held {
  color: #fcd34d;
  background-color: rgba(245, 158, 11, 0.12);
}

[data-theme="dark"] .inventory_removed {
  color: #fca5a5;
  background-color: rgba(239, 68, 68, 0.12);
}

[data-theme="dark"] .inventory_dispatched {
  color: #c4b5fd;
  background-color: rgba(139, 92, 246, 0.12);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Offer/Order Table
   ═══════════════════════════════════════════════════════════════════════════ */

.hover-primary {
  border-color: transparent !important;
  transition: border-color var(--transition-fast);
}

.hover-primary:hover {
  border-color: var(--color-accent) !important;
}

.offer-order .logo {
  height: 50px;
}

.vendor .name {
  font-size: var(--text-2xl);
  font-weight: 600;
  margin-top: 6px;
  font-family: var(--font-heading);
}

.vendor .data {
  font-size: var(--text-base);
  margin-top: 2px;
  color: var(--color-text-secondary);
}

.custom-table th {
  background-color: var(--color-text) !important;
  color: #ffffff !important;
  font-weight: 500;
  font-size: var(--text-sm);
  padding: var(--space-3) var(--space-4);
}

.custom-table td {
  font-size: var(--text-sm);
  color: var(--color-text) !important;
  padding: var(--space-3) var(--space-4);
}

.custom-table .remove-btn {
  background-color: transparent;
  color: var(--color-danger);
  border-color: var(--color-danger);
  border-radius: var(--radius-full);
  width: 25px;
  height: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Scrollbar
   ═══════════════════════════════════════════════════════════════════════════ */

.scrollarea {
  overflow-y: auto;
}

::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

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

::-webkit-scrollbar-thumb {
  background-color: var(--color-border);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--color-border-hover);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Footer
   ═══════════════════════════════════════════════════════════════════════════ */

footer {
  border-top: 1px solid var(--color-border) !important;
  padding: var(--space-3) 0;
}

footer small {
  color: var(--color-text-muted);
  font-size: var(--text-xs);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Dark Mode Toggle Button
   ═══════════════════════════════════════════════════════════════════════════ */

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg-hover);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  padding: 0;
  font-size: 0.95rem;
}

.theme-toggle:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
  background-color: var(--color-accent-50);
}

.theme-toggle .bi-sun-fill {
  display: none;
}

[data-theme="dark"] .theme-toggle .bi-moon-fill {
  display: none;
}

[data-theme="dark"] .theme-toggle .bi-sun-fill {
  display: inline-block;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════════════════════════════════════ */

@media screen and (max-width: 992px) {
  .dash-body .main-sidebar {
    display: none;
  }

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

/* ═══════════════════════════════════════════════════════════════════════════
   Animations
   ═══════════════════════════════════════════════════════════════════════════ */

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

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

.fade-in {
  animation: fadeIn var(--transition-slow) ease;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Selection
   ═══════════════════════════════════════════════════════════════════════════ */

::selection {
  background-color: var(--color-accent-light);
  color: var(--color-accent);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Text color utilities for dark mode compatibility
   ═══════════════════════════════════════════════════════════════════════════ */

[data-theme="dark"] .text-dark {
  color: var(--color-text) !important;
}

[data-theme="dark"] .text-secondary {
  color: var(--color-text-secondary) !important;
}

[data-theme="dark"] .text-muted {
  color: var(--color-text-muted) !important;
}

[data-theme="dark"] .border-top,
[data-theme="dark"] .border-bottom {
  border-color: var(--color-border) !important;
}

[data-theme="dark"] .bg-white,
[data-theme="dark"] .bg-light {
  background-color: var(--color-bg-card) !important;
}

[data-theme="dark"] .table {
  color: var(--color-text);
}

[data-theme="dark"] .form-check-input {
  background-color: var(--color-bg-input);
  border-color: var(--color-border);
}

/* Fix dark mode for Bootstrap .shadow-sm */
[data-theme="dark"] .shadow-sm {
  box-shadow: var(--shadow-sm) !important;
}

/* ─── Dark Mode Overrides ────────────────────────────────────────────────── */
[data-theme="dark"] .gridjs-wrapper,
[data-theme="dark"] .gridjs-container,
[data-theme="dark"] table.gridjs-table,
[data-theme="dark"] .gridjs-tbody {
  background-color: transparent !important;
  border-color: var(--color-border) !important;
}

[data-theme="dark"] .gridjs-head,
[data-theme="dark"] .gridjs-footer {
  background-color: transparent !important;
  border-color: var(--color-border) !important;
}

[data-theme="dark"] .gridjs-th,
[data-theme="dark"] .gridjs-td,
[data-theme="dark"] td.gridjs-td,
[data-theme="dark"] th.gridjs-th {
  background-color: transparent !important;
  border-bottom-color: var(--color-border) !important;
  color: var(--color-text) !important;
}

[data-theme="dark"] .gridjs-tr:hover .gridjs-td,
[data-theme="dark"] .gridjs-tr:hover td.gridjs-td {
  background-color: var(--color-bg-hover) !important;
  color: var(--color-text) !important;
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="dark"] textarea,
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="date"],
[data-theme="dark"] .gridjs-search-input {
  background-color: var(--color-bg-input) !important;
  border-color: var(--color-border) !important;
  color: var(--color-text) !important;
}

[data-theme="dark"] .form-control::placeholder,
[data-theme="dark"] .gridjs-search-input::placeholder {
  color: var(--color-text-muted) !important;
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus,
[data-theme="dark"] .gridjs-search-input:focus {
  border-color: var(--color-accent) !important;
  background-color: var(--color-bg-input) !important;
  color: var(--color-text) !important;
}

[data-theme="dark"] .ss-main,
[data-theme="dark"] .ss-content {
  background-color: var(--color-bg-input) !important;
  border-color: var(--color-border) !important;
  color: var(--color-text) !important;
}

[data-theme="dark"] .ss-content .ss-list .ss-option {
  background-color: var(--color-bg-input) !important;
  color: var(--color-text) !important;
}

[data-theme="dark"] .ss-content .ss-list .ss-option:hover {
  background-color: var(--color-accent) !important;
  color: var(--color-on-accent) !important;
}

[data-theme="dark"] .ss-value-text {
  color: #fff !important;
}

[data-theme="dark"] .dropdown-menu {
  background-color: var(--color-bg-card) !important;
  border-color: var(--color-border);
}

[data-theme="dark"] .dropdown-item {
  color: var(--color-text);
}

[data-theme="dark"] .dropdown-item:hover {
  background-color: var(--color-bg-hover);
}

[data-theme="dark"] .modal-content {
  background-color: var(--color-bg-card);
  border: 1px solid var(--color-border);
}

[data-theme="dark"] .text-muted {
  color: var(--color-text-muted) !important;
}

[data-theme="dark"] .btn-light {
  background-color: var(--color-bg-hover);
  border-color: var(--color-border);
  color: var(--color-text);
}

[data-theme="dark"] .btn-light:hover {
  background-color: var(--color-border);
}

/* Fix for customer modal table which might have explicit white bg */
[data-theme="dark"] .table {
  color: var(--color-text) !important;
  border-color: var(--color-border) !important;
}

[data-theme="dark"] .table > :not(caption) > * > * {
  background-color: transparent !important;
  color: var(--color-text) !important;
}

/* GridJS pagination dark mode */
[data-theme="dark"] .gridjs-pages button {
  background-color: var(--color-bg-card) !important;
  color: var(--color-text-secondary) !important;
  border-color: var(--color-border) !important;
}

[data-theme="dark"] .gridjs-pages button:hover {
  background-color: var(--color-bg-hover) !important;
  color: var(--color-text) !important;
}

[data-theme="dark"] .gridjs-pages button.gridjs-currentPage {
  background-color: var(--color-accent) !important;
  color: #09090b !important;
  border-color: var(--color-accent) !important;
}

[data-theme="dark"] .gridjs-summary {
  color: var(--color-text-muted) !important;
}

[data-theme="dark"] .gridjs-footer {
  border-top-color: var(--color-border) !important;
}

/* GridJS sort icon dark mode */
[data-theme="dark"] .gridjs-sort {
  filter: invert(0.7);
}

[data-theme="dark"] .gridjs-sort-asc,
[data-theme="dark"] .gridjs-sort-desc {
  filter: invert(0.9);
}

/* Alert dark mode */
[data-theme="dark"] .alert-success {
  background-color: rgba(52, 211, 153, 0.15);
  color: #34d399;
}

[data-theme="dark"] .alert-danger {
  background-color: rgba(248, 113, 113, 0.15);
  color: #f87171;
}

[data-theme="dark"] .alert-warning {
  background-color: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
}

[data-theme="dark"] .alert-info {
  background-color: rgba(161, 161, 170, 0.15);
  color: #60a5fa;
}

/* Text danger dark mode fix */
[data-theme="dark"] .text-danger {
  color: var(--color-danger) !important;
}

/* Form select option dark mode */
[data-theme="dark"] .form-select option {
  background-color: var(--color-bg-card);
  color: var(--color-text);
}

/* Input number dark mode */
[data-theme="dark"] input[type="number"] {
  background-color: var(--color-bg-input) !important;
  border-color: var(--color-border) !important;
  color: var(--color-text) !important;
}

/* Grid.js list tables: monospace ID + created date */
.grid-list-id-cell {
  line-height: 1.3;
}
.grid-list-id-cell .grid-list-id {
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--color-text);
}
.grid-list-id-cell .grid-list-id-date {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: 2px;
}
[data-theme="dark"] .grid-list-id-cell .grid-list-id {
  color: var(--color-text);
}

/* Fullscreen restore banner (after reload — needs explicit user click) */
#nextrise-fs-restore-hint {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10900;
  padding: 0.55rem 1rem;
  background: var(--color-bg-card);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm, 0 4px 12px rgba(9, 9, 11, 0.08));
  font-size: 0.8125rem;
  line-height: 1.35;
}

#nextrise-fs-restore-hint .nextrise-fs-restore-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  max-width: 1200px;
  margin: 0 auto;
}

#nextrise-fs-restore-hint .nextrise-fs-restore-desc {
  color: var(--color-text-secondary);
  font-weight: 400;
}

#nextrise-fs-restore-hint .nextrise-fs-restore-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  flex-shrink: 0;
}
