:root {
  /* ===== Premium dark surfaces ===== */
  --bg-primary: #0B0C0F;        /* app background base */
  --bg-card: #15171D;           /* cards, panels, command bars */
  --bg-elevated: #1C1F27;       /* insets: stat tiles, payment buttons, detail boxes */
  --bg-input: #1E222B;          /* form fields, search, segmented controls */
  --bg-subtle: #101218;         /* panel bodies / nested sub-areas */
  --bg-inverse: #08090C;        /* deep contrast surfaces */

  --accent-gold: #D4AF37;
  --accent-gold-light: #F1D27A;
  --accent-rose: #C08081;

  --text-primary: #ECEDF1;
  --text-secondary: #C4C6CF;
  --text-muted: #8A8D99;

  --border-subtle: rgba(212, 175, 55, 0.16);
  --hairline: rgba(255, 255, 255, 0.07);

  --success: #30D158;
  --danger: #FF453A;
  --warning: #FF9F0A;

  --sidebar-expanded-width: 260px;
  --sidebar-collapsed-width: 84px;
  --sidebar-width: var(--sidebar-expanded-width);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 14px 38px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55);
  --radius-md: 14px;
  --radius-lg: 18px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --font-sans: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Roboto", "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, "Roboto", "Helvetica Neue", Arial, sans-serif;

  /* Vibrant accent palette (brightened for dark backgrounds) */
  --c-blue: #4D8DFF;
  --c-blue-soft: rgba(77, 141, 255, 0.16);
  --c-green: #2DD4A7;
  --c-green-soft: rgba(45, 212, 167, 0.16);
  --c-amber: #FBBF24;
  --c-amber-soft: rgba(251, 191, 36, 0.18);
  --c-purple: #A78BFA;
  --c-purple-soft: rgba(167, 139, 250, 0.16);
  --c-rose: #FB7185;
  --c-rose-soft: rgba(251, 113, 133, 0.16);
  --c-cyan: #22D3EE;
  --c-cyan-soft: rgba(34, 211, 238, 0.16);
  --c-teal: #2DD4BF;
  --c-teal-soft: rgba(45, 212, 191, 0.16);

  /* Chart.js tick + grid colors (read by chart scripts) */
  --chart-tick: #9A9CA6;
  --chart-grid: rgba(255, 255, 255, 0.08);
}

/* ===== Bootstrap component variables per theme ===== */
[data-bs-theme="dark"] {
  --bs-body-bg: #0B0C0F;
  --bs-body-color: #ECEDF1;
  --bs-emphasis-color: #FFFFFF;
  --bs-secondary-color: #8A8D99;
  --bs-border-color: rgba(255, 255, 255, 0.08);
  --bs-tertiary-bg: #1C1F27;
}

/* =========================================
   LIGHT THEME — soft off-white, not pure white
========================================= */
[data-bs-theme="light"] {
  --bg-primary: #ECEEF2;       /* page base — soft neutral, not white */
  --bg-card: #FFFFFF;          /* cards / panels */
  --bg-elevated: #F2F4F8;      /* insets */
  --bg-input: #F1F3F7;         /* form fields */
  --bg-subtle: #E8EAEF;        /* nested sub-areas */
  --bg-inverse: #14161C;       /* deep contrast surfaces stay dark */

  --accent-gold: #B8860B;
  --accent-gold-light: #D4AF37;

  --text-primary: #1C1E26;
  --text-secondary: #454956;
  --text-muted: #6B7280;

  --border-subtle: rgba(184, 134, 11, 0.20);
  --hairline: rgba(17, 17, 17, 0.09);

  --shadow-sm: 0 2px 8px rgba(28, 28, 30, 0.06);
  --shadow-md: 0 12px 32px rgba(28, 28, 30, 0.09);
  --shadow-lg: 0 20px 48px rgba(28, 28, 30, 0.14);

  /* Deeper, higher-contrast data palette for light surfaces */
  --c-blue: #2F6BFF;   --c-blue-soft: rgba(47, 107, 255, 0.12);
  --c-green: #12B886;  --c-green-soft: rgba(18, 182, 134, 0.12);
  --c-amber: #E08600;  --c-amber-soft: rgba(245, 158, 11, 0.14);
  --c-purple: #8B5CF6; --c-purple-soft: rgba(139, 92, 246, 0.12);
  --c-rose: #F43F5E;   --c-rose-soft: rgba(244, 63, 94, 0.12);
  --c-cyan: #0891B2;   --c-cyan-soft: rgba(6, 182, 212, 0.12);
  --c-teal: #14B8A6;   --c-teal-soft: rgba(20, 184, 166, 0.12);

  --chart-tick: #6B7280;
  --chart-grid: rgba(28, 28, 30, 0.10);

  --bs-body-bg: #ECEEF2;
  --bs-body-color: #1C1E26;
  --bs-emphasis-color: #000000;
  --bs-secondary-color: #6B7280;
  --bs-border-color: rgba(17, 17, 17, 0.12);
  --bs-tertiary-bg: #F2F4F8;
}

[data-bs-theme="light"] body {
  background:
    radial-gradient(circle at 0% 0%, rgba(212, 175, 55, 0.22), transparent 40rem),
    radial-gradient(circle at 100% 0%, rgba(212, 175, 55, 0.14), transparent 38rem),
    linear-gradient(160deg, #FFFFFF 0%, #FBF3DD 55%, #F3E0A8 100%);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  scrollbar-color: rgba(184, 134, 11, 0.3) rgba(0, 0, 0, 0.02);
}

html {
  font-size: 12px;
  max-width: 100%;
  overflow-x: hidden;
}

@media (max-width: 1199px) {
  html {
    font-size: 11px;
  }
}

@media (max-width: 767px) {
  html {
    font-size: 10px;
  }
}

body {
  min-height: 100vh;
  max-width: 100%;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 0% 0%, rgba(212, 175, 55, 0.10), transparent 42rem),
    radial-gradient(circle at 100% 0%, rgba(192, 128, 129, 0.06), transparent 40rem),
    linear-gradient(160deg, #0C0E12 0%, #08090C 100%);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: var(--font-sans);
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.app-page {
  font-size: 0.92rem;
}

h1, h2, h3, h4, h5, h6, .display-font {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
}

a {
  color: var(--accent-gold);
}

.auth-page {
  display: grid;
  place-items: center;
  padding: 2rem;
  background:
    radial-gradient(circle at 10% 10%, rgba(212, 175, 55, 0.26), transparent 28rem),
    radial-gradient(circle at 90% 15%, rgba(192, 128, 129, 0.16), transparent 24rem),
    linear-gradient(135deg, #f8f1dc 0%, #fffdfa 46%, #f3e6c2 100%);
}

.login-shell {
  width: min(1120px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(420px, 0.92fr);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(184, 134, 11, 0.18);
  border-radius: 28px;
  box-shadow: 0 30px 90px rgba(32, 24, 8, 0.18);
  backdrop-filter: blur(14px);
}

.login-visual {
  min-height: 640px;
  padding: 3rem;
  background:
    linear-gradient(150deg, rgba(8, 9, 12, 0.45) 0%, rgba(8, 9, 12, 0.9) 100%),
    url("../img/login-perfume-bg.jpg") center/cover;
}

.login-visual h1,
.login-visual .display-4 {
  color: #FFFFFF;
}

.login-card {
  padding: 3rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(255, 252, 245, 0.96) 100%);
}

.login-brand-wrap {
  display: grid;
  gap: 1.5rem;
}

.login-logo-mark {
  width: min(14rem, 100%);
  min-width: 8.5rem;
  height: 8rem;
  display: grid;
  place-items: center;
  padding: 0.8rem;
  border-radius: 1.6rem;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
}

.login-logo-mark span {
  color: #FFFFFF;
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 700;
}

.login-brand-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.login-kicker {
  color: var(--accent-gold-light);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.login-copy {
  max-width: 34rem;
  color: rgba(255, 255, 255, 0.82);
  font-size: 1.02rem;
  line-height: 1.7;
}

.login-feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.login-feature-card {
  padding: 1.2rem 1.1rem;
  border-radius: 1.1rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
}

.login-feature-card strong {
  display: block;
  margin-bottom: 0.35rem;
  color: #FFFFFF;
  font-size: 1rem;
}

.login-feature-card p {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.55;
}

.login-feature-icon {
  width: 2.75rem;
  height: 2.75rem;
  display: inline-grid;
  place-items: center;
  margin-bottom: 0.9rem;
  border-radius: 0.9rem;
  background: rgba(212, 175, 55, 0.18);
  color: var(--accent-gold-light);
  font-size: 1.1rem;
}

.login-card-header .h1,
.login-card-header h2 {
  color: #1f1a12;
}

.login-card .form-control,
.login-card .form-select {
  background: #f7f1e3;
  border-color: rgba(184, 134, 11, 0.18);
}

.login-card .form-control:focus,
.login-card .form-select:focus {
  background: #fffdf7;
}

.login-trustbar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
  margin-top: 1.4rem;
  padding-top: 1.4rem;
  border-top: 1px solid rgba(184, 134, 11, 0.16);
}

.login-trustbar span {
  display: block;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.login-trustbar strong {
  display: block;
  margin-top: 0.28rem;
  color: var(--text-primary);
  font-size: 0.96rem;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  background:
    radial-gradient(circle at 50% -10%, rgba(212, 175, 55, 0.14), transparent 60%),
    linear-gradient(180deg, #1A1A1C 0%, #0E0E10 100%);
  border-right: 1px solid rgba(212, 175, 55, 0.12);
  box-shadow: 16px 0 48px rgba(0, 0, 0, 0.3);
  z-index: 1020;
  display: flex;
  flex-direction: column;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1.35rem 1.2rem;
  text-decoration: none;
  color: #FFFFFF;
}

.brand-emblem {
  width: 2.75rem;
  height: 2.75rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(212, 175, 55, 0.3);
  background: linear-gradient(145deg, rgba(212, 175, 55, 0.08), rgba(192, 128, 129, 0.05));
  color: var(--accent-gold);
  font-family: var(--font-display);
  font-size: 1.6rem;
  box-shadow: 0 0 28px rgba(212, 175, 55, 0.08);
}

.brand-text span {
  display: block;
  font-family: var(--font-display);
  font-size: 1.35rem;
  line-height: 1;
}

.brand-text small {
  display: block;
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-top: 0.2rem;
}

.sidebar-nav {
  padding: 0.8rem;
  overflow-y: auto;
}

.sidebar .nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  color: #A1A1A6;
  padding: 0.82rem 0.9rem;
  margin-bottom: 0.25rem;
  border-radius: 0.7rem;
  transition: color 180ms ease, background 180ms ease, transform 180ms ease;
}

.sidebar .nav-link i {
  color: var(--accent-gold);
  font-size: 1.08rem;
}

.sidebar .nav-link:hover {
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.06);
  transform: translateX(2px);
}

.sidebar .nav-link.active {
  color: #FFFFFF;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.22), rgba(192, 128, 129, 0.12));
  box-shadow: inset 0 0 0 1px rgba(212, 175, 55, 0.25);
}

.sidebar .nav-link.active i {
  color: var(--accent-gold-light);
}

.sidebar .nav-link.active::before {
  content: "";
  position: absolute;
  left: -0.8rem;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 3px;
  border-radius: 99px;
  background: var(--accent-gold-light);
  box-shadow: 0 0 16px rgba(212, 175, 55, 0.5);
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.7rem 0.8rem 0.9rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: #A1A1A6;
  font-size: 0.8rem;
}

.footer-userinfo {
  padding: 0.3rem 0.65rem 0.5rem;
  color: #8A8D99;
  font-size: 0.76rem;
  letter-spacing: 0.01em;
}

/* Footer actions (theme toggle + sign out) — consistent, button-like rows */
.sidebar-footer .ghost-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  margin: 0;
  padding: 0.58rem 0.65rem;
  border: 0;
  border-radius: 0.7rem;
  background: transparent;
  color: #B6B7BD;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background 160ms var(--ease), color 160ms var(--ease);
}

.sidebar-footer .ghost-link i {
  flex: 0 0 auto;
  width: 1.25rem;
  text-align: center;
  font-size: 1.05rem;
  color: var(--accent-gold-light);
  transition: color 160ms var(--ease);
}

.sidebar-footer .ghost-link:hover,
.sidebar-footer .ghost-link:focus-visible {
  background: rgba(255, 255, 255, 0.07);
  color: #FFFFFF;
}

.sidebar-footer .ghost-link.sign-out:hover,
.sidebar-footer .ghost-link.sign-out:focus-visible {
  background: rgba(255, 69, 58, 0.14);
  color: #FF7A70;
}

.sidebar-footer .ghost-link.sign-out:hover i,
.sidebar-footer .ghost-link.sign-out:focus-visible i {
  color: #FF7A70;
}

.main-content {
  min-height: 100vh;
  width: calc(100% - var(--sidebar-width));
  max-width: calc(100vw - var(--sidebar-width));
  margin-left: var(--sidebar-width);
  padding: 1.5rem 1.75rem 2.5rem;
  overflow-x: clip;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1), margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-content > *,
.main-content .card,
.main-content .luxury-panel {
  min-width: 0;
}

.main-content canvas {
  display: block;
  width: 100% !important;
  max-width: 100%;
}

.page-fade {
  animation: fadeIn 340ms ease both;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.1rem;
  position: relative;
}

.page-heading::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(184, 134, 11, 0.35), rgba(184, 134, 11, 0.04) 60%, transparent);
}

.page-heading h1 {
  font-size: 2.1rem;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.page-heading p {
  color: var(--accent-gold);
  margin-bottom: 0.3rem;
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
}

.page-heading .text-uppercase.gold-text {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.page-heading .text-uppercase.gold-text::before {
  content: "";
  width: 1.4rem;
  height: 2px;
  border-radius: 2px;
  background: var(--accent-gold);
}

.card,
.modal-content,
.offcanvas,
.luxury-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  color: var(--text-primary);
  transition: box-shadow 220ms var(--ease), border-color 220ms var(--ease);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.app-page .card-body {
  padding: 1.1rem;
}

.card .card-body h2.h3,
.card .card-body h2 {
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.hover-lift {
  transition: transform 220ms var(--ease), border-color 220ms var(--ease), box-shadow 220ms var(--ease);
}

.hover-lift:hover {
  transform: translateY(-3px);
  border-color: rgba(212, 175, 55, 0.35);
  box-shadow: var(--shadow-lg);
}

.text-soft,
.text-muted {
  color: var(--text-muted) !important;
}

.gold-text {
  color: var(--accent-gold);
}

.btn {
  border-radius: 0.65rem;
  font-weight: 600;
  letter-spacing: 0;
  padding: 0.45rem 0.75rem;
  transition: transform 150ms var(--ease), box-shadow 150ms var(--ease), filter 150ms var(--ease), background 150ms var(--ease), color 150ms var(--ease), border-color 150ms var(--ease);
}

.btn:active {
  transform: translateY(1px) scale(0.99);
}

.btn-primary,
.btn-gold {
  border: 0;
  color: #FFFFFF;
  background: linear-gradient(135deg, var(--accent-gold), var(--accent-gold-light));
  box-shadow: 0 10px 24px rgba(212, 175, 55, 0.25);
}

.btn-primary:hover,
.btn-gold:hover {
  color: #FFFFFF;
  filter: brightness(1.07);
  box-shadow: 0 12px 28px rgba(212, 175, 55, 0.35);
  transform: translateY(-1px);
}

.btn-ghost {
  color: var(--accent-gold);
  border: 1px solid rgba(212, 175, 55, 0.3);
  background: rgba(212, 175, 55, 0.04);
}

.btn-ghost:hover {
  color: #FFFFFF;
  border-color: var(--accent-gold);
  background: var(--accent-gold);
}

.btn-danger-soft {
  color: #FFFFFF;
  border: 1px solid rgba(211, 47, 47, 0.3);
  background: rgba(211, 47, 47, 0.85);
}

.form-control,
.form-select {
  background-color: var(--bg-input);
  border-color: var(--border-subtle);
  color: var(--text-primary);
  font-size: 0.9rem;
}

.app-page .form-floating > .form-control,
.app-page .form-floating > .form-select {
  min-height: 3rem;
  height: 3rem;
  padding-top: 1.15rem;
  padding-bottom: 0.3rem;
}

.app-page .form-floating > label {
  padding: 0.72rem 0.75rem;
  font-size: 0.84rem;
}

.form-control:focus,
.form-select:focus {
  background-color: var(--bg-elevated);
  border-color: var(--accent-gold);
  color: var(--text-primary);
  box-shadow: 0 0 0 0.2rem rgba(212, 175, 55, 0.18);
}

.form-control::placeholder {
  color: transparent;
}

.form-floating > label {
  color: var(--text-muted);
}

.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label,
.form-floating > .form-select ~ label {
  color: var(--accent-gold);
}

.input-group-text {
  background: rgba(212, 175, 55, 0.06);
  border-color: var(--border-subtle);
  color: var(--accent-gold);
}

.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--text-primary);
  --bs-table-striped-bg: rgba(255, 255, 255, 0.025);
  --bs-table-striped-color: var(--text-primary);
  --bs-table-hover-bg: rgba(212, 175, 55, 0.08);
  --bs-table-hover-color: var(--text-primary);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.table thead th {
  color: var(--accent-gold);
  border-bottom-color: rgba(212, 175, 55, 0.3);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.table td,
.table th {
  vertical-align: middle;
  padding: 0.65rem 0.75rem;
}

.table tbody tr {
  transition: background 150ms var(--ease);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.62rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.status-in {
  color: #106b3e;
  background: rgba(46, 139, 87, 0.12);
  border: 1px solid rgba(46, 139, 87, 0.25);
}

.status-low,
.badge-draft {
  color: #b36b00;
  background: rgba(245, 149, 0, 0.12);
  border: 1px solid rgba(245, 149, 0, 0.25);
}

.status-out,
.badge-confirmed {
  color: #b01c1c;
  background: rgba(211, 47, 47, 0.12);
  border: 1px solid rgba(211, 47, 47, 0.25);
}

.badge-confirmed {
  color: #106b3e;
  background: rgba(46, 139, 87, 0.12);
  border-color: rgba(46, 139, 87, 0.25);
}

.modal-backdrop.show,
.offcanvas-backdrop.show {
  opacity: 0.35;
}

.luxury-modal .modal-content {
  background: var(--bg-card);
  box-shadow: var(--shadow-lg) !important;
  border: 1px solid var(--border-subtle);
}

.modal-header,
.modal-footer {
  border-color: var(--border-subtle);
}

.offcanvas {
  background: var(--bg-card);
  box-shadow: var(--shadow-lg) !important;
  border-left: 1px solid var(--border-subtle);
}

.offcanvas-header {
  border-bottom: 1px solid var(--border-subtle);
}

.kpi-value {
  font-size: 2.2rem;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  letter-spacing: -0.01em;
}

.metric-icon {
  width: 2.75rem;
  height: 2.75rem;
  display: grid;
  place-items: center;
  border-radius: 0.9rem;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.16), rgba(192, 128, 129, 0.10));
  color: var(--accent-gold);
  font-size: 1.2rem;
}

.product-card {
  cursor: pointer;
  min-height: 164px;
}

.cart-list {
  max-height: 45vh;
  overflow: auto;
}

.cart-item {
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.85rem 0;
}

.pill-toggle .btn {
  border-color: var(--border-subtle);
  color: var(--text-muted);
  background: var(--bg-elevated);
}

.pill-toggle .btn-check:checked + .btn {
  color: #FFFFFF;
  background: linear-gradient(135deg, var(--accent-gold), var(--accent-gold-light));
  border-color: transparent;
}

.progress {
  background: rgba(255, 255, 255, 0.08);
  height: 0.75rem;
}

.progress-bar {
  background: linear-gradient(135deg, var(--accent-gold), var(--accent-gold-light));
}

.progress-bar.over-limit {
  background: var(--danger);
}

.luxury-toast {
  background: rgba(24, 26, 32, 0.96);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle) !important;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-md);
}

.toast-success i {
  color: var(--success);
}

.toast-error i {
  color: var(--danger);
}

.receipt {
  width: 320px;
  max-width: 100%;
  background: #fff;
  color: #111;
  padding: 1rem;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.receipt-logo {
  max-width: 120px;
  max-height: 56px;
  object-fit: contain;
  margin-bottom: 0.5rem;
}
/* =========================================
   SIDEBAR TOGGLE & MOBILE HEADER
========================================= */

.mobile-header {
  display: none !important;
  grid-template-columns: minmax(0, 1fr) 2.75rem;
  align-items: center;
  gap: 1rem;
  width: 100vw;
  max-width: 100vw;
  background: #111111;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: sticky;
  top: 0;
  z-index: 1010;
}
.mobile-header .btn-ghost {
  color: #A1A1A6;
}
.mobile-header .btn-ghost:hover {
  color: #FFFFFF;
}

.mobile-header .brand-mark {
  min-width: 0;
  padding: 0;
  overflow: hidden;
}

.mobile-header #mobileSidebarToggle {
  width: 2.75rem;
  height: 2.75rem;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  margin-left: auto;
  color: #111111;
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent-gold), var(--accent-gold-light));
  box-shadow: 0 10px 22px rgba(184, 134, 11, 0.24);
}

.mobile-header #mobileSidebarToggle i {
  line-height: 1;
}

.mobile-header #mobileSidebarToggle::before {
  content: "\2630";
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1;
}

.mobile-header #mobileSidebarToggle i {
  display: none;
}

.sidebar .btn-ghost {
  color: #A1A1A6;
}
.sidebar .btn-ghost:hover {
  color: #FFFFFF;
}

.sidebar {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: visible;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: 1015;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* --- DESKTOP COLLAPSED STATE --- */
body.sidebar-collapsed {
  --sidebar-width: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed.sidebar-hover-open {
  --sidebar-width: var(--sidebar-expanded-width);
}

body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .nav-label,
body.sidebar-collapsed .footer-userinfo {
  display: none;
}

body.sidebar-collapsed .brand-mark {
  justify-content: center;
  padding: 1.35rem 0;
}

body.sidebar-collapsed .sidebar .nav-link {
  justify-content: center;
  padding: 0.82rem 0;
}

body.sidebar-collapsed .sidebar .nav-link i {
  font-size: 1.25rem;
}

body.sidebar-collapsed .sidebar-header {
  flex-direction: column;
  padding: 1rem 0 !important;
}

body.sidebar-collapsed #desktopSidebarToggle .toggle-icon {
  transform: rotate(180deg);
}

body.sidebar-collapsed .sidebar-footer {
  text-align: center;
  padding: 0.7rem 0.4rem 0.9rem;
}

body.sidebar-collapsed .sidebar-footer .ghost-link {
  margin-top: 0;
  justify-content: center;
  gap: 0;
  padding: 0.58rem 0;
}

body.sidebar-collapsed .sidebar-footer .ghost-link i {
  width: auto;
}

body.sidebar-collapsed.sidebar-hover-open .sidebar {
  width: var(--sidebar-expanded-width);
  box-shadow: 18px 0 46px rgba(0, 0, 0, 0.24);
}

body.sidebar-collapsed.sidebar-hover-open .brand-text {
  display: block;
}

body.sidebar-collapsed.sidebar-hover-open .nav-label {
  display: inline;
}

body.sidebar-collapsed.sidebar-hover-open .footer-userinfo {
  display: block;
}

body.sidebar-collapsed.sidebar-hover-open .brand-mark {
  justify-content: flex-start;
  padding: 1.35rem 1.2rem;
}

body.sidebar-collapsed.sidebar-hover-open .sidebar .nav-link {
  justify-content: flex-start;
  padding: 0.82rem 0.9rem;
}

body.sidebar-collapsed.sidebar-hover-open .sidebar-header {
  flex-direction: row;
  padding: 1rem !important;
}

body.sidebar-collapsed.sidebar-hover-open .sidebar-footer {
  text-align: left;
  padding: 0.7rem 0.8rem 0.9rem;
}

body.sidebar-collapsed.sidebar-hover-open .sidebar-footer .ghost-link {
  margin-top: 0;
  justify-content: flex-start;
  gap: 0.7rem;
  padding: 0.58rem 0.65rem;
}

body.sidebar-collapsed.sidebar-hover-open .sidebar-footer .ghost-link i {
  width: 1.25rem;
}

/* --- RESPONSIVE BREAKPOINTS --- */

@media (max-width: 991px) {
  .mobile-header {
    display: grid !important;
  }

  body.sidebar-collapsed,
  body.sidebar-collapsed.sidebar-hover-open {
    --sidebar-width: 0px;
  }

  .sidebar {
    transform: translateX(-100%);
    width: min(280px, calc(100vw - 1rem));
    border-right: none;
    box-shadow: 4px 0 24px rgba(0,0,0,0.15);
  }

  .main-content {
    width: 100%;
    max-width: 100vw;
    margin-left: 0;
    padding: 1.5rem 1rem;
    overflow-x: clip;
  }

  body.sidebar-collapsed .brand-text,
  body.sidebar-collapsed .nav-label,
  body.sidebar-collapsed .footer-userinfo {
    display: block;
  }

  body.sidebar-collapsed .nav-label {
    display: inline;
  }

  body.sidebar-collapsed .brand-mark {
    justify-content: flex-start;
    padding: 1.35rem 1.2rem;
  }

  body.sidebar-collapsed .sidebar .nav-link {
    justify-content: flex-start;
    padding: 0.82rem 0.9rem;
  }

  body.sidebar-collapsed .sidebar-header {
    flex-direction: row;
    padding: 1rem !important;
  }

  body.sidebar-collapsed .sidebar-footer {
    text-align: left;
    padding: 0.7rem 0.8rem 0.9rem;
  }

  body.sidebar-collapsed .sidebar-footer .ghost-link {
    justify-content: flex-start;
    gap: 0.7rem;
    padding: 0.58rem 0.65rem;
  }

  body.sidebar-collapsed .sidebar-footer .ghost-link i {
    width: 1.25rem;
  }

  #desktopSidebarToggle {
    display: none !important;
  }

  /* When Mobile Sidebar is Open */
  body.mobile-sidebar-open .sidebar {
    transform: translateX(0);
  }

  body.mobile-sidebar-open .sidebar-overlay {
    opacity: 1;
    visibility: visible;
  }

  body.mobile-sidebar-open {
    overflow: hidden;
  }
  
  .page-heading {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
}

@media (max-width: 767px) {
  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-visual {
    min-height: 320px;
    padding: 2rem;
  }

  .login-card {
    padding: 2rem 1.35rem;
  }

  .login-logo-mark {
    width: min(12rem, 100%);
    min-width: 7.5rem;
    height: 7rem;
  }

  .login-feature-grid,
  .login-trustbar {
    grid-template-columns: 1fr;
  }
  
  .card-body {
    padding: 1.25rem;
  }
  
  /* Make tables scrollable natively on mobile */
  .table-responsive {
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
  }
}

@media (min-width: 992px) {
  #desktopSidebarToggle { position: absolute; right: -16px; top: 24px; background: #111111; border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 50%; width: 32px; height: 32px; display: flex !important; align-items: center; justify-content: center; z-index: 1050; padding: 0 !important; color: #A1A1A6; box-shadow: 2px 0 8px rgba(0,0,0,0.2); }
  #desktopSidebarToggle:hover { color: #fff; background: #222; }
}
.sidebar-header { position: relative; overflow: visible; }

.brand-logo-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: inherit;
}

.settings-logo-box {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
  border: 1px dashed rgba(184, 134, 11, 0.28);
  border-radius: 12px;
  background: rgba(212, 175, 55, 0.03);
}

.settings-logo-preview {
  width: 100%;
  min-height: 150px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}

.settings-logo-preview img {
  max-width: 90%;
  max-height: 128px;
  object-fit: contain;
}

.settings-logo-preview i {
  font-size: 2.5rem;
  color: var(--accent-gold);
}

.settings-repeat-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.settings-repeat-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
}

.settings-social-row {
  grid-template-columns: minmax(8rem, 0.45fr) minmax(0, 1fr) auto;
}

.settings-repeat-row .btn {
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  display: inline-grid;
  place-items: center;
}

.settings-repeat-row .form-control::placeholder {
  color: var(--text-muted);
}

.settings-profile-logo {
  width: 5rem;
  height: 5rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(212, 175, 55, 0.3);
  background: rgba(212, 175, 55, 0.08);
  overflow: hidden;
}

.settings-profile-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 0.5rem;
}

.settings-profile-logo span {
  color: var(--accent-gold);
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 700;
}

.settings-summary-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.settings-summary-list div {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.settings-summary-list span {
  color: var(--text-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.settings-summary-list strong {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.settings-social-link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 0.75rem;
  border-radius: 0.65rem;
  background: rgba(212, 175, 55, 0.06);
  text-decoration: none;
  overflow-wrap: anywhere;
}

@media (max-width: 767px) {
  .settings-repeat-row,
  .settings-social-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .settings-social-row input[name="social_url[]"] {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

/* =========================================
   POLISH: SCROLLBARS, CHIPS, FOCUS, SCALE
========================================= */

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(184, 134, 11, 0.25);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(184, 134, 11, 0.45);
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
}

a:focus-visible,
.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
.nav-link:focus-visible {
  outline: 2px solid var(--accent-gold);
  outline-offset: 2px;
}

.card-body h1, .card-body h2, .card-body h3 {
  letter-spacing: -0.01em;
}

/* Subtle entrance animation for cards within a page */
.row.g-4 > * {
  animation: fadeIn 380ms var(--ease) both;
}

.row.g-4:nth-of-type(2) > * {
  animation-delay: 60ms;
}

.row.g-4:nth-of-type(3) > * {
  animation-delay: 120ms;
}

/* =========================================
   MODERN COMPONENTS — applied app-wide
========================================= */

/* --- Section headers inside cards (h2/h3 + optional metric-icon) --- */
.card-body > h2,
.card-body > .h2,
.card-body > h3,
.card-body > .h3 {
  position: relative;
  padding-bottom: 0.65rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 1.2rem;
}

.card-body .d-flex.align-items-center.gap-2 .metric-icon,
.card-body .d-flex.align-items-center .metric-icon {
  flex: 0 0 auto;
}

/* --- Tables: lift rows, rounded shell, zebra polish --- */
.table-responsive {
  border-radius: var(--radius-md);
  /* Allow horizontal scrolling for wide tables instead of clipping their
     right-hand columns (e.g. the GRN line-items editor). */
  overflow-x: auto;
  overflow-y: visible;
}

.table {
  margin-bottom: 0;
}

.table thead th {
  background: rgba(184, 134, 11, 0.04);
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
  border-top: none;
  white-space: nowrap;
}

.table tbody tr:hover {
  background: var(--bs-table-hover-bg);
}

.table tbody td {
  border-color: rgba(255, 255, 255, 0.06);
}

/* --- Action buttons in tables: compact, neat --- */
.table .btn-sm {
  width: 2rem;
  height: 2rem;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 0.55rem;
}

/* --- Buttons: variants + sizing --- */
.btn-lg {
  padding: 0.7rem 1.3rem;
  font-size: 1rem;
}

.btn-sm {
  border-radius: 0.55rem;
}

.btn-outline-gold {
  color: var(--accent-gold);
  border: 1px solid rgba(184, 134, 11, 0.4);
  background: transparent;
}

.btn-outline-gold:hover {
  color: #fff;
  background: var(--accent-gold);
  border-color: var(--accent-gold);
}

.btn-danger-soft:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

/* --- Forms: softer, modern fields --- */
.form-control,
.form-select {
  border-radius: 0.6rem;
  border-width: 1px;
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease), background 150ms var(--ease);
}

.form-label {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

/* --- Status badges: refined --- */
.status-badge {
  letter-spacing: 0.02em;
}

/* --- Alerts --- */
.alert {
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.alert-danger {
  background: rgba(255, 69, 58, 0.12);
  border-color: rgba(255, 69, 58, 0.3);
  color: #FF8A82;
}

.alert-success {
  background: rgba(48, 209, 88, 0.12);
  border-color: rgba(48, 209, 88, 0.3);
  color: #5DE08A;
}

/* --- Empty states (rows with single centered cell) --- */
.table td.text-center.text-soft {
  padding-top: 2.5rem !important;
  padding-bottom: 2.5rem !important;
}

/* --- Modal & offcanvas headers --- */
.modal-header,
.offcanvas-header {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.06), rgba(192, 128, 129, 0.04));
}

.modal-title,
.offcanvas-title {
  font-family: var(--font-display);
  font-weight: 700;
}

.modal-content,
.offcanvas {
  border-radius: var(--radius-lg);
}

/* --- Generic stat / KPI tiles used by cash, sales, reports --- */
.cash-kpi,
.sales-kpi {
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
  transition: transform 220ms var(--ease), box-shadow 220ms var(--ease);
}

.cash-kpi:hover,
.sales-kpi:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.cash-kpi strong,
.sales-kpi strong {
  font-family: var(--font-display);
}

/* --- Toolbars / filter bars --- */
.reports-toolbar,
.sales-filter-bar,
.cash-state-card {
  border-radius: var(--radius-md);
}

.reports-quick-filters .btn {
  border-radius: 999px;
}

/* --- Pagination --- */
.page-link {
  color: var(--accent-gold);
  border-color: var(--border-subtle);
}

.page-item.active .page-link {
  background: linear-gradient(135deg, var(--accent-gold), var(--accent-gold-light));
  border-color: transparent;
}

/* --- Nav tabs / pills (reports etc.) --- */
.nav-tabs {
  border-bottom-color: var(--border-subtle);
}

.nav-tabs .nav-link {
  color: var(--text-muted);
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  font-weight: 600;
}

.nav-tabs .nav-link.active {
  color: var(--accent-gold);
  background: transparent;
  border-bottom-color: var(--accent-gold);
}

/* --- List groups --- */
.list-group-item {
  border-color: var(--border-subtle);
  background: transparent;
}

/* --- Tighten heading scale on small screens --- */
@media (max-width: 767px) {
  .main-content {
    padding: 1.25rem 1rem 2.5rem;
  }
  .page-heading h1 {
    font-size: 1.7rem;
  }
}

/* =========================================
   COLOR SYSTEM — vibrant accents app-wide
========================================= */

/* KPI cards get a colored top accent + colored icon tile.
   Each card in a KPI row cycles through the palette. */
.kpi-card {
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--kpi-color, var(--accent-gold));
}

/* KPI palette by position within a .kpi-row */
.kpi-row > [class*="col-"]:nth-child(4n+1) { --kpi-color: var(--c-green); --kpi-soft: var(--c-green-soft); }
.kpi-row > [class*="col-"]:nth-child(4n+2) { --kpi-color: var(--c-blue); --kpi-soft: var(--c-blue-soft); }
.kpi-row > [class*="col-"]:nth-child(4n+3) { --kpi-color: var(--c-amber); --kpi-soft: var(--c-amber-soft); }
.kpi-row > [class*="col-"]:nth-child(4n+4) { --kpi-color: var(--c-purple); --kpi-soft: var(--c-purple-soft); }

.kpi-row .metric-icon {
  background: var(--kpi-soft, var(--c-blue-soft));
  color: var(--kpi-color, var(--c-blue));
}

.kpi-row .kpi-value {
  color: var(--kpi-color, var(--text-primary));
}

/* Default metric icon = colorful (not flat gold) */
.metric-icon {
  background: linear-gradient(135deg, var(--c-blue-soft), var(--c-purple-soft));
  color: var(--c-blue);
}

/* Cash / Sales KPI tiles: colored top accent + colored values cycling palette */
.cash-kpi,
.sales-kpi {
  position: relative;
  overflow: hidden;
  border-top: 3px solid var(--kpi-color, var(--accent-gold));
}

.cash-kpi:nth-child(6n+1),  .sales-kpi:nth-child(5n+1) { --kpi-color: var(--c-green); }
.cash-kpi:nth-child(6n+2),  .sales-kpi:nth-child(5n+2) { --kpi-color: var(--c-blue); }
.cash-kpi:nth-child(6n+3),  .sales-kpi:nth-child(5n+3) { --kpi-color: var(--c-purple); }
.cash-kpi:nth-child(6n+4),  .sales-kpi:nth-child(5n+4) { --kpi-color: var(--c-amber); }
.cash-kpi:nth-child(6n+5),  .sales-kpi:nth-child(5n+5) { --kpi-color: var(--c-cyan); }
.cash-kpi:nth-child(6n+6) { --kpi-color: var(--c-rose); }

.cash-kpi strong,
.sales-kpi strong {
  color: var(--kpi-color, var(--accent-gold));
}

/* Reports key-figure cards: colored icons cycling */
.reports-figure-icon,
.reports-figure .metric-icon { color: var(--kpi-color, var(--c-blue)); }

/* Section headers inside cards get a small colored leading bar */
.card-body > h2::before,
.card-body > .h2::before,
.card-body > h3::before,
.card-body > .h3::before {
  content: "";
  display: inline-block;
  width: 0.55rem;
  height: 1.05em;
  margin-right: 0.55rem;
  vertical-align: -0.15em;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--accent-gold), var(--accent-gold-light));
}

/* Vibrant, colorful status badges (bright text for dark surfaces) */
.status-in,
.badge-confirmed {
  color: #3DDC97;
  background: var(--c-green-soft);
  border: 1px solid rgba(45, 212, 167, 0.32);
}

.status-low,
.badge-draft {
  color: #FBBF24;
  background: var(--c-amber-soft);
  border: 1px solid rgba(251, 191, 36, 0.34);
}

.status-out {
  color: #FF7A85;
  background: var(--c-rose-soft);
  border: 1px solid rgba(251, 113, 133, 0.34);
}

/* =========================================
   DARK-THEME POLISH — Bootstrap components
========================================= */

/* Dropdowns (reports export, etc.) */
.dropdown-menu {
  --bs-dropdown-bg: var(--bg-card);
  --bs-dropdown-border-color: var(--border-subtle);
  --bs-dropdown-color: var(--text-primary);
  --bs-dropdown-link-color: var(--text-primary);
  --bs-dropdown-link-hover-color: #fff;
  --bs-dropdown-link-hover-bg: rgba(212, 175, 55, 0.14);
  --bs-dropdown-link-active-bg: rgba(212, 175, 55, 0.22);
  box-shadow: var(--shadow-md);
}

/* Pagination tiles */
.page-link {
  background: var(--bg-card);
  color: var(--accent-gold);
  border-color: var(--border-subtle);
}

.page-link:hover {
  background: rgba(212, 175, 55, 0.12);
  color: var(--accent-gold-light);
}

.page-item.disabled .page-link {
  background: var(--bg-card);
  color: var(--text-muted);
}

/* List groups */
.list-group {
  --bs-list-group-bg: transparent;
  --bs-list-group-color: var(--text-primary);
  --bs-list-group-border-color: var(--border-subtle);
  --bs-list-group-action-hover-bg: rgba(212, 175, 55, 0.08);
  --bs-list-group-action-hover-color: var(--text-primary);
}

/* Inline links inside content stay legible & on-brand */
.main-content a:not(.btn):not(.nav-link):not(.page-link):not(.dropdown-item):not(.list-group-item) {
  color: var(--c-blue);
  text-decoration-color: rgba(77, 141, 255, 0.4);
}

/* Muted text helpers should read on dark */
.text-soft,
.text-muted {
  color: var(--text-muted) !important;
}

/* Close buttons (modals/offcanvas/toasts) — make visible on dark.
   In light mode Bootstrap's default (dark glyph) is correct, so gate this. */
[data-bs-theme="dark"] .btn-close {
  filter: invert(1) grayscale(100%) brightness(1.6);
  opacity: 0.75;
}
[data-bs-theme="dark"] .btn-close:hover {
  opacity: 1;
}

/* Inputs: ensure readable text + placeholders on dark fields */
.form-control,
.form-select {
  color: var(--text-primary);
}
.form-control:disabled,
.form-select:disabled {
  background-color: var(--bg-subtle);
  color: var(--text-muted);
}

/* Fixed-color Bootstrap utilities don't follow dark mode — remap them.
   (Only used on surfaces that should be dark in this app.) */
.bg-white {
  background-color: var(--bg-card) !important;
}
.bg-light {
  background-color: var(--bg-subtle) !important;
}
.text-dark {
  color: var(--text-primary) !important;
}

/* Code/print receipt stays on white paper regardless of theme */
.receipt {
  color-scheme: light;
}
.receipt,
.receipt .text-dark {
  color: #111 !important;
}
.receipt .bg-white {
  background-color: #fff !important;
}

/* Quick-filter / pill toggles use brand gold gradient (kept), but
   make inactive pills carry a soft tint so the bar isn't grey/dull */
.reports-quick-filters .btn:not(.btn-gold):not(.active) {
  background: var(--c-blue-soft);
  border-color: transparent;
  color: var(--c-blue);
}

/* Links inside content pop a touch more */
.main-content a:not(.btn):not(.nav-link):not(.page-link) {
  color: var(--c-blue);
  text-decoration-color: rgba(47, 107, 255, 0.35);
}

/* Sidebar icons: subtle multi-tone so nav isn't monochrome gold */
.sidebar .nav-link i { color: var(--accent-gold-light); }
.sidebar .nav-link:hover i { color: #fff; }

/* Soft tinted page background blobs already added; add a gentle
   colored ring to metric icons on hover for liveliness */
.hover-lift:hover .metric-icon {
  transform: scale(1.06);
  transition: transform 200ms var(--ease);
}

/* =========================================
   MODERN TOAST NOTIFICATIONS (toastr-style)
========================================= */
#toastHost {
  z-index: 1090;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  max-width: min(94vw, 384px);
  pointer-events: none;
}

.app-toast {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 0.7rem;
  width: 360px;
  max-width: 100%;
  margin-bottom: 0.7rem;
  padding: 0.85rem 0.9rem 0.95rem;
  overflow: hidden;
  pointer-events: auto;
  color: var(--text-primary);
  background: rgba(22, 24, 30, 0.97);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--toast-accent, var(--accent-gold));
  border-radius: 13px;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 0;
  transform: translateX(118%);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease), margin 0.3s var(--ease);
}

.app-toast.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.app-toast.is-leaving {
  opacity: 0;
  transform: translateX(118%);
  margin-bottom: -0.2rem;
}

.app-toast__icon {
  width: 2.1rem;
  height: 2.1rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--toast-soft, rgba(212, 175, 55, 0.16));
  color: var(--toast-accent, var(--accent-gold));
  font-size: 1.05rem;
}

.app-toast__content {
  min-width: 0;
  padding-top: 0.05rem;
}

.app-toast__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.2;
  margin-bottom: 0.12rem;
}

.app-toast__msg {
  color: var(--text-secondary);
  font-size: 0.84rem;
  line-height: 1.38;
  overflow-wrap: anywhere;
}

.app-toast__close {
  flex: 0 0 auto;
  align-self: start;
  margin: -0.2rem -0.15rem 0 0;
  padding: 0 0.2rem;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s var(--ease);
}

.app-toast__close:hover {
  color: var(--text-primary);
}

.app-toast__bar {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 100%;
  transform-origin: left center;
  background: var(--toast-accent, var(--accent-gold));
  opacity: 0.85;
  animation-name: app-toast-bar;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}

@keyframes app-toast-bar {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

.app-toast--success { --toast-accent: #30D158; --toast-soft: rgba(48, 209, 88, 0.16); }
.app-toast--error   { --toast-accent: #FF6B61; --toast-soft: rgba(255, 69, 58, 0.16); }
.app-toast--warning { --toast-accent: #FFB020; --toast-soft: rgba(255, 159, 10, 0.18); }
.app-toast--info    { --toast-accent: #4D8DFF; --toast-soft: rgba(77, 141, 255, 0.16); }

@media (max-width: 480px) {
  .app-toast { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .app-toast { transition: opacity 0.2s linear; transform: none; }
  .app-toast.is-leaving { transform: none; }
  .app-toast__bar { animation: none; }
}

/* =========================================
   LIGHT-THEME COMPONENT OVERRIDES
   (elements that hardcode dark-friendly values)
========================================= */

/* Status badges need darker text on light, tinted backgrounds */
[data-bs-theme="light"] .status-in,
[data-bs-theme="light"] .badge-confirmed {
  color: #0A7D52;
}
[data-bs-theme="light"] .status-low,
[data-bs-theme="light"] .badge-draft {
  color: #B36B00;
}
[data-bs-theme="light"] .status-out {
  color: #C81E3A;
}

/* Alerts */
[data-bs-theme="light"] .alert-danger {
  background: rgba(255, 59, 48, 0.08);
  border-color: rgba(255, 59, 48, 0.22);
  color: #9B1C1C;
}
[data-bs-theme="light"] .alert-success {
  background: rgba(52, 199, 89, 0.10);
  border-color: rgba(52, 199, 89, 0.24);
  color: #146C43;
}

/* Toasts on light surfaces */
[data-bs-theme="light"] .app-toast {
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow-lg);
}

/* Theme toggle button in the mobile header */
.theme-toggle-btn { color: #A1A1A6; }
.theme-toggle-btn:hover { color: #FFFFFF; }

/* POS deep-contrast panels: in light mode flip to light surfaces */
[data-bs-theme="light"] .pos-balance-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
}
[data-bs-theme="light"] .pos-balance-card span {
  color: var(--text-muted);
}
[data-bs-theme="light"] .pos-balance-card strong,
[data-bs-theme="light"] .summary-total strong {
  color: var(--accent-gold);
}
[data-bs-theme="light"] .summary-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}
[data-bs-theme="light"] .summary-panel .text-soft {
  color: var(--text-muted) !important;
}
[data-bs-theme="light"] .summary-total {
  border-top-color: var(--hairline);
}

