/* =========================================================================
   Endless Aisle — Premium SaaS Design System
   Restyles Bootstrap 5 classes so every page inherits the new look
   without changing any markup, IDs, or PHP logic.
   ========================================================================= */

/* ---- Fonts --------------------------------------------------------------- */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

/* ---- Design tokens ------------------------------------------------------- */
:root {
  --ea-primary: #bd8456;
  --ea-primary-hover: #a66e42;
  --ea-primary-soft: #f6ede3;
  --ea-secondary: #d9a066;
  --ea-accent: #e0b07a;
  --ea-accent-soft: #f6ede3;
  --ea-success: #22c55e;
  --ea-success-soft: #dcfce7;
  --ea-danger: #ef4444;
  --ea-danger-soft: #fee2e2;
  --ea-warning: #f59e0b;
  --ea-warning-soft: #fef3c7;
  --ea-info: #3b82f6;
  --ea-info-soft: #dbeafe;

  --ea-bg: #f8fafc;
  --ea-surface: #ffffff;
  --ea-sidebar: #ffffff;
  --ea-text: #111827;
  --ea-muted: #6b7280;
  --ea-border: #e5e7eb;
  --ea-border-soft: #eef0f3;

  --ea-radius-sm: 8px;
  --ea-radius: 12px;
  --ea-radius-lg: 16px;
  --ea-radius-xl: 20px;

  --ea-shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --ea-shadow-sm:
    0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.04);
  --ea-shadow: 0 4px 12px rgba(16, 24, 40, 0.08);
  --ea-shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.12);

  --ea-sidebar-w: 264px;
  --ea-sidebar-collapsed-w: 76px;
  --ea-topbar-h: 64px;

  --ea-transition: 0.18s cubic-bezier(0.4, 0, 0.2, 1);

  /* Bootstrap variable overrides */
  --bs-primary: #bd8456;
  --bs-primary-rgb: 189, 132, 86;
  --bs-body-font-family:
    "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --bs-body-color: #111827;
  --bs-body-bg: #f8fafc;
  --bs-border-color: #e5e7eb;
  --bs-link-color: #bd8456;
  --bs-link-hover-color: #a66e42;
}

/* ---- Dark mode tokens ---------------------------------------------------- */
[data-theme="dark"] {
  --ea-bg: #0b1120;
  --ea-surface: #111827;
  --ea-sidebar: #0f172a;
  --ea-text: #f1f5f9;
  --ea-muted: #94a3b8;
  --ea-border: #1e293b;
  --ea-border-soft: #1e293b;
  --ea-primary-soft: #3a2a1a;
  --ea-success-soft: #052e1a;
  --ea-danger-soft: #3b0d0d;
  --ea-warning-soft: #3b2a05;
  --ea-info-soft: #0c2a4d;

  --bs-body-color: #f1f5f9;
  --bs-body-bg: #0b1120;
  --bs-border-color: #1e293b;
  --bs-emphasis-color: #f1f5f9;
  --bs-secondary-color: #94a3b8;
  color-scheme: dark;
}

/* ---- Base ---------------------------------------------------------------- */
* {
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--bs-body-font-family);
  background-color: var(--ea-bg);
  color: var(--ea-text);
  font-size: 0.925rem;
  letter-spacing: -0.006em;
  transition:
    background-color var(--ea-transition),
    color var(--ea-transition);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--ea-text);
  letter-spacing: -0.02em;
  font-weight: 700;
}

::selection {
  background: rgba(189, 132, 86, 0.18);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--ea-muted) 35%, transparent);
  border-radius: 20px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--ea-muted) 55%, transparent);
  background-clip: padding-box;
}

/* =========================================================================
   App shell
   ========================================================================= */
#app-shell {
  min-height: 100vh;
}

.main-content {
  min-width: 0;
  background: var(--ea-bg);
  transition: background-color var(--ea-transition);
}

/* Desktop: lock the shell to the viewport and scroll only the content area,
   so the sidebar and topbar stay fixed no matter how tall the page/form is. */
@media (min-width: 992px) {
  #app-shell {
    height: 100vh;
    overflow: hidden;
  }
  .main-content {
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
  }
  .main-content > .navbar {
    flex-shrink: 0;
    position: sticky;
    top: 0;
  }
  .main-content > main {
    flex: 1 1 auto;
  }
}

/* ---- Sidebar (white, floating, rounded) --------------------------------- */
.sidebar {
  width: var(--ea-sidebar-w);
  flex-shrink: 0;
  position: sticky;
  height: 100vh;
  margin: 8px;
  background: var(--ea-sidebar) !important;
  color: var(--ea-text) !important;
  border: 1px solid var(--ea-border);
  border-radius: var(--ea-radius-lg);
  box-shadow: var(--ea-shadow-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition:
    width var(--ea-transition),
    left 0.25s cubic-bezier(0.4, 0, 0.2, 1),
    background-color var(--ea-transition),
    border-color var(--ea-transition);
}

.sidebar-brand {
  border-bottom: 1px solid var(--ea-border) !important;
  height: var(--ea-topbar-h);
  padding: 0 1.1rem !important;
  color: var(--ea-text) !important;
  flex-shrink: 0;
}
.sidebar-brand .brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--ea-primary), var(--ea-accent));
  color: #fff !important;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  box-shadow: 0 4px 10px rgba(189, 132, 86, 0.35);
  flex-shrink: 0;
}
.sidebar-brand .brand-text {
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--ea-text);
  white-space: nowrap;
}

.sidebar-search {
  padding: 0.85rem 1rem 0.35rem;
  flex-shrink: 0;
}
.sidebar-search .form-control {
  background: var(--ea-bg);
  border: 1px solid var(--ea-border);
  font-size: 0.85rem;
  border-radius: var(--ea-radius-sm);
  border-left: 0;
  padding-left: 0;
  color: var(--ea-text);
}
.sidebar-search .form-control::placeholder {
  color: var(--ea-muted);
}
.sidebar-search .input-group-text {
  background: var(--ea-bg);
  border: 1px solid var(--ea-border);
  border-right: 0;
  color: var(--ea-muted);
}
.sidebar-search .form-control:focus {
  box-shadow: none;
  border-color: var(--ea-border);
  background: var(--ea-surface);
}

.sidebar .nav {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.35rem 0.55rem 0.75rem !important;
  flex: 1 1 auto;
  min-height: 0;
}
.sidebar .nav-link {
  width: 100%;
}

.sidebar .nav-section {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #94a3b8 !important;
  padding: 0 0.5rem;
  margin: 0.85rem 0 0.3rem;
  white-space: nowrap;
  /* overflow: hidden; */
}
.sidebar .nav-section:first-child {
  margin-top: 0.15rem;
}

.sidebar .nav-link {
  border-radius: 10px;
  padding: 0.4rem 0.55rem;
  margin-bottom: 1px;
  font-size: 0.875rem;
  font-weight: 500;
  color: #475569 !important;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  position: relative;
  white-space: nowrap;
  transition:
    background var(--ea-transition),
    color var(--ea-transition);
}

/* Colored icon chip (Stripe-style) */
.sidebar .nav-ico {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--item-color, var(--ea-primary));
  background: color-mix(
    in srgb,
    var(--item-color, var(--ea-primary)) 12%,
    transparent
  );
  transition:
    background var(--ea-transition),
    color var(--ea-transition),
    transform var(--ea-transition);
}
.sidebar .nav-ico i {
  line-height: 1;
}
.sidebar .nav-txt {
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar .nav-link .nav-badge {
  margin-left: auto;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: var(--ea-primary-soft);
  color: var(--ea-primary);
}

.sidebar .nav-link:hover {
  background: var(--ea-bg);
  color: #1e293b !important;
}
.sidebar .nav-link:hover .nav-ico {
  background: color-mix(
    in srgb,
    var(--item-color, var(--ea-primary)) 20%,
    transparent
  );
  transform: translateY(-1px);
}

/* Soft active pill */
.sidebar .nav-link.active {
  background: color-mix(
    in srgb,
    var(--item-color, var(--ea-primary)) 10%,
    transparent
  );
  color: color-mix(
    in srgb,
    var(--item-color, var(--ea-primary)) 70%,
    #0f172a
  ) !important;
  font-weight: 600;
}
.sidebar .nav-link.active .nav-ico {
  background: linear-gradient(
    135deg,
    var(--item-color, var(--ea-primary)),
    color-mix(in srgb, var(--item-color, var(--ea-primary)) 55%, #f0c994)
  );
  color: #fff;
  box-shadow: 0 3px 8px
    color-mix(in srgb, var(--item-color, var(--ea-primary)) 40%, transparent);
}
.sidebar .nav-link.active::before {
  content: "";
  position: absolute;
  left: -0.55rem;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  border-radius: 0 3px 3px 0;
  background: var(--item-color, var(--ea-primary));
}

.sidebar-user {
  border-top: 1px solid var(--ea-border);
  padding: 0.75rem;
  flex-shrink: 0;
  overflow: hidden;
}
.sidebar-user .min-w-0 {
  min-width: 0;
}
.sidebar-user .avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--ea-primary), var(--ea-accent));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.sidebar-user .u-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ea-text);
  line-height: 1.1;
}
.sidebar-user .u-role {
  font-size: 0.72rem;
  color: var(--ea-muted);
  text-transform: capitalize;
}
.sidebar-user .icon-btn {
  background: var(--ea-surface);
  border-color: var(--ea-border);
  color: var(--ea-muted);
}
.sidebar-user .icon-btn:hover {
  background: var(--ea-danger-soft);
  border-color: color-mix(in srgb, var(--ea-danger) 40%, transparent);
  color: var(--ea-danger);
}

/* Dark mode keeps a dark sidebar surface but reuses the same token-driven styles */
[data-theme="dark"] .sidebar {
  background: var(--ea-surface) !important;
  border-color: var(--ea-border);
}

/* ---- Collapsible sidebar (desktop): icon-only, hover to expand ----------- */
@media (min-width: 992px) {
  #app-shell.sidebar-collapsed .sidebar {
    width: var(--ea-sidebar-collapsed-w);
  }
  #app-shell.sidebar-collapsed .sidebar:hover {
    width: var(--ea-sidebar-w);
    box-shadow: var(--ea-shadow-lg);
  }

  /* hide labels/sections/search/name when collapsed & not hovered */
  #app-shell.sidebar-collapsed .sidebar:not(:hover) .brand-text,
  #app-shell.sidebar-collapsed .sidebar:not(:hover) .nav-txt,
  #app-shell.sidebar-collapsed .sidebar:not(:hover) .nav-link .nav-badge,
  #app-shell.sidebar-collapsed .sidebar:not(:hover) .nav-section,
  #app-shell.sidebar-collapsed .sidebar:not(:hover) .sidebar-user .min-w-0,
  #app-shell.sidebar-collapsed .sidebar:not(:hover) .sidebar-user .icon-btn,
  #app-shell.sidebar-collapsed
    .sidebar:not(:hover)
    .sidebar-search
    .input-group {
    opacity: 0;
    pointer-events: none;
  }

  #app-shell.sidebar-collapsed .sidebar:not(:hover) .nav-section {
    height: 8px;
    margin: 0.5rem 0 0;
  }
  #app-shell.sidebar-collapsed .sidebar:not(:hover) .nav-link {
    justify-content: center;
    gap: 0;
  }
  #app-shell.sidebar-collapsed .sidebar:not(:hover) .sidebar-user {
    justify-content: center;
  }
  #app-shell.sidebar-collapsed .sidebar:not(:hover) .sidebar-brand {
    justify-content: center;
    padding: 0 !important;
  }
  #app-shell.sidebar-collapsed .sidebar:not(:hover) .sidebar-search {
    padding: 0.5rem 0.65rem 0.1rem;
  }

  .sidebar .brand-text,
  .sidebar .nav-txt,
  .sidebar .nav-section,
  .sidebar-user .min-w-0 {
    transition: opacity var(--ea-transition);
  }
}

/* =========================================================================
   Top navbar
   ========================================================================= */
.navbar {
  background: color-mix(in srgb, var(--ea-surface) 82%, transparent) !important;
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border: 1px solid var(--ea-border) !important;
  height: var(--ea-topbar-h);
  min-height: var(--ea-topbar-h);
  padding-left: 1.25rem !important;
  padding-right: 1.25rem !important;
  margin: 8px;
  border-radius: 10px;
  z-index: 1030;
}

.form-text {
  font-size: 10px !important;
}
.navbar .page-title {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--ea-text);
}
.navbar .breadcrumb {
  margin: 0;
  font-size: 0.78rem;
}
.navbar .breadcrumb-item,
.navbar .breadcrumb-item a {
  color: var(--ea-muted);
  text-decoration: none;
}
.navbar .breadcrumb-item.active {
  color: var(--ea-text);
}
.navbar .breadcrumb-item + .breadcrumb-item::before {
  color: var(--ea-border);
}

.topbar-search {
  position: relative;
  width: 260px;
  max-width: 34vw;
}
.topbar-search input {
  width: 100%;
  border: 1px solid var(--ea-border);
  background: var(--ea-bg);
  border-radius: 999px;
  padding: 0.45rem 0.9rem 0.45rem 2.2rem;
  font-size: 0.85rem;
  color: var(--ea-text);
  transition:
    border var(--ea-transition),
    box-shadow var(--ea-transition);
}
.topbar-search input:focus {
  outline: none;
  border-color: var(--ea-primary);
  box-shadow: 0 0 0 3px rgba(189, 132, 86, 0.12);
}
.topbar-search i {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ea-muted);
  font-size: 0.95rem;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--ea-border);
  background: var(--ea-surface);
  color: var(--ea-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  transition: all var(--ea-transition);
  position: relative;
  cursor: pointer;
}
.icon-btn:hover {
  color: var(--ea-primary);
  border-color: var(--ea-primary);
  background: var(--ea-primary-soft);
}
.icon-btn .dot {
  position: absolute;
  top: 8px;
  right: 9px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ea-danger);
  border: 2px solid var(--ea-surface);
}

.profile-trigger {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.3rem 0.55rem 0.3rem 0.3rem;
  border-radius: 999px;
  border: 1px solid var(--ea-border);
  background: var(--ea-surface);
  cursor: pointer;
  transition: all var(--ea-transition);
}
.profile-trigger:hover {
  border-color: var(--ea-primary);
  background: var(--ea-primary-soft);
}
.profile-trigger .avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ea-primary), var(--ea-accent));
  color: #fff;
  font-weight: 600;
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.profile-trigger .p-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ea-text);
}

/* =========================================================================
   Cards
   ========================================================================= */
.card {
  background: var(--ea-surface);
  border: 1px solid var(--ea-border);
  border-radius: var(--ea-radius-lg);
  box-shadow: var(--ea-shadow-xs);
  transition:
    box-shadow var(--ea-transition),
    transform var(--ea-transition),
    border-color var(--ea-transition),
    background-color var(--ea-transition);
}
.card-header {
  background: transparent !important;
  border-bottom: 1px solid var(--ea-border) !important;
  padding: 1rem 1.25rem;
  font-weight: 600;
}
.card-body {
  padding: 1.25rem;
}
.card-footer {
  background: transparent !important;
  border-top: 1px solid var(--ea-border) !important;
}

.stat-card {
  cursor: default;
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--ea-shadow);
}
.stat-card .stat-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ea-muted);
}
.stat-card .stat-value {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--ea-text);
  line-height: 1.1;
  letter-spacing: -0.03em;
}
.stat-card .stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.stat-trend {
  font-size: 0.78rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}
.stat-trend.up {
  color: var(--ea-success);
}
.stat-trend.down {
  color: var(--ea-danger);
}
.stat-cap {
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--ea-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.stat-cap.warn {
  color: var(--ea-warning);
}

.si-primary {
  background: var(--ea-primary-soft);
  color: var(--ea-primary);
}
.si-success {
  background: var(--ea-success-soft);
  color: var(--ea-success);
}
.si-danger {
  background: var(--ea-danger-soft);
  color: var(--ea-danger);
}
.si-warning {
  background: var(--ea-warning-soft);
  color: var(--ea-warning);
}
.si-info {
  background: var(--ea-info-soft);
  color: var(--ea-info);
}

/* =========================================================================
   Buttons
   ========================================================================= */
.btn {
  --bs-btn-font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--ea-radius-sm);
  padding: 0.5rem 0.95rem;
  letter-spacing: -0.01em;
  transition: all var(--ea-transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  position: relative;
  overflow: hidden;
}
.btn-sm {
  --bs-btn-font-size: 0.8rem;
  padding: 0.38rem 0.7rem;
  border-radius: 7px;
}
.btn-lg {
  padding: 0.7rem 1.3rem;
  border-radius: var(--ea-radius);
}
.btn:active {
  transform: translateY(1px);
}
.btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(189, 132, 86, 0.25) !important;
}

.btn-primary {
  --bs-btn-bg: var(--ea-primary);
  --bs-btn-border-color: var(--ea-primary);
  --bs-btn-hover-bg: var(--ea-primary-hover);
  --bs-btn-hover-border-color: var(--ea-primary-hover);
  --bs-btn-active-bg: var(--ea-primary-hover);
  --bs-btn-active-border-color: var(--ea-primary-hover);
  --bs-btn-disabled-bg: var(--ea-primary);
  --bs-btn-disabled-border-color: var(--ea-primary);
  box-shadow: 0 1px 2px rgba(189, 132, 86, 0.25);
}
.btn-primary:hover {
  box-shadow: 0 4px 12px rgba(189, 132, 86, 0.35);
}
.btn-dark {
  --bs-btn-bg: #111827;
  --bs-btn-border-color: #111827;
  --bs-btn-hover-bg: #1f2937;
  --bs-btn-hover-border-color: #1f2937;
  --bs-btn-active-bg: #1f2937;
}
.btn-success {
  --bs-btn-bg: var(--ea-success);
  --bs-btn-border-color: var(--ea-success);
  --bs-btn-hover-bg: #16a34a;
  --bs-btn-hover-border-color: #16a34a;
}
.btn-danger {
  --bs-btn-bg: var(--ea-danger);
  --bs-btn-border-color: var(--ea-danger);
  --bs-btn-hover-bg: #dc2626;
  --bs-btn-hover-border-color: #dc2626;
}
.btn-warning {
  --bs-btn-bg: var(--ea-warning);
  --bs-btn-border-color: var(--ea-warning);
  --bs-btn-color: #fff;
  --bs-btn-hover-color: #fff;
}
.btn-info {
  --bs-btn-bg: var(--ea-info);
  --bs-btn-border-color: var(--ea-info);
  --bs-btn-color: #fff;
  --bs-btn-hover-color: #fff;
}
.btn-outline-primary {
  --bs-btn-color: var(--ea-primary);
  --bs-btn-border-color: var(--ea-border);
  --bs-btn-hover-bg: var(--ea-primary);
  --bs-btn-hover-border-color: var(--ea-primary);
}
.btn-outline-secondary {
  --bs-btn-color: var(--ea-muted);
  --bs-btn-border-color: var(--ea-border);
  --bs-btn-hover-bg: var(--ea-bg);
  --bs-btn-hover-border-color: var(--ea-border);
  --bs-btn-hover-color: var(--ea-text);
}
.btn-light {
  --bs-btn-bg: var(--ea-surface);
  --bs-btn-border-color: var(--ea-border);
  --bs-btn-color: var(--ea-text);
  --bs-btn-hover-bg: var(--ea-bg);
}

.btn .ripple {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  background: rgba(255, 255, 255, 0.45);
  pointer-events: none;
  animation: ea-ripple 0.6s linear;
}
@keyframes ea-ripple {
  to {
    transform: scale(3.2);
    opacity: 0;
  }
}

.btn.is-loading {
  color: transparent !important;
  pointer-events: none;
}
.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 15px;
  height: 15px;
  top: 50%;
  left: 50%;
  margin: -7.5px 0 0 -7.5px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-top-color: #fff;
  border-radius: 50%;
  animation: ea-spin 0.6s linear infinite;
}
.btn-outline-primary.is-loading::after,
.btn-outline-secondary.is-loading::after,
.btn-light.is-loading::after {
  border-color: rgba(189, 132, 86, 0.3);
  border-top-color: var(--ea-primary);
}
@keyframes ea-spin {
  to {
    transform: rotate(360deg);
  }
}

/* =========================================================================
   Forms
   ========================================================================= */
.form-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ea-text);
  margin-bottom: 0.35rem;
}
.form-control,
.form-select {
  border: 1px solid var(--ea-border);
  border-radius: var(--ea-radius-sm);
  padding: 0.55rem 0.8rem;
  font-size: 0.875rem;
  color: var(--ea-text);
  background-color: var(--ea-surface);
  transition:
    border var(--ea-transition),
    box-shadow var(--ea-transition),
    background-color var(--ea-transition);
}
.form-control-sm,
.form-select-sm {
  padding: 0.4rem 0.65rem;
  font-size: 0.8rem;
  border-radius: 7px;
}
.form-control::placeholder {
  color: var(--ea-muted);
  opacity: 0.8;
}
.form-control:focus,
.form-select:focus {
  border-color: var(--ea-primary);
  box-shadow: 0 0 0 3px rgba(189, 132, 86, 0.12);
  background-color: var(--ea-surface);
  color: var(--ea-text);
}
.form-control:disabled,
.form-select:disabled {
  background-color: var(--ea-bg);
}
.input-group-text {
  background: var(--ea-bg);
  border: 1px solid var(--ea-border);
  color: var(--ea-muted);
  border-radius: var(--ea-radius-sm);
}

.form-check-input {
  border-color: var(--ea-border);
  cursor: pointer;
}
.form-check-input:checked {
  background-color: var(--ea-primary);
  border-color: var(--ea-primary);
}
.form-check-input:focus {
  border-color: var(--ea-primary);
  box-shadow: 0 0 0 3px rgba(189, 132, 86, 0.15);
}
.form-switch .form-check-input {
  height: 1.2rem;
  width: 2.2rem;
}

.is-invalid {
  border-color: var(--ea-danger) !important;
}
.invalid-feedback {
  font-size: 0.78rem;
  color: var(--ea-danger);
}
.is-valid {
  border-color: var(--ea-success) !important;
}

/* =========================================================================
   Tables
   ========================================================================= */
.table {
  --bs-table-bg: transparent;
  color: var(--ea-text);
  margin-bottom: 0;
  border-color: var(--ea-border);
}
.table > thead th {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ea-muted);
  background: var(--ea-bg);
  border-bottom: 1px solid var(--ea-border);
  padding: 0.75rem 1rem;
  white-space: nowrap;
}
.table > tbody td {
  padding: 0.8rem 1rem;
  border-color: var(--ea-border-soft);
  vertical-align: middle;
  font-size: 0.87rem;
}
.table > tbody tr {
  transition: background var(--ea-transition);
}
.table-hover > tbody > tr:hover > * {
  background: var(--ea-bg);
}
.table-responsive {
  border-radius: var(--ea-radius);
}
.table-sticky thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.badge {
  font-weight: 600;
  font-size: 0.72rem;
  padding: 0.32em 0.6em;
  border-radius: 999px;
  letter-spacing: 0.01em;
}
.badge-status-active {
  background: var(--ea-success-soft) !important;
  color: #16a34a !important;
}
.badge-status-inactive,
.badge-status-draft {
  background: var(--ea-bg) !important;
  color: var(--ea-muted) !important;
}
.badge-status-pending {
  background: var(--ea-warning-soft) !important;
  color: #b45309 !important;
}
.badge-status-danger {
  background: var(--ea-danger-soft) !important;
  color: #dc2626 !important;
}

.bg-primary {
  background: var(--ea-primary) !important;
}
.bg-success {
  background: var(--ea-success) !important;
}
.bg-danger {
  background: var(--ea-danger) !important;
}
.bg-warning {
  background: var(--ea-warning) !important;
}
.bg-info {
  background: var(--ea-info) !important;
}
.text-primary {
  color: var(--ea-primary) !important;
}
.text-danger {
  color: var(--ea-danger) !important;
}
.text-success {
  color: var(--ea-success) !important;
}
.text-muted {
  color: var(--ea-muted) !important;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--ea-muted);
}
.empty-state i {
  font-size: 2.5rem;
  opacity: 0.35;
  display: block;
  margin-bottom: 0.75rem;
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--ea-border-soft) 25%,
    var(--ea-bg) 37%,
    var(--ea-border-soft) 63%
  );
  background-size: 400% 100%;
  animation: ea-shimmer 1.4s ease infinite;
  border-radius: 6px;
}
@keyframes ea-shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

/* =========================================================================
   Pagination
   ========================================================================= */
.pagination {
  --bs-pagination-border-radius: var(--ea-radius-sm);
  gap: 0.25rem;
}
.page-link {
  border: 1px solid var(--ea-border);
  border-radius: var(--ea-radius-sm) !important;
  color: var(--ea-text);
  background: var(--ea-surface);
  font-size: 0.82rem;
  font-weight: 500;
  transition: all var(--ea-transition);
}
.page-link:hover {
  background: var(--ea-primary-soft);
  color: var(--ea-primary);
  border-color: var(--ea-border);
}
.page-item.active .page-link {
  background: var(--ea-primary);
  border-color: var(--ea-primary);
  color: #fff;
}
.page-item.disabled .page-link {
  background: var(--ea-bg);
  color: var(--ea-muted);
}

/* =========================================================================
   Modals
   ========================================================================= */
.modal-content {
  border: 1px solid var(--ea-border);
  border-radius: var(--ea-radius-lg);
  box-shadow: var(--ea-shadow-lg);
  background: var(--ea-surface);
}
.modal-header {
  border-bottom: 1px solid var(--ea-border);
  padding: 1.1rem 1.35rem;
}
.modal-title {
  font-weight: 700;
  font-size: 1.05rem;
}
.modal-body {
  padding: 1.35rem;
}
.modal-footer {
  border-top: 1px solid var(--ea-border);
  padding: 1rem 1.35rem;
}
.modal-backdrop.show {
  backdrop-filter: blur(3px);
  opacity: 0.5;
}
.modal.fade .modal-dialog {
  transform: translateY(12px) scale(0.98);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.modal.show .modal-dialog {
  transform: none;
}

/* =========================================================================
   Alerts
   ========================================================================= */
.alert {
  border: 1px solid transparent;
  border-radius: var(--ea-radius);
  font-size: 0.87rem;
  padding: 0.8rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.alert-success {
  background: var(--ea-success-soft);
  color: #15803d;
  border-color: color-mix(in srgb, var(--ea-success) 25%, transparent);
}
.alert-danger {
  background: var(--ea-danger-soft);
  color: #b91c1c;
  border-color: color-mix(in srgb, var(--ea-danger) 25%, transparent);
}
.alert-warning {
  background: var(--ea-warning-soft);
  color: #b45309;
  border-color: color-mix(in srgb, var(--ea-warning) 25%, transparent);
}
.alert-info {
  background: var(--ea-info-soft);
  color: #a66e42;
  border-color: color-mix(in srgb, var(--ea-info) 25%, transparent);
}

/* =========================================================================
   Dropdowns
   ========================================================================= */
.dropdown-menu {
  border: 1px solid var(--ea-border);
  border-radius: var(--ea-radius);
  box-shadow: var(--ea-shadow-lg);
  padding: 0.4rem;
  background: var(--ea-surface);
  font-size: 0.87rem;
  animation: ea-dropdown 0.15s ease;
}
@keyframes ea-dropdown {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.dropdown-item {
  border-radius: var(--ea-radius-sm);
  padding: 0.5rem 0.7rem;
  color: var(--ea-text);
  font-weight: 500;
}
.dropdown-item:hover {
  background: var(--ea-primary-soft);
  color: var(--ea-primary);
}
.dropdown-item.text-danger:hover {
  background: var(--ea-danger-soft);
  color: var(--ea-danger) !important;
}
.dropdown-divider {
  border-color: var(--ea-border);
  margin: 0.35rem 0;
}

/* =========================================================================
   DataTables
   ========================================================================= */
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  border: 1px solid var(--ea-border);
  border-radius: var(--ea-radius-sm);
  padding: 0.35rem 0.6rem;
  font-size: 0.82rem;
  background: var(--ea-surface);
  color: var(--ea-text);
}
.dataTables_wrapper .dataTables_filter input:focus {
  outline: none;
  border-color: var(--ea-primary);
  box-shadow: 0 0 0 3px rgba(189, 132, 86, 0.12);
}
.dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: var(--ea-radius-sm) !important;
  border: 1px solid var(--ea-border) !important;
  color: var(--ea-text) !important;
  font-size: 0.82rem;
  margin: 0 2px;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--ea-primary) !important;
  border-color: var(--ea-primary) !important;
  color: #fff !important;
}
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
  color: var(--ea-muted);
  font-size: 0.82rem;
}

/* =========================================================================
   Login / Auth pages — premium split screen
   ========================================================================= */
.auth-wrapper {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: var(--ea-bg);
}
.auth-brand {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #7a4e28 0%, #bd8456 55%, #e0b07a 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 3rem 3.25rem;
}
/* Brand colour from the logo's tan dot */
:root {
  --brand-tan: #bd8456;
  --brand-tan-soft: #f3e7dc;
}
.auth-brand--logo {
  background: linear-gradient(160deg, #fbf8f5 0%, #f5efe8 100%) !important;
  color: #1a1a1a;
}
.auth-brand--logo .blob {
  opacity: 0.4;
}
.auth-brand--logo .blob-1 {
  background: var(--brand-tan) !important;
}
.auth-brand--logo .blob-2 {
  background: #e7d3c0 !important;
}
.auth-brand-logo {
  height: 46px;
  width: auto;
  display: block;
}
.auth-brand--logo .auth-headline {
  color: #1a1a1a;
}
.auth-brand--logo .auth-tagline {
  color: #6b6157;
}
.auth-brand--logo .auth-features li {
  color: #3a3a3a;
}
.auth-brand--logo .auth-features li i {
  background: var(--brand-tan-soft);
  color: var(--brand-tan);
}
.auth-brand--logo .auth-foot {
  color: #9a8e82;
}
.auth-card-logo-img {
  height: 40px;
  width: auto;
}

/* =========================================================================
   Login — P: single diagonal (light top, dark bottom) + clean card
   ========================================================================= */
.auth-p {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
  background: #ead9c4; /* light tan (top area) */
}
/* Dark tan triangle filling the bottom-right half */
.auth-p::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #7a4e28, #bd8456);
  clip-path: polygon(0 100%, 100% 0, 100% 100%);
  z-index: 0;
}
.auth-p .ad-card {
  position: relative;
  z-index: 5;
  width: 100%;
  max-width: 400px;
  background: #ffffff;
  border: 1px solid var(--ea-border);
  border-radius: var(--ea-radius-xl);
  box-shadow: 0 30px 70px rgba(122, 78, 40, 0.28);
  padding: 2.6rem 2.4rem;
  text-align: center;
  opacity: 1;
  animation: ea-rise 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
/* Fail-safe: if the .auth-p wrapper is missing for any reason, the card must
   still render as a centered white card on the diagonal background. */
body > .ad-card,
.ad-card {
  position: relative;
  z-index: 5;
  width: 100%;
  max-width: 400px;
  margin: 3rem auto;
  background: #ffffff;
  border: 1px solid var(--ea-border);
  border-radius: var(--ea-radius-xl);
  box-shadow: 0 30px 70px rgba(122, 78, 40, 0.28);
  padding: 2.6rem 2.4rem;
  text-align: center;
  opacity: 1;
}
/* When correctly wrapped, remove the fail-safe auto margin. */
.auth-p .ad-card {
  margin: 0;
}
.auth-p .ad-logo {
  text-align: center;
  margin-bottom: 1.4rem;
}
.auth-p .ad-logo img {
  height: 44px;
  width: auto;
}
.auth-p .ad-card h1 {
  font-size: 1.5rem;
  font-weight: 800;
  text-align: center;
  margin: 0 0 0.25rem;
  letter-spacing: -0.02em;
}
.auth-p .ad-card .sub {
  color: var(--ea-muted);
  font-size: 0.88rem;
  text-align: center;
  margin-bottom: 1.7rem;
}
.auth-p .ad-foot {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.76rem;
  color: var(--ea-muted);
}
.auth-p .float-field,
.auth-p .row-between {
  text-align: left;
}

@media (max-width: 575.98px) {
  .auth-p .ad-card {
    padding: 2rem 1.5rem;
  }
}

/* =========================================================================
   Diagonal login (angular brand shapes + centered card)
   ========================================================================= */
.auth-diagonal {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
  background: #f4efe9; /* warm off-white */
}

/* Angular corner shapes — brand tan gradients, clipped into diagonals */
.auth-diagonal .ad-shape {
  position: absolute;
  z-index: 0;
  pointer-events: none;
}

.auth-diagonal .ad-shape-tl {
  top: 0;
  left: 0;
  width: 46vw;
  height: 42vh;
  min-width: 340px;
  min-height: 260px;
  background: linear-gradient(135deg, #7a4e28 0%, #bd8456 100%);
  clip-path: polygon(0 0, 100% 0, 0 100%);
  opacity: 0.95;
}
.auth-diagonal .ad-shape-tl2 {
  top: 0;
  left: 0;
  width: 32vw;
  height: 30vh;
  min-width: 240px;
  min-height: 190px;
  background: linear-gradient(135deg, #bd8456 0%, #e0b07a 100%);
  clip-path: polygon(0 0, 100% 0, 0 100%);
  opacity: 0.55;
}
.auth-diagonal .ad-shape-br {
  bottom: 0;
  right: 0;
  width: 46vw;
  height: 42vh;
  min-width: 340px;
  min-height: 260px;
  background: linear-gradient(315deg, #7a4e28 0%, #bd8456 100%);
  clip-path: polygon(100% 100%, 100% 0, 0 100%);
  opacity: 0.95;
}
.auth-diagonal .ad-shape-br2 {
  bottom: 0;
  right: 0;
  width: 32vw;
  height: 30vh;
  min-width: 240px;
  min-height: 190px;
  background: linear-gradient(315deg, #bd8456 0%, #e0b07a 100%);
  clip-path: polygon(100% 100%, 100% 0, 0 100%);
  opacity: 0.5;
}

/* Centered login card floating above the shapes */
.auth-diagonal .ad-card {
  position: relative;
  z-index: 5;
  width: 100%;
  max-width: 400px;
  background: #ffffff;
  border: 1px solid var(--ea-border);
  border-radius: var(--ea-radius-xl);
  box-shadow: 0 24px 60px rgba(122, 78, 40, 0.22);
  padding: 2.5rem 2.3rem;
  opacity: 1; /* guaranteed visible even if animation is skipped */
  animation: ea-rise 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.auth-diagonal .ad-logo {
  text-align: center;
  margin-bottom: 1.4rem;
}
.auth-diagonal .ad-logo img {
  height: 42px;
  width: auto;
}
.auth-diagonal .ad-card h1 {
  font-size: 1.4rem;
  font-weight: 800;
  text-align: center;
  margin: 0 0 0.25rem;
}
.auth-diagonal .ad-card .sub {
  color: var(--ea-muted);
  font-size: 0.88rem;
  text-align: center;
  margin-bottom: 1.6rem;
}
.auth-diagonal .ad-foot {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.76rem;
  color: var(--ea-muted);
}

@media (max-width: 575.98px) {
  .auth-diagonal .ad-card {
    padding: 2rem 1.4rem;
  }
  .auth-diagonal .ad-shape-tl,
  .auth-diagonal .ad-shape-br {
    min-width: 200px;
    min-height: 170px;
  }
}

/* Flat product form sections (screenshot-style, no card boxes) */
.form-section {
  background: var(--ea-surface);
  border: 1px solid var(--ea-border);
  border-radius: var(--ea-radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}
.form-section > h6 {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--brand-tan, #bd8456);
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--ea-border);
}
.form-section .form-label {
  font-weight: 600;
  color: #374151;
  font-size: 0.8rem;
}
.form-section .form-control,
.form-section .form-select {
  border-radius: 8px;
}
.form-section .form-control:focus,
.form-section .form-select:focus {
  border-color: var(--brand-tan, #bd8456);
  box-shadow: 0 0 0 3px rgba(189, 132, 86, 0.14);
}
.auth-brand .blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(46px);
  opacity: 0.55;
  pointer-events: none;
}
.auth-brand .blob-1 {
  width: 340px;
  height: 340px;
  background: #60a5fa;
  top: -80px;
  right: -60px;
  animation: ea-float 9s ease-in-out infinite;
}
.auth-brand .blob-2 {
  width: 300px;
  height: 300px;
  background: #38bdf8;
  bottom: -70px;
  left: -50px;
  animation: ea-float 11s ease-in-out infinite reverse;
}
.auth-brand .blob-3 {
  width: 220px;
  height: 220px;
  background: #22d3ee;
  top: 40%;
  left: 45%;
  opacity: 0.35;
  animation: ea-float 13s ease-in-out infinite;
}
@keyframes ea-float {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(18px, -24px) scale(1.08);
  }
}
.auth-brand__inner {
  position: relative;
  z-index: 2;
}
.auth-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 700;
  font-size: 1.15rem;
}
.auth-logo .mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  backdrop-filter: blur(4px);
}
.auth-headline {
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.03em;
  margin: 0 0 1rem;
}
.auth-tagline {
  font-size: 1.02rem;
  color: rgba(255, 255, 255, 0.82);
  max-width: 30ch;
}
.auth-features {
  list-style: none;
  padding: 0;
  margin: 2rem 0 0;
  display: grid;
  gap: 0.85rem;
}
.auth-features li {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.9);
}
.auth-features li i {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.16);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.auth-foot {
  position: relative;
  z-index: 2;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.65);
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  background: var(--ea-bg);
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--ea-surface);
  border: 1px solid var(--ea-border);
  border-radius: var(--ea-radius-xl);
  box-shadow: var(--ea-shadow-lg);
  padding: 2.4rem 2.2rem;
  animation: ea-rise 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}
@keyframes ea-rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.auth-card__logo {
  display: none;
}
.auth-card h1,
.ad-card h1 {
  font-size: 1.5rem;
  font-weight: 800;
  margin: 0 0 0.3rem;
}
.auth-card .sub,
.ad-card .sub {
  color: var(--ea-muted);
  font-size: 0.9rem;
  margin-bottom: 1.6rem;
}

.float-field {
  position: relative;
  margin-bottom: 1.1rem;
}
.float-field input {
  width: 100%;
  border: 1px solid var(--ea-border);
  border-radius: var(--ea-radius);
  padding: 1.15rem 0.9rem 0.5rem 2.6rem;
  font-size: 0.9rem;
  background: var(--ea-surface);
  color: var(--ea-text);
  transition:
    border var(--ea-transition),
    box-shadow var(--ea-transition);
}
.float-field input:focus {
  outline: none;
  border-color: var(--ea-primary);
  box-shadow: 0 0 0 3px rgba(189, 132, 86, 0.12);
}
.float-field > i.field-icon {
  position: absolute;
  left: 0.95rem;
  top: 1.05rem;
  color: var(--ea-muted);
  font-size: 1.05rem;
  transition: color var(--ea-transition);
}
.float-field input:focus ~ i.field-icon {
  color: var(--ea-primary);
}
.float-field label {
  position: absolute;
  left: 2.65rem;
  top: 0.9rem;
  color: var(--ea-muted);
  font-size: 0.9rem;
  pointer-events: none;
  transition: all 0.15s ease;
}
.float-field input:focus + label,
.float-field input:not(:placeholder-shown) + label {
  top: 0.35rem;
  left: 2.65rem;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--ea-primary);
  letter-spacing: 0.02em;
}
.float-field .toggle-pass {
  position: absolute;
  right: 0.8rem;
  top: 0.95rem;
  color: var(--ea-muted);
  cursor: pointer;
  font-size: 1.05rem;
  background: none;
  border: none;
  padding: 0;
}
.float-field .toggle-pass:hover {
  color: var(--ea-text);
}

.auth-card .row-between,
.ad-card .row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.3rem;
}
.auth-card .row-between a,
.ad-card .row-between a {
  font-size: 0.82rem;
  color: var(--ea-primary);
  text-decoration: none;
  font-weight: 600;
}
.auth-card .form-check-label,
.ad-card .form-check-label {
  font-size: 0.82rem;
  color: var(--ea-muted);
}
.auth-card .btn-auth,
.ad-card .btn-auth {
  width: 100%;
  border: none;
  border-radius: var(--ea-radius);
  background: var(--ea-primary);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.8rem;
  cursor: pointer;
  transition: all var(--ea-transition);
  box-shadow: 0 4px 14px rgba(189, 132, 86, 0.35);
}
.auth-card .btn-auth:hover,
.ad-card .btn-auth:hover {
  background: var(--ea-primary-hover);
  box-shadow: 0 6px 20px rgba(189, 132, 86, 0.45);
  transform: translateY(-1px);
}
.auth-card .auth-alt,
.ad-card .auth-alt {
  text-align: center;
  margin-top: 1.4rem;
  font-size: 0.85rem;
  color: var(--ea-muted);
}
.auth-card .auth-alt a,
.ad-card .auth-alt a {
  color: var(--ea-primary);
  font-weight: 600;
  text-decoration: none;
}

@media (max-width: 900px) {
  .auth-wrapper {
    grid-template-columns: 1fr;
  }
  .auth-brand {
    display: none;
  }
  .auth-card__logo {
    display: flex;
    justify-content: center;
    margin-bottom: 1.25rem;
  }
  .auth-card__logo .mark {
    width: 52px;
    height: 52px;
    border-radius: 15px;
    background: linear-gradient(135deg, var(--ea-primary), var(--ea-accent));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 8px 20px rgba(189, 132, 86, 0.35);
  }
}

/* =========================================================================
   Utilities
   ========================================================================= */
main {
  animation: ea-fade-up 0.3s ease;
}
@keyframes ea-fade-up {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1.1rem 0.75rem;
  border: 1px solid var(--ea-border);
  border-radius: var(--ea-radius);
  background: var(--ea-surface);
  color: var(--ea-text);
  text-decoration: none;
  text-align: center;
  transition: all var(--ea-transition);
}
.quick-action:hover {
  border-color: var(--ea-primary);
  background: var(--ea-primary-soft);
  color: var(--ea-primary);
  transform: translateY(-2px);
}
.quick-action i {
  font-size: 1.35rem;
}
.quick-action span {
  font-size: 0.8rem;
  font-weight: 600;
}

.timeline {
  position: relative;
  padding-left: 1.4rem;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--ea-border);
}
.timeline-item {
  position: relative;
  padding-bottom: 1.1rem;
}
.timeline-item::before {
  content: "";
  position: absolute;
  left: -1.4rem;
  top: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--ea-surface);
  border: 2px solid var(--ea-primary);
}
.timeline-item .t-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ea-text);
}
.timeline-item .t-time {
  font-size: 0.74rem;
  color: var(--ea-muted);
}

.text-dark {
  color: var(--ea-text) !important;
}
.bg-white {
  background: var(--ea-surface) !important;
}
.border,
.border-bottom,
.border-top {
  border-color: var(--ea-border) !important;
}

#toast-container > div {
  border-radius: var(--ea-radius);
  box-shadow: var(--ea-shadow-lg);
  opacity: 1;
  font-size: 0.87rem;
  padding: 1rem 1rem 1rem 3rem;
}
.toast-success {
  background-color: #16a34a !important;
}
.toast-error {
  background-color: var(--ea-danger) !important;
}
.toast-warning {
  background-color: var(--ea-warning) !important;
}
.toast-info {
  background-color: var(--ea-info) !important;
}

/* =========================================================================
   Responsive sidebar drawer
   ========================================================================= */
.sidebar-overlay {
  display: none;
}
@media (max-width: 991.98px) {
  .sidebar {
    position: fixed;
    left: calc(-1 * var(--ea-sidebar-w) - 16px);
    top: 0;
    margin: 0;
    height: 100vh;
    border-radius: 0;
    border: none;
    border-right: 1px solid var(--ea-border);
    z-index: 1050;
    box-shadow: var(--ea-shadow-lg);
    transition: left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .sidebar.show {
    left: 0;
  }
  .sidebar-overlay.show {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 1040;
    backdrop-filter: blur(2px);
    animation: ea-fade 0.2s ease;
  }
  @keyframes ea-fade {
    from {
      opacity: 0;
    }
    to {
      opacity: 1;
    }
  }
  .topbar-search {
    display: none !important;
  }
}
@media (max-width: 575.98px) {
  .navbar {
    padding-left: 0.85rem !important;
    padding-right: 0.85rem !important;
  }
  main.p-4 {
    padding: 1rem !important;
  }
  .stat-card .stat-value {
    font-size: 1.4rem;
  }
}

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

/* =========================================================================
   Global page + AJAX loader
   ========================================================================= */
/* Slim top progress bar (navigation feedback) */
#ea-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: linear-gradient(90deg, var(--ea-primary), var(--ea-accent));
  box-shadow: 0 0 10px rgba(189, 132, 86, 0.5);
  z-index: 2000;
  opacity: 0;
  transition:
    width 0.2s ease,
    opacity 0.3s ease;
  border-radius: 0 3px 3px 0;
}
#ea-progress.active {
  opacity: 1;
}

/* Full-screen page loader shown until first paint of content */
#ea-page-loader {
  position: fixed;
  inset: 0;
  z-index: 1990;
  background: var(--ea-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1rem;
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
}
#ea-page-loader.hidden {
  opacity: 0;
  visibility: hidden;
}
#ea-page-loader .ea-spinner {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid var(--ea-border);
  border-top-color: var(--ea-primary);
  animation: ea-spin 0.7s linear infinite;
}
#ea-page-loader .ea-loader-brand {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--ea-primary), var(--ea-accent));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  box-shadow: 0 6px 16px rgba(189, 132, 86, 0.4);
  margin-bottom: 0.25rem;
}
#ea-page-loader .ea-loader-text {
  font-size: 0.82rem;
  color: var(--ea-muted);
  font-weight: 500;
}

/* AJAX overlay (for in-page async actions) */
#ea-ajax-overlay {
  position: fixed;
  inset: 0;
  z-index: 1985;
  background: rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(1px);
  display: none;
  align-items: center;
  justify-content: center;
}
#ea-ajax-overlay.show {
  display: flex;
}
#ea-ajax-overlay .ea-spinner {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.5);
  border-top-color: var(--ea-primary);
  background: var(--ea-surface);
  box-shadow: var(--ea-shadow-lg);
  animation: ea-spin 0.7s linear infinite;
}

/* ---- Choices.js (searchable store dropdown) — brand tan tweaks ---- */
.choices {
  margin-bottom: 0;
}
.choices__inner {
  border-radius: var(--ea-radius);
  border-color: var(--ea-border);
  background: #fff;
  min-height: 42px;
  padding: 0.25rem 0.5rem;
}
.choices.is-focused .choices__inner {
  border-color: var(--ea-primary);
  box-shadow: 0 0 0 3px rgba(189, 132, 86, 0.12);
}
.choices__list--multiple .choices__item {
  background: var(--ea-primary);
  border-color: var(--ea-primary-hover);
  border-radius: 8px;
  font-size: 0.8rem;
}
.choices__list--dropdown .choices__item--selectable.is-highlighted {
  background: var(--ea-primary-soft);
}
.choices__input {
  background: transparent;
}
/* Ensure the dropdown isn't clipped inside the modal */
#userModal .modal-body {
  overflow: visible;
}
.choices__list--dropdown {
  z-index: 1060;
}

/* =========================================================================
   Modal responsiveness fix — refund modal (and any tall modal) on small/short
   screens. Problem: the body content (e.g. the refund bank fields) grew taller
   than the viewport, pushing the footer buttons off-screen with no scroll.
   Fix: cap the dialog height to the viewport and let the body scroll while the
   header + footer stay pinned. Works with Bootstrap's modal-dialog-scrollable
   and also rescues plain modals that overflow.
   ========================================================================= */
.modal-dialog-scrollable {
  height: calc(100% - 1rem);           /* respect the modal's top/bottom margin */
}
.modal-dialog-scrollable .modal-content {
  max-height: 100%;
  overflow: hidden;                    /* content clips; body scrolls inside */
}
.modal-dialog-scrollable .modal-body {
  overflow-y: auto;                    /* the scrolling region */
  -webkit-overflow-scrolling: touch;   /* momentum scroll on iOS/Android */
}

/* Safety net for NON-scrollable modals that still overrun the screen: never let
   a modal-content exceed the viewport, and keep the footer reachable. */
.modal-dialog:not(.modal-dialog-scrollable) .modal-content {
  max-height: calc(100vh - 1rem);
}
.modal-dialog:not(.modal-dialog-scrollable) .modal-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Keep the footer buttons visible and tappable even when they wrap on narrow
   screens (Cancel + Create Refund shouldn't clip or disappear). */
.modal-footer {
  position: sticky;
  bottom: 0;
  background: var(--ea-surface);
  z-index: 2;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.modal-footer > .btn {
  flex: 0 1 auto;
}

/* On small phones give the dialog full width with tight margins so nothing is
   cut off horizontally, and allow it to use the full available height. */
@media (max-width: 575.98px) {
  .modal-dialog {
    margin: 0.5rem;
  }
  .modal-dialog.modal-lg,
  .modal-dialog.modal-xl {
    max-width: none;
  }
  .modal-dialog-scrollable {
    height: calc(100% - 1rem);
  }
  /* Stack the refund component rows so bank fields never overflow sideways. */
  #refundComponents .row > [class^="col-"],
  #refundComponents .row > [class*=" col-"] {
    flex: 0 0 100%;
    max-width: 100%;
  }
}

/* ============================================================================
 * Unified list-page toolbar (filters + search + Export CSV on one line).
 * Applied software-wide via the standard card-header used by list pages so the
 * filter form and the export bar sit together and only scroll horizontally when
 * space is tight (instead of wrapping into a messy second/third row).
 * ==========================================================================*/
.card > .card-header.list-toolbar {
  flex-wrap: nowrap;
  gap: .5rem;
  overflow-x: auto;
}
.card > .card-header.list-toolbar > form {
  flex-wrap: nowrap;
}
.card > .card-header.list-toolbar .export-bar {
  flex: 0 0 auto;
}
/* Small screens: allow a graceful wrap so controls never overflow the viewport. */
@media (max-width: 767px) {
  .card > .card-header.list-toolbar {
    flex-wrap: wrap;
    overflow-x: visible;
  }
  .card > .card-header.list-toolbar > form { flex-wrap: wrap; }
}
