:root {
  --app-bg: #f5f7fb;
  --panel-bg: #ffffff;
  --panel-soft: #eef4ff;
  --text: #111827;
  --muted: #6b7280;
  --border: #dfe5ef;
  --sidebar-bg: #111827;
  --sidebar-text: #dbe4f0;
  --sidebar-muted: #8fa1b8;
  --primary: #2563eb;
  --accent: #14b8a6;
  --danger: #dc3545;
  --shadow: 0 20px 60px rgba(15, 23, 42, .10);
  --topbar-bg: #1a1d23;
  --topbar-border: #2d3139;
  --topbar-text: #f3f4f6;
  --topbar-muted: #9ca3af;
  --topbar-chip-bg: rgba(255, 255, 255, .08);
  --topbar-chip-border: rgba(255, 255, 255, .12);
  --topbar-icon-bg: rgba(255, 255, 255, .08);
  --topbar-icon-hover: rgba(255, 255, 255, .14);
  --sidebar-active-bg: #202c43;
}

[data-theme="dark"] {
  --app-bg: #0f172a;
  --panel-bg: #182235;
  --panel-soft: #202c43;
  --text: #e5eefc;
  --muted: #9aa8bd;
  --border: #2e3b52;
  --sidebar-bg: #0b1120;
  --sidebar-text: #e6edf7;
  --sidebar-muted: #8a9ab2;
  --shadow: 0 22px 70px rgba(0, 0, 0, .35);
}

html,
body {
  min-height: 100%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--app-bg);
  color: var(--text);
}

body {
  margin: 0;
}

a {
  color: var(--primary);
  text-decoration: none;
}

.btn {
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  font-weight: 700;
}

.btn-primary {
  --bs-btn-bg: var(--primary);
  --bs-btn-border-color: var(--primary);
}

.form-control,
.form-select {
  border-radius: 8px;
  background-color: var(--panel-bg);
  border-color: var(--border);
  color: var(--text);
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 .2rem rgba(37, 99, 235, .18);
}

.form-label,
.form-check-label {
  color: var(--text);
  font-weight: 650;
}

.text-muted {
  color: var(--muted) !important;
}

.admin-shell {
  min-height: 100vh;
  display: flex;
  transition: .25s ease;
}

.admin-shell.sidebar-collapsed .admin-sidebar {
  width: 76px;
  padding: .75rem .5rem;
  align-items: center;
}

.admin-shell.sidebar-collapsed .admin-main {
  margin-left: 76px;
}

.admin-shell.sidebar-collapsed .brand-block {
  padding: .5rem;
  justify-content: center;
  gap: 0;
}

.admin-shell.sidebar-collapsed .brand-block > div:last-child {
  display: none;
}

.admin-shell.sidebar-collapsed .sidebar-link {
  justify-content: center;
  padding: .75rem;
  gap: 0;
}

.admin-shell.sidebar-collapsed .sidebar-link span {
  display: none;
}

.admin-shell.sidebar-collapsed .sidebar-link i {
  font-size: 1.4rem;
}

.admin-shell.sidebar-collapsed .sidebar-nav {
  padding: .5rem 0;
}

.admin-shell.sidebar-collapsed .sidebar-footer {
  display: none;
}

.admin-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 292px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  z-index: 1050;
  transition: width .25s ease, padding .25s ease;
}

.admin-main {
  min-width: 0;
  width: 100%;
  margin-left: 292px;
  transition: margin-left .25s ease;
}

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--topbar-bg);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--topbar-border);
  color: var(--topbar-text);
}

.admin-topbar .topbar-title strong {
  color: var(--topbar-text);
}

.admin-topbar .topbar-title span {
  color: var(--topbar-muted);
}

.admin-topbar .icon-btn {
  background: var(--topbar-icon-bg);
  border-color: var(--topbar-chip-border);
  color: var(--topbar-text);
}

.admin-topbar .icon-btn:hover {
  background: var(--topbar-icon-hover);
}

.admin-topbar .user-chip {
  background: var(--topbar-chip-bg);
  border-color: var(--topbar-chip-border);
}

.admin-topbar .user-chip strong {
  color: var(--topbar-text);
}

.admin-topbar .user-chip small {
  color: var(--topbar-muted);
}

.admin-topbar .avatar {
  background: rgba(37, 99, 235, .85);
  color: #fff;
}

.admin-content {
  padding: 1.25rem;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: .8rem;
  min-height: 68px;
  padding: .75rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, .07);
}

.brand-logo,
.auth-logo,
.brand-preview-logo {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-weight: 900;
}

/* Uploaded logo image instead of logo text */
.brand-logo.has-image,
.auth-logo.has-image,
.brand-preview-logo.has-image,
.auth-visual .auth-logo.has-image {
  background: #fff;
  padding: 4px;
  overflow: hidden;
}

.brand-logo.has-image img,
.auth-logo.has-image img,
.brand-preview-logo.has-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.brand-logo-uploader {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .85rem;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--panel-soft);
}

.brand-logo-upload-preview {
  width: 72px;
  height: 72px;
  flex: 0 0 72px;
  font-size: 1.4rem;
}

/* Blazor's FocusOnNavigate focuses the page heading; hide the resulting focus box. */
h1:focus,
h2:focus,
h3:focus,
h4:focus,
h5:focus,
h6:focus,
[tabindex="-1"]:focus {
  outline: none !important;
  box-shadow: none !important;
}

.brand-block strong,
.brand-block span,
.sidebar-footer strong,
.sidebar-footer span {
  display: block;
}

.brand-block span,
.sidebar-footer span {
  color: var(--sidebar-muted);
  font-size: .82rem;
}

.sidebar-nav {
  display: grid;
  gap: .25rem;
  padding: 1rem 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .12) transparent;
  margin-right: -.7rem;
  padding-right: .45rem;
}

.sidebar-nav::-webkit-scrollbar {
  width: 2px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .18);
  border-radius: 4px;
}

.sidebar-link {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .75rem .85rem;
  color: var(--sidebar-text);
  border-radius: 8px;
  font-weight: 750;
}

.sidebar-link i {
  font-size: 1.2rem;
}

.sidebar-link:hover,
.sidebar-link.active {
  color: #fff;
  background: var(--sidebar-active-bg);
}

.menu-section-label {
  padding: .5rem .85rem .25rem;
  font-size: .65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--sidebar-muted);
  opacity: .6;
}

.menu-divider {
  height: 1px;
  background: rgba(255,255,255,.08);
  margin: .25rem .5rem;
}

/* Toggle button fold/unfold icons */
.sidebar-unfold-icon {
  display: none;
}

.sidebar-collapsed .sidebar-fold-icon {
  display: none;
}

.sidebar-collapsed .sidebar-unfold-icon {
  display: block;
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  gap: .75rem;
  padding: .9rem;
  border: 1px solid rgba(255, 255, 255, .10);
  border-radius: 8px;
}

.sidebar-footer i {
  color: var(--accent);
  font-size: 1.4rem;
}

.topbar-title {
  min-width: 0;
}

.topbar-title span,
.eyebrow {
  display: block;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topbar-title strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-bg);
  color: var(--text);
  display: inline-grid;
  place-items: center;
  font-size: 1.25rem;
}

.theme-moon,
[data-theme="dark"] .theme-sun {
  display: none;
}

[data-theme="dark"] .theme-moon {
  display: block;
}

.user-chip,
.user-cell {
  display: flex;
  align-items: center;
  gap: .7rem;
}

.user-chip {
  padding: .35rem .65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-bg);
}

.user-chip strong,
.user-chip small,
.user-cell strong,
.user-cell small {
  display: block;
}

.user-chip small,
.user-cell small {
  color: var(--muted);
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--panel-soft);
  color: var(--primary);
  font-weight: 900;
}

.customer-avatar,
.customer-product-thumb {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  background: var(--panel-soft);
  color: var(--muted);
}

.customer-avatar {
  border-radius: 50%;
}

.customer-product-thumb {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  font-size: 18px;
}

.customer-avatar img,
.customer-product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.customer-detail-profile {
  display: flex;
  align-items: center;
  gap: 16px;
}

.page-heading,
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.page-heading h1,
.panel-header h2 {
  margin: 0;
  color: var(--text);
}

.page-heading h1 {
  font-size: clamp(1.25rem, 1.8vw, 1.5rem);
  font-weight: 800;
  margin: 0;
  color: var(--text);
}

.page-heading .eyebrow {
  font-size: .72rem;
}

.panel-header h2 {
  font-size: 1.1rem;
  font-weight: 850;
}

.traffic-heading {
  align-items: center;
}

.traffic-title {
  min-width: 210px;
}

.traffic-title h1 {
  font-size: clamp(1.05rem, 1.25vw, 1.28rem);
  line-height: 1.15;
  white-space: nowrap;
}

.traffic-title .eyebrow {
  display: block;
  margin-top: .25rem;
}

.traffic-actions {
  justify-content: flex-end;
}

.traffic-actions .form-control {
  min-width: 132px;
}

.traffic-actions .btn {
  white-space: nowrap;
}

.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 4px;
  border-radius: 50%;
  background: #16a34a;
  vertical-align: middle;
  animation: live-dot-pulse 1.6s ease-out infinite;
}

@keyframes live-dot-pulse {
  0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, .55); }
  70% { box-shadow: 0 0 0 7px rgba(22, 163, 74, 0); }
  100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .live-dot { animation: none; }
}

.realtime-count {
  height: 100%;
  min-height: 130px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .25rem;
  text-align: center;
  border-radius: 14px;
  background: var(--panel-soft);
}

.realtime-count strong {
  font-size: 3rem;
  font-weight: 900;
  line-height: 1;
  color: #16a34a;
  font-variant-numeric: tabular-nums;
}

.realtime-count span {
  color: var(--muted);
  font-weight: 700;
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .3px;
}

.realtime-subhead {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
  color: var(--muted);
  margin-bottom: .5rem;
}

.realtime-bar-row + .realtime-bar-row {
  margin-top: .5rem;
}

.realtime-bar {
  height: 6px;
  margin-top: .2rem;
  border-radius: 3px;
  background: var(--panel-soft);
  overflow: hidden;
}

.realtime-bar span {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--primary);
  transition: width .4s ease;
}

.panel,
.stat-card,
.brand-preview {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.stat-card {
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.stat-card:hover {
  transform: scale(1.05);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.panel {
  padding: 1.1rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.stat-card {
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: .35rem;
  border-radius: 14px;
  position: relative;
  overflow: hidden;
  min-height: 140px;
}

.stat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: .06;
  border-radius: 14px;
}

.stat-card i {
  font-size: 1.8rem;
  display: block;
}

.stat-card span {
  color: var(--muted);
  font-weight: 700;
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .3px;
}

.stat-card strong {
  font-size: 2.2rem;
  font-weight: 900;
  line-height: 1;
  font-family: 'Inter', sans-serif;
}

.stat-card:nth-child(1) { background: linear-gradient(135deg, #eef2ff, #e0e7ff); }
.stat-card:nth-child(2) { background: linear-gradient(135deg, #f0fdf4, #dcfce7); }
.stat-card:nth-child(3) { background: linear-gradient(135deg, #fffbeb, #fef3c7); }
.stat-card:nth-child(4) { background: linear-gradient(135deg, #f0f9ff, #e0f2fe); }
.stat-card:nth-child(5) { background: linear-gradient(135deg, #faf5ff, #f3e8ff); }
.stat-card:nth-child(6) { background: linear-gradient(135deg, #fdf4ff, #fce7f3); }
.stat-card:nth-child(7) { background: linear-gradient(135deg, #fefce8, #fef9c3); }
.stat-card:nth-child(8) { background: linear-gradient(135deg, #ecfeff, #cffafe); }

[data-theme="dark"] .stat-card:nth-child(1) { background: linear-gradient(135deg, #1e1b4b, #312e81); }
[data-theme="dark"] .stat-card:nth-child(2) { background: linear-gradient(135deg, #052e16, #14532d); }
[data-theme="dark"] .stat-card:nth-child(3) { background: linear-gradient(135deg, #422006, #713f12); }
[data-theme="dark"] .stat-card:nth-child(4) { background: linear-gradient(135deg, #082f49, #0c4a6e); }
[data-theme="dark"] .stat-card:nth-child(5) { background: linear-gradient(135deg, #2e1065, #4c1d95); }
[data-theme="dark"] .stat-card:nth-child(6) { background: linear-gradient(135deg, #2d0a31, #4a1942); }
[data-theme="dark"] .stat-card:nth-child(7) { background: linear-gradient(135deg, #3b2f00, #5c4a00); }
[data-theme="dark"] .stat-card:nth-child(8) { background: linear-gradient(135deg, #083344, #155e75); }

.module-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.module-tile {
  min-height: 112px;
  display: flex;
  gap: .85rem;
  padding: 1rem;
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.module-tile i {
  font-size: 1.55rem;
  color: var(--primary);
}

.module-tile strong,
.module-tile span {
  display: block;
}

.module-tile span,
.timeline-list,
.settings-list {
  color: var(--muted);
}

.timeline-list {
  display: grid;
  gap: .9rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.timeline-list li {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
}

.timeline-list i {
  color: var(--accent);
  font-size: 1.2rem;
}

.admin-table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--text);
  --bs-table-striped-bg: color-mix(in srgb, var(--text) 4%, var(--panel-bg));
  --bs-table-hover-bg: color-mix(in srgb, var(--primary) 8%, var(--panel-bg));
  color: var(--text);
  margin: 0;
}

.admin-table > :not(caption) > * > * {
  background: var(--panel-bg);
  color: var(--text);
  border-bottom-color: var(--border);
}

.admin-table thead th {
  color: var(--muted);
  border-bottom-color: var(--border);
  font-size: .78rem;
  text-transform: uppercase;
  background: var(--panel-soft);
}

.admin-table td {
  border-color: var(--border);
}

.admin-table tbody tr:hover > * {
  background: color-mix(in srgb, var(--primary) 6%, var(--panel-bg));
}

/* ── Returns table: sequential workflow actions ──
   Buttons deliberately don't use Bootstrap's .btn/.btn-sm so the generic
   responsive admin-table button rules can't resize or merge them. */
.return-col-index {
  width: 42px;
}

.return-col-reason {
  max-width: 200px;
}

.return-reason {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.return-product-name {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.return-col-status {
  min-width: 130px;
}

.return-col-actions {
  width: 1%;
  white-space: nowrap;
}

.return-steps {
  display: grid;
  grid-template-columns: repeat(3, 100px);
  justify-content: end;
  gap: 6px;
  margin-left: auto;
}

.return-step-btn {
  appearance: none;
  box-sizing: border-box;
  width: 100%;
  height: 30px;
  margin: 0;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-size: .72rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease, border-color .18s ease;
}

.return-step-btn i {
  flex: 0 0 auto;
  font-size: .9rem;
  line-height: 1;
}

.return-step-btn span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.return-step-btn:disabled {
  cursor: not-allowed;
}

.return-step-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Completed step */
.return-step-btn.done {
  color: #0f7a44;
  background: #ecfdf3;
  border-color: #9fddb8;
}

/* The one step waiting for the admin right now */
.return-step-btn.current {
  color: #b42318;
  background: #fff2f0;
  border-color: #e28b80;
  box-shadow: 0 0 0 2px rgba(180, 35, 24, .12);
}

.return-step-btn.current:hover {
  transform: translateY(-1px);
  background: #ffe7e2;
  box-shadow: 0 8px 16px rgba(180, 35, 24, .16);
}

/* Future step (unlocks after the previous one) or not needed any more */
.return-step-btn.locked,
.return-step-btn.skipped {
  color: var(--muted);
  background: var(--panel-soft);
  border-color: var(--border);
}

.return-step-btn.skipped {
  opacity: .55;
}

.return-step-btn.skipped span {
  text-decoration: line-through;
}

.return-step-btn.reject {
  color: #b42318;
  background: var(--panel-bg);
  border-color: #f0b7b0;
}

.return-step-btn.reject:hover {
  background: #fff2f0;
  border-color: #e28b80;
}

.return-step-btn.rejected {
  color: #fff;
  background: #dc2626;
  border-color: #dc2626;
}

.return-step-btn.view {
  color: #175cd3;
  background: #eff4ff;
  border-color: #bfd4ff;
}

.return-step-btn.view:hover {
  transform: translateY(-1px);
  color: #1149ad;
  background: #dbe8ff;
  border-color: #91b5ff;
}

[data-theme="dark"] .return-step-btn.done {
  color: #6ee7a8;
  background: rgba(34, 197, 94, .14);
  border-color: rgba(34, 197, 94, .4);
}

[data-theme="dark"] .return-step-btn.current,
[data-theme="dark"] .return-step-btn.reject {
  color: #fca5a5;
  background: rgba(239, 68, 68, .14);
  border-color: rgba(239, 68, 68, .45);
}

[data-theme="dark"] .return-step-btn.view {
  color: #93c5fd;
  background: rgba(59, 130, 246, .14);
  border-color: rgba(59, 130, 246, .4);
}

.return-next-step {
  color: #b42318;
  font-weight: 700;
  white-space: nowrap;
}

[data-theme="dark"] .return-next-step {
  color: #fca5a5;
}

.return-next-step.closed {
  color: var(--muted);
  font-weight: 600;
}

/* ── Returns table breakpoints ──
   >=1600px    : table, all six actions on one row with labels
   1300-1599px : table, labelled actions in a 3 x 2 grid
   992-1299px  : cards (sidebar takes space), labelled actions on one row
   768-991px   : table (no sidebar), icon-only actions in a 3 x 2 grid
   <768px      : cards, labelled actions in a 3 x 2 grid */
@media (min-width: 1600px) {
  .return-steps {
    grid-template-columns: repeat(6, 100px);
  }
}

@media (max-width: 1399.98px) {
  .return-col-reason {
    display: none;
  }
}

@media (min-width: 768px) and (max-width: 991.98px) {
  .return-steps {
    grid-template-columns: repeat(3, 32px);
    gap: 5px;
  }

  .return-step-btn {
    width: 32px;
    height: 32px;
    padding: 0;
  }

  .return-step-btn span {
    display: none;
  }

  .return-step-btn i {
    font-size: 1rem;
  }
}

/* Card layout: every action stays visible without sideways scrolling */
@media (max-width: 767.98px), (min-width: 992px) and (max-width: 1299.98px) {
  .return-table,
  .return-table tbody {
    display: block;
    width: 100%;
  }

  .return-table thead,
  .return-table .return-col-index,
  .return-table .return-col-reason {
    display: none;
  }

  .return-table tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: .55rem .75rem;
    margin-bottom: .75rem;
    padding: .8rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--panel-bg);
  }

  .return-table tbody td {
    display: block;
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent !important;
  }

  .return-table tbody td:nth-child(3) {
    text-align: right;
  }

  .return-table tbody td.return-col-product,
  .return-table tbody td.return-col-status,
  .return-table tbody td.return-col-actions,
  .return-table tbody td[colspan] {
    grid-column: 1 / -1;
  }

  .return-table tbody td.return-col-product {
    padding-top: .55rem;
    border-top: 1px dashed var(--border);
  }

  .return-table .return-product-name {
    max-width: 100%;
    white-space: normal;
  }

  .return-table .return-col-status {
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .25rem .6rem;
  }

  .return-table .return-col-status .return-next-step {
    margin-top: 0 !important;
    white-space: normal;
  }

  .return-table .return-col-actions {
    width: auto;
    white-space: normal;
  }

  .return-table .return-steps {
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 992px) and (max-width: 1299.98px) {
  .return-table .return-steps {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

/* Narrow phones: tighten the labelled buttons so full labels still fit */
@media (max-width: 479.98px) {
  .return-table .return-steps {
    gap: 5px;
  }

  .return-table .return-step-btn {
    padding: 0 4px;
    gap: 3px;
    font-size: .66rem;
  }

  .return-table .return-step-btn i {
    font-size: .8rem;
  }
}

/* Very small phones (e.g. 320px): two columns so labels are never cut */
@media (max-width: 374.98px) {
  .return-table .return-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.order-delivered-row > * {
  background: rgba(34, 197, 94, .09) !important;
}

.order-delivered-row:hover > * {
  background: rgba(34, 197, 94, .14) !important;
}

.role-list {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem .6rem;
}

.role-check {
  padding: .35rem .65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-soft);
  display: inline-flex;
  align-items: center;
  gap: .5rem;
}

.role-pill {
  padding: .25rem .85rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: .82rem;
  font-weight: 650;
  cursor: pointer;
  transition: all .15s ease;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.role-pill:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--text);
}

.role-pill.active {
  background: rgba(22, 163, 74, .15);
  border-color: rgba(22, 163, 74, .4);
  color: #16a34a;
  font-weight: 700;
}

.role-pill.active:hover:not(:disabled) {
  background: rgba(22, 163, 74, .22);
  border-color: rgba(22, 163, 74, .55);
  color: #15803d;
}

.role-pill:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.permission-group {
  padding: 1rem;
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.permission-group strong {
  display: block;
  margin-bottom: .65rem;
}

.brand-preview {
  min-height: 360px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: .8rem;
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand-primary) 18%, transparent), color-mix(in srgb, var(--brand-accent) 16%, transparent)),
  var(--panel-bg);
}

.brand-preview-logo {
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
}

.brand-preview h2 {
  margin: 0;
  font-weight: 900;
}

.brand-preview p,
.brand-preview span {
  color: var(--muted);
}

.report-bars {
  display: grid;
  gap: 1rem;
}

.report-bars > div {
  position: relative;
  min-height: 54px;
  padding: .9rem 1rem;
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.report-bars > div::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--value);
  background: color-mix(in srgb, var(--primary) 28%, transparent);
}

.report-bars span,
.report-bars strong {
  position: relative;
  z-index: 1;
}

.settings-list {
  display: grid;
  gap: .35rem;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-soft);
  cursor: pointer;
  transition: background .15s ease;
}

.setting-row:hover {
  background: color-mix(in srgb, var(--primary) 12%, var(--panel-soft));
}

.setting-row span {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  color: var(--text);
  font-weight: 750;
}

.setting-row .setting-arrow {
  color: var(--muted);
  font-size: 1.1rem;
  transition: transform .2s ease;
}

.setting-row.open .setting-arrow {
  transform: rotate(90deg);
}

.setting-row .setting-toggle {
  display: none;
}

.setting-sub {
  display: none;
  padding: .85rem 1.1rem .85rem 2.8rem;
  border: 1px solid var(--border);
  border-top: 0;
  border-radius: 0 0 8px 8px;
  background: var(--panel-bg);
  color: var(--muted);
  font-size: .9rem;
  margin-top: -1px;
}

.setting-sub.open {
  display: block;
}

.setting-sub p {
  margin: 0 0 .5rem;
}

.setting-sub .form-check {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.setting-item-wrap {
  display: grid;
  gap: 0;
}

.setting-item-wrap .setting-row {
  border-radius: 8px 8px 0 0;
}

.setting-item-wrap.open .setting-row {
  border-radius: 8px 8px 0 0;
  border-bottom-color: transparent;
}

.setting-item-wrap.open .setting-sub {
  display: block;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #0a0a0f;
}

[data-theme="dark"] .auth-shell {
  background: #050508;
}

.auth-visual {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  padding: clamp(2rem, 6vw, 5rem);
  background: radial-gradient(ellipse at 30% 50%, rgba(37, 99, 235, .18), transparent 60%),
  radial-gradient(ellipse at 70% 50%, rgba(20, 184, 166, .12), transparent 60%),
  #0a0a0f;
  position: relative;
  overflow: hidden;
}

.auth-visual::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(2px 2px at 20% 30%, rgba(255, 255, 255, .15), transparent),
  radial-gradient(2px 2px at 40% 70%, rgba(255, 255, 255, .1), transparent),
  radial-gradient(2px 2px at 60% 20%, rgba(255, 255, 255, .12), transparent),
  radial-gradient(2px 2px at 80% 50%, rgba(255, 255, 255, .08), transparent),
  radial-gradient(2px 2px at 10% 80%, rgba(255, 255, 255, .1), transparent),
  radial-gradient(2px 2px at 90% 90%, rgba(255, 255, 255, .06), transparent);
  pointer-events: none;
}

.auth-visual .auth-logo {
  width: 80px;
  height: 80px;
  flex: 0 0 80px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #2563eb, #14b8a6);
  color: #fff;
  font-size: 2rem;
  font-weight: 900;
  position: relative;
  z-index: 1;
  box-shadow: 0 0 60px rgba(37, 99, 235, .3);
}

.auth-visual h1 {
  margin: 0;
  max-width: 560px;
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 950;
  line-height: 1.05;
  text-align: center;
  overflow-wrap: anywhere;
  color: #f3f4f6;
  position: relative;
  z-index: 1;
}

.auth-visual p {
  max-width: 480px;
  color: #9ca3af;
  font-size: 1rem;
  text-align: center;
  position: relative;
  z-index: 1;
}

.auth-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  justify-content: center;
  position: relative;
  z-index: 1;
}

.auth-metrics span {
  padding: .5rem .8rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .08);
  color: #d1d5db;
  font-size: .85rem;
}

.auth-metrics span strong {
  color: #f3f4f6;
  margin-right: .35rem;
}

.auth-card {
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: #1c2848;
  box-shadow: -8px 0 40px rgba(0, 0, 0, .5);
}

.auth-form {
  width: min(100%, 420px);
}

.auth-form h2 {
  margin-bottom: .5rem;
  font-size: 1.6rem;
  font-weight: 900;
  color: #f3f4f6;
}

.auth-form .eyebrow {
  color: #6b7280;
}

.auth-card .form-label {
  color: #d1d5db;
}

.auth-card .form-control {
  background: rgba(255, 255, 255, .06);
  border-color: rgba(255, 255, 255, .1);
  color: #f3f4f6;
}

.auth-card .form-control:focus {
  background: rgba(255, 255, 255, .08);
  border-color: #2563eb;
  color: #f3f4f6;
}

.auth-card .form-control::placeholder {
  color: #6b7280;
}

.auth-card .form-check-label {
  color: #9ca3af;
}

.auth-card .btn-primary {
  --bs-btn-bg: #2563eb;
  --bs-btn-border-color: #2563eb;
}

.auth-card .alert-danger {
  background: rgba(220, 38, 38, .15);
  border-color: rgba(220, 38, 38, .25);
  color: #fca5a5;
}

.empty-state,
.page-loader {
  min-height: 340px;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  gap: .6rem;
  color: var(--muted);
}

.empty-state i {
  color: var(--primary);
  font-size: 3rem;
}

.empty-state h1 {
  margin: 0;
  color: var(--text);
}

#blazor-error-ui {
  background: #fff3cd;
  bottom: 0;
  box-shadow: 0 -1px 2px rgba(0, 0, 0, .2);
  display: none;
  left: 0;
  padding: .6rem 1.25rem;
  position: fixed;
  width: 100%;
  z-index: 2000;
}

.content-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: 1rem;
}

.content-card {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: transform .15s ease, box-shadow .15s ease;
}

.content-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(15, 23, 42, .12);
}

.content-card-header {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: 1rem 1.1rem .6rem;
  position: relative;
}

.content-card-serial {
  position: absolute;
  top: -.3rem;
  right: -.3rem;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
  border-radius: 50%;
  line-height: 1;
  z-index: 2;
}



.content-card-footer .form-switch .form-check-input {
  width: 2.8rem;
  height: 1.35rem;
  cursor: pointer;
}

.content-card-body small {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .78rem;
}

.content-card-icon {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-size: 1.4rem;
}

.content-card-info {
  flex: 1;
  min-width: 0;
}

.content-card-info strong {
  display: block;
  color: var(--text);
  font-size: .95rem;
}

.content-card-info span {
  display: block;
  color: var(--muted);
  font-size: .8rem;
}

.content-card-body {
  padding: 0 1.1rem .6rem;
}

.content-card-meta small {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .78rem;
}

.content-card-footer {
  display: flex;
  gap: .6rem;
  padding: .6rem 1.1rem 1rem;
  border-top: 1px solid var(--border);
}

.content-card-footer .btn {
  flex: 0 1 auto;
}

.btn-manage {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem .9rem;
  border: none;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-size: .82rem;
  font-weight: 700;
  text-decoration: none;
  transition: opacity .2s ease;
}

.btn-manage:hover { opacity: .88; color: #fff; }

.content-card-footer .form-switch {
  margin-left: auto;
  flex-shrink: 0;
}

.content-card-footer .form-switch small {
  font-size: .72rem;
  white-space: nowrap;
}

.sortable-ghost {
  opacity: .4;
  border: 2px dashed var(--primary) !important;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 1rem;
}

.modal-overlay > .modal-dialog {
  width: min(100%, 480px);
  max-height: 90vh;
  overflow-y: auto;
}

@media (max-width: 1199.98px) {
    .order-table-upgraded .order-actions-wrap {
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: .32rem;
        min-width: 0;
    }

    .order-table-upgraded .order-step-btn {
        min-width: 58px;
        height: 30px;
        padding: .24rem .38rem;
        gap: .16rem;
        border-radius: 999px;
        font-size: .66rem;
        line-height: 1;
        white-space: nowrap;
        overflow: hidden;
    }

    .order-table-upgraded .order-step-btn i {
        font-size: .9rem;
        line-height: 1;
        flex: 0 0 auto;
    }

    .order-table-upgraded .order-step-btn span {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

@media (max-width: 768px) {
    .order-table-upgraded .order-actions-wrap {
        display: grid;
        grid-template-columns: repeat(3, 30px);
        justify-content: end;
        justify-items: center;
        gap: .24rem;
        width: max-content;
        margin-left: auto;
    }

    .order-table-upgraded .cancelled-actions-wrap {
        grid-template-columns: repeat(2, 30px);
    }

    .order-table-upgraded .order-step-btn {
        width: 30px;
        min-width: 30px;
        height: 30px;
        min-height: 30px;
        aspect-ratio: 1 / 1;
        padding: 0;
        border-radius: 999px;
        gap: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        line-height: 1;
        flex: 0 0 30px;
    }

    .order-table-upgraded .order-step-btn span {
        display: none;
    }

    /* Icon-only on small screens, so the payment button needs just one column */
    .order-table-upgraded .order-step-btn-wide {
        grid-column: auto;
    }

    .order-table-upgraded .order-step-btn i {
        font-size: .92rem;
    }
}

.modal-lg {
  width: min(100%, 700px);
}

.form-control.is-invalid,
.form-select.is-invalid,
.input-group.has-validation .is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 0.15rem color-mix(in srgb, var(--danger) 25%, transparent);
}

.validation-message {
  color: var(--danger);
  font-size: 0.8rem;
  margin-top: 0.2rem;
}

.modal-content {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, .3);
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  background: color-mix(in srgb, var(--danger) 8%, var(--panel-bg));
  border-bottom: 1px solid var(--border);
}

.modal-header .modal-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--danger);
}

.modal-body {
  padding: 1.25rem;
}

.modal-body p { margin-bottom: .5rem; }
.modal-body strong { color: var(--text); }
.modal-body .text-danger {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .85rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: .6rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--muted) 4%, var(--panel-bg));
}

.setting-visibility-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: .85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-soft);
  transition: background .15s ease;
}

.setting-visibility-row:hover {
  background: color-mix(in srgb, var(--primary) 8%, var(--panel-soft));
}

.setting-visibility-info {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex: 1;
  min-width: 0;
}

.setting-visibility-info i {
  font-size: 1.3rem;
  color: var(--primary);
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  border-radius: 8px;
}

.setting-visibility-info strong {
  display: block;
  color: var(--text);
  font-size: .9rem;
}

.setting-visibility-info span {
  display: block;
  color: var(--muted);
  font-size: .78rem;
}

.setting-visibility-row .form-switch {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin: 0;
  flex-shrink: 0;
}

.setting-visibility-row .form-switch .form-check-input {
  cursor: pointer;
  width: 2.5rem;
  height: 1.25rem;
}

.content-type-summary {
  display: grid;
  gap: .5rem;
}

.content-type-pill:hover {
  background: color-mix(in srgb, var(--primary) 10%, var(--panel-soft));
  border-color: var(--primary);
  color: var(--text);
}

.content-type-pill {
  display: flex;
  align-items: center;
  gap: .35rem;
  padding: .45rem .55rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel-soft);
  color: var(--text);
  text-decoration: none;
  transition: all .15s ease;
}

.content-type-serial {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 600;
  margin-right: -9.2rem;
}

.content-type-pill i {
  font-size: 1.15rem;
  color: var(--primary);
}

.content-type-pill span {
  flex: 1;
  font-weight: 650;
  font-size: .88rem;
}

.report-bars {
  display: grid;
  gap: .85rem;
}

.report-bar-item {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.report-bar-label {
  display: flex;
  align-items: center;
  gap: .6rem;
  min-width: 140px;
  flex-shrink: 0;
}

.report-bar-label i {
  font-size: 1.1rem;
  color: var(--primary);
}

.report-bar-label span {
  font-weight: 650;
  font-size: .85rem;
  color: var(--text);
}

.report-bar-track {
  flex: 1;
  height: 28px;
  background: var(--panel-soft);
  border-radius: 6px;
  overflow: hidden;
}

.report-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 6px;
  transition: width .4s ease;
  min-width: 4px;
}

.report-bar-item strong {
  min-width: 32px;
  text-align: right;
  font-size: .9rem;
  color: var(--text);
}

.report-bar-serial {
  width: 28px;
  text-align: center;
  font-size: .75rem;
  font-weight: 800;
  color: var(--muted);
  flex-shrink: 0;
}

@media (max-width: 1199.98px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 991.98px) {
  .admin-shell.scrolled .admin-topbar {
    opacity: .89;
  }

  .admin-shell.scrolled .admin-sidebar {
    opacity: .89;
  }

  .admin-sidebar {
    transform: translateX(-100%);
  }

  .sidebar-open .admin-sidebar {
    transform: translateX(0);
  }

  .admin-shell.sidebar-collapsed .admin-sidebar {
    width: 292px;
    padding: 1rem;
  }

  .admin-shell.sidebar-collapsed .admin-main {
    margin-left: 0;
  }

  .admin-shell.sidebar-collapsed .brand-block > div:last-child {
    display: block;
  }

  .admin-shell.sidebar-collapsed .sidebar-link {
    justify-content: flex-start;
    padding: .75rem .85rem;
    gap: .8rem;
  }

  .admin-shell.sidebar-collapsed .sidebar-link span {
    display: inline;
  }

  .admin-shell.sidebar-collapsed .sidebar-link i {
    font-size: 1.2rem;
  }

  .admin-shell.sidebar-collapsed .sidebar-footer {
    display: flex;
  }

  .admin-main {
    margin-left: 0;
  }

  .admin-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .48);
    z-index: 1040;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }

  .sidebar-open .admin-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-visual {
    min-height: auto;
    padding: 2rem 1.5rem 1rem;
    gap: 1rem;
  }

  .auth-visual .auth-logo {
    width: 56px;
    height: 56px;
    flex: 0 0 56px;
    font-size: 1.4rem;
    border-radius: 14px;
  }

  .auth-visual h1 {
    font-size: 1.8rem;
  }

  .auth-visual p {
    font-size: .9rem;
  }

  .auth-metrics {
    gap: .4rem;
  }

  .auth-metrics span {
    padding: .35rem .6rem;
    font-size: .78rem;
  }

  .auth-card {
    padding: 1.5rem 1rem;
  }
}

@media (max-width: 767.98px) {
  .admin-topbar {
    min-height: 66px;
    padding: .75rem;
  }

  .admin-content {
    padding: .85rem;
  }

  .page-heading,
  .panel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .heading-actions,
  .heading-actions .btn {
    width: 100%;
  }

  .traffic-actions .btn-group,
  .traffic-actions .form-control {
    width: 100%;
  }

  .stats-grid,
  .module-grid,
  .permission-grid {
    grid-template-columns: 1fr;
  }

  .topbar-title span {
    display: none;
  }

  .auth-visual h1 {
    font-size: 2.4rem;
  }

  .content-cards-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: .85rem;
    padding-right: .2rem;
  }

  .content-card {
    max-width: 100%;
  }

  .content-card-serial {
    top: .55rem;
    right: .55rem;
  }
}

.password-toggle {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 6px 10px;
    font-size: 1.1rem;
    z-index: 5;
    transition: color 0.2s ease;
}
.password-toggle:hover {
    color: var(--primary);
}

/* Clear (×) button inside a text field; hidden while the field is empty. */
.clearable-field {
    position: relative;
}

.clearable-field > .form-control {
    padding-right: 2.75rem;
}

.clearable-field.has-toggle > .form-control {
    padding-right: 5.25rem;
}

.input-clear {
    position: absolute;
    right: 6px;
    top: 50%;
    z-index: 5;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    color: #94a3b8;
    font-size: 1.15rem;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease;
}

.clearable-field.has-toggle > .input-clear {
    right: 44px;
}

.input-clear:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.clearable-field > .form-control:placeholder-shown ~ .input-clear {
    display: none;
}

.invoice-print-shell {
    display: flex;
    justify-content: center;
    padding: 1rem 0 2rem;
}

.invoice-print-card {
    width: min(100%, 960px);
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 18px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, .08);
    padding: 1.5rem;
}

.invoice-print-table {
    border-color: #cbd5e1;
}

.invoice-print-table th,
.invoice-print-table td {
    border-color: #cbd5e1 !important;
    vertical-align: middle;
}

.order-detail-print-card {
    border: 1px solid #cbd5e1;
    border-radius: 18px;
    box-shadow: 0 24px 55px rgba(15, 23, 42, .12);
    overflow: hidden;
}

.order-detail-print-body {
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.order-detail-print-table {
    border-collapse: collapse;
    border-color: #cbd5e1 !important;
}

.order-detail-print-table > :not(caption) > * > * {
    border: 1px solid #d6deea !important;
    vertical-align: middle;
}

.order-detail-print-table thead th,
.order-detail-print-table tfoot td {
    background: #f8fafc !important;
}

/* ── Order invoice print sheet (A5 and 4 × 6 inch label) ──
   One layout for both sizes: all spacing/type is in em, and each paper size only sets the sheet's
   width, height and base font size. Sheets are sized in real units so the preview matches the paper. */
#admin-print-root {
  display: none;
}

.print-preview-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem 1rem;
  margin-bottom: .75rem;
}

.print-preview-stage {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  max-height: 72vh;
  overflow: auto;
  padding: 1.25rem;
  border-radius: 12px;
  background: #d9dee7;
}

[data-theme="dark"] .print-preview-stage {
  background: #0b1120;
}

.print-preview-stage .print-sheet {
  flex: 0 0 auto;
  box-shadow: 0 12px 32px rgba(15, 23, 42, .22);
}

@media (max-width: 700px) {
  .print-preview-stage {
    padding: .75rem;
  }

  .print-preview-stage .print-a5 {
    zoom: .6;
  }

  .print-preview-stage .print-label {
    zoom: .8;
  }
}

/* Order print-view footer: all actions on one line (labels collapse to icons on narrow screens) */
.order-detail-actions {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: .6rem;
}

.order-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  min-width: 0;
  height: 42px;
  margin: 0;
  padding: 0 1.1rem;
  border: 0;
  border-radius: 10px;
  color: #fff;
  font-size: .9rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 6px 16px var(--action-shadow, rgba(15, 23, 42, .18));
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}

.order-action-btn i {
  font-size: 1.05rem;
  line-height: 1;
}

.order-action-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.06);
  box-shadow: 0 10px 22px var(--action-shadow, rgba(15, 23, 42, .24));
}

.order-action-btn:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 45%, transparent);
  outline-offset: 2px;
}

.order-action-btn:disabled {
  cursor: not-allowed;
  filter: grayscale(.85);
  opacity: .55;
  box-shadow: none;
}

.order-action-edit {
  --action-shadow: rgba(234, 88, 12, .32);
  background: linear-gradient(135deg, #f59e0b, #ea580c);
}

.order-action-a5 {
  --action-shadow: rgba(79, 70, 229, .34);
  background: linear-gradient(135deg, #2563eb, #7c3aed);
}

.order-action-label {
  --action-shadow: rgba(13, 148, 136, .34);
  background: linear-gradient(135deg, #0d9488, #16a34a);
}

.order-action-close {
  --action-shadow: rgba(225, 29, 72, .30);
  background: linear-gradient(135deg, #f43f5e, #be123c);
}

@media (max-width: 767.98px) {
  .order-detail-actions {
    gap: .4rem;
  }

  .order-action-btn {
    flex: 1 1 0;
    padding: 0 .6rem;
    font-size: .8rem;
  }
}

/* Very narrow screens: icons only, so the four buttons still fit on one line */
@media (max-width: 479.98px) {
  .order-action-btn {
    font-size: 0;
    gap: 0;
  }

  .order-action-btn i {
    font-size: 1.2rem;
  }
}

.print-sheet {
  box-sizing: border-box;
  background: #fff;
  color: #000;
  font-family: Arial, "Segoe UI", "Noto Sans Bengali", sans-serif;
  text-align: left;
}

.print-sheet *,
.print-sheet *::before,
.print-sheet *::after {
  box-sizing: border-box;
}

.print-invoice {
  display: flex;
  flex-direction: column;
  line-height: 1.4;
}

/* Paper sizes: the 4 × 6 content area is ~0.72 of A5's, so its base font is scaled the same way */
.print-a5 {
  width: 148mm;
  min-height: 210mm;
  padding: 8mm;
  font-size: 9pt;
}

.print-label {
  width: 4in;
  min-height: 6in;
  padding: 3mm;
  font-size: 6.6pt;
}

.print-preview-stage .print-label {
  outline: 1px dashed #9aa3b2;
}

.inv-heading {
  margin-bottom: 1em;
  padding-bottom: .45em;
  border-bottom: .2em solid #000;
  font-size: 1.15em;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  overflow-wrap: anywhere;
}

.inv-heading-title {
  letter-spacing: .35em;
  text-transform: uppercase;
}

/* Website name keeps its own spelling/case: "INVOICE (BD Shop)" */
.inv-heading-site {
  margin-left: .15em;
  letter-spacing: .02em;
}

.inv-parties {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1em;
  margin-bottom: 1em;
}

.inv-box {
  display: flex;
  flex-direction: column;
  gap: .2em;
  min-width: 0;
  padding: .9em 1em;
  border: 1px solid #555;
  border-radius: .5em;
  overflow-wrap: anywhere;
}

.inv-label {
  margin-bottom: .3em;
  padding: .1em 0 .35em;
  border-bottom: 1px solid #cfcfcf;
  color: #333;
  font-size: .8em;
  font-weight: 700;
  letter-spacing: .08em;
  line-height: 1.4;
  text-transform: uppercase;
}

.inv-row {
  display: flex;
  justify-content: space-between;
  gap: .8em;
}

.inv-row > :last-child {
  min-width: 0;
  text-align: right;
  overflow-wrap: anywhere;
}

.inv-strong {
  font-weight: 700;
}

.inv-name {
  font-size: 1.15em;
}

.inv-muted {
  color: #555;
}

.inv-small {
  font-size: .9em;
}

.inv-address {
  margin-top: .3em;
  padding-top: .35em;
  border-top: 1px dashed #bbb;
}

.inv-barcode {
  margin-top: auto;
  padding-top: .6em;
}

.inv-barcode .barcode-svg {
  display: block;
  width: 100%;
  height: auto;
}

.inv-barcode-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .5em;
  margin-top: .3em;
  font-size: .85em;
}

.inv-barcode-meta strong {
  letter-spacing: .06em;
}

.inv-items-area {
  flex: 0 0 auto;
}

.inv-items {
  width: 100%;
  border-collapse: collapse;
}

.inv-items th {
  padding: .45em .5em;
  border-bottom: .15em solid #000;
  font-size: .8em;
  font-weight: 700;
  text-align: left;
  text-transform: uppercase;
}

.inv-items td {
  padding: .5em;
  border-bottom: 1px solid #d0d0d0;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.inv-items tr {
  break-inside: avoid;
  page-break-inside: avoid;
}

.inv-items .inv-col-no {
  width: 2.2em;
}

.inv-items .inv-col-num {
  width: 3.2em;
  text-align: center;
}

.inv-items .inv-col-money {
  width: 6.8em;
  text-align: right;
  white-space: nowrap;
}

.inv-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 1em;
  margin-top: 1em;
  padding-top: .8em;
  border-top: .15em solid #000;
  break-inside: avoid;
  page-break-inside: avoid;
}

.inv-summary,
.inv-totals {
  display: flex;
  flex-direction: column;
  gap: .25em;
  min-width: 0;
}

.inv-note {
  margin-top: .5em;
  padding: .5em .7em;
  border: 1px dashed #888;
  border-radius: .4em;
  overflow-wrap: anywhere;
}

.inv-note .inv-label {
  border-bottom: 0;
  padding-bottom: 0;
}

.inv-totals .inv-grand {
  margin-top: .3em;
  padding-top: .45em;
  border-top: 1px solid #000;
  font-size: 1.25em;
  font-weight: 700;
}

.inv-totals .inv-due {
  margin-top: .3em;
  padding: .45em .6em;
  border: .15em solid #000;
  border-radius: .4em;
  font-weight: 700;
}

/* Totals + footer. It fills the rest of a single page (footer at the bottom) and never splits,
   so on long invoices it moves to the next page as a whole instead of leaving parts behind. */
.inv-end {
  display: flex;
  flex: 1 0 auto;
  flex-direction: column;
  break-inside: avoid;
  page-break-inside: avoid;
}

.inv-closing {
  margin-top: auto;
  padding-top: 1.8em;
}

.inv-footer {
  margin-top: 1em;
  padding-top: .5em;
  border-top: 1px dashed #999;
  color: #444;
  font-size: .85em;
  text-align: center;
}

@media print {
  /* Only the cloned sheet is printed; everything else on the page is removed from layout. */
  html.admin-printing,
  html.admin-printing body {
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
  }

  html.admin-printing body > *:not(#admin-print-root) {
    display: none !important;
  }

  html.admin-printing #admin-print-root {
    display: block !important;
  }

  html.admin-printing #admin-print-root,
  html.admin-printing #admin-print-root * {
    visibility: visible !important;
  }

  /* Page margins come from @page (adminUtils.printSheet), so the sheet fills the printable area */
  html.admin-printing #admin-print-root .print-sheet {
    width: 100%;
    margin: 0 !important;
    padding: 0;
    box-shadow: none !important;
    outline: 0 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Printable height = paper height minus the @page margins (1px less to avoid a blank extra page) */
  html.admin-printing #admin-print-root .print-a5 {
    min-height: calc(210mm - 16mm - 1px);
  }

  html.admin-printing #admin-print-root .print-label {
    min-height: calc(152.4mm - 6mm - 1px);
  }
}
@media print {
    html,
    body {
        background: #fff !important;
    }

    body * { visibility: hidden; }
    .modal-content, .modal-content * { visibility: visible; }
    .modal-content { position: absolute; left: 0; top: 0; width: 100%; box-shadow: none !important; border: none !important; }
    .modal-header .btn-close, .modal-header .btn-fullscreen, .modal-footer, .modal-body .btn { display: none !important; }
    .modal-header { border-bottom: 1px solid #dee2e6 !important; }
    .modal-body table { page-break-inside: auto; }
    .modal-body table tr { page-break-inside: avoid; }
    .modal-body .order-info-card { page-break-inside: avoid; box-shadow: none !important; border: 1px solid #dee2e6 !important; }
    .modal-dialog { margin: 0 !important; max-width: 100% !important; }

    .admin-topbar,
    .admin-sidebar,
    .d-print-none {
        display: none !important;
    }

    .admin-main,
    .admin-content {
        margin: 0 !important;
        padding: 0 !important;
    }

    .invoice-print-shell,
    .invoice-print-shell * {
        visibility: visible !important;
    }

    .invoice-print-shell {
        position: absolute;
        inset: 0;
        display: flex !important;
        align-items: flex-start;
        justify-content: center;
        padding: 24px 0 !important;
    }

    .invoice-print-card {
        width: 185mm !important;
        margin: 0 auto !important;
        border: 1px solid #94a3b8 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        padding: 16mm !important;
    }

    .invoice-print-table,
    .invoice-print-table th,
    .invoice-print-table td {
        border: 1px solid #94a3b8 !important;
    }

    .modal-dialog.order-detail-dialog {
        width: 190mm !important;
        max-width: 190mm !important;
        margin: 0 auto !important;
    }

    .modal-dialog.order-detail-dialog .modal-content.order-detail-print-card {
        position: static !important;
        left: auto !important;
        top: auto !important;
        width: 100% !important;
        margin: 0 auto !important;
        border: 1px solid #94a3b8 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        background: #fff !important;
    }

    .order-detail-print-body {
        padding: 12mm !important;
        background: #fff !important;
    }

    .order-detail-print-table,
    .order-detail-print-table th,
    .order-detail-print-table td {
        border: 1px solid #94a3b8 !important;
        border-collapse: collapse !important;
    }
}

@media (max-width: 575.98px) {
  .auth-visual {
    padding: 1.5rem 1rem .75rem;
    gap: .75rem;
  }

  .auth-visual .auth-logo {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    font-size: 1.1rem;
    border-radius: 12px;
    box-shadow: 0 0 30px rgba(37, 99, 235, .25);
  }

  .auth-visual h1 {
    font-size: 1.4rem;
  }

  .auth-visual p {
    display: none;
  }

  .auth-metrics span:not(:first-child) {
    display: none;
  }

  .auth-card {
    padding: 1.25rem .85rem;
  }

  .auth-form h2 {
    font-size: 1.3rem;
  }

  .auth-form .form-control-lg {
    font-size: .95rem;
    padding: .45rem .75rem;
  }
}

/* ── Responsive Admin Table ── */
@media (max-width: 768px) {
    .admin-table {
        font-size: 0.82rem;
    }
    .admin-table:not(.order-table-upgraded) .btn-sm {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }

    .users-admin-table .btn-group,
    .users-action-table td.text-end .btn-group {
        display: inline-flex;
        flex-wrap: nowrap;
        vertical-align: middle;
    }

    .users-action-table td.text-end {
        white-space: nowrap;
        min-width: 72px;
    }

    .users-admin-table .btn-group .btn-sm,
    .users-action-table td.text-end .btn-sm {
        width: auto;
        height: auto;
        min-width: 0;
        min-height: 0;
        font-size: .875rem;
        padding: .25rem .5rem;
        gap: 0;
        border-radius: 0;
    }

    .users-action-table td.text-end .btn-sm {
        margin-right: -1px !important;
    }

    .users-admin-table .btn-group .btn-sm:first-child,
    .users-action-table td.text-end .btn-sm:first-child {
        border-top-left-radius: .375rem;
        border-bottom-left-radius: .375rem;
    }

    .users-admin-table .btn-group .btn-sm:last-child,
    .users-action-table td.text-end .btn-sm:last-child {
        border-top-right-radius: .375rem;
        border-bottom-right-radius: .375rem;
    }

    .users-action-table td.text-end .btn-sm:last-child {
        margin-right: 0 !important;
    }
}

.modal-lg {
    width: min(100%, 700px);
}
.modal-xl {
    width: min(100%, 600px);
}

@media (min-width: 992px) {
    .modal-dialog:not(.modal-sm):not(.modal-fullscreen) {
        min-width: 700px;
    }
}

@media (min-width: 768px) {
    .modal-xl {
        width: min(100%, 800px);
    }
}
@media (min-width: 1200px) {
    .modal-xl {
        width: min(100%, 1100px);
    }
}

/* ── Modal XL max-height fix ── */
@media (max-height: 700px) {
    .modal-dialog-scrollable.modal-xl .modal-body {
        max-height: 50vh;
    }
}

/* ── Order detail enhancement ── */
.order-info-card {
    background: #f8fafc;
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid #e2e8f0;
    height: 100%;
}

.order-info-card h6 {
    font-size: 0.88rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    margin-bottom: 0.8rem;
}

.order-info-card table tr td:first-child {
    color: #64748b;
    font-size: 0.84rem;
    padding: 0.3rem 0.5rem;
}

.order-info-card table tr td:last-child {
    font-size: 0.88rem;
    padding: 0.3rem 0.5rem;
}

/* ── Fullscreen Toggle ── */
.btn-fullscreen {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 0 0.3rem;
    font-size: 1.2rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    transition: color 0.2s ease;
}
.btn-fullscreen:hover {
    color: var(--primary);
}
.modal-fullscreen {
    width: 100% !important;
    max-width: 100% !important;
    height: 100vh !important;
    max-height: 100vh !important;
    margin: 0 !important;
    border-radius: 0;
}
.modal-fullscreen .modal-content {
    border-radius: 0;
    height: 100vh;
    max-height: 100vh;
}
.modal-fullscreen .modal-body {
    max-height: calc(100vh - 140px) !important;
}
.modal-overlay.fullscreen {
    padding: 0;
}
.modal-overlay.fullscreen > .modal-dialog {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 100vh !important;
    height: 100vh;
    border-radius: 0;
}
.modal-overlay.fullscreen > .modal-dialog .modal-content {
    border-radius: 0;
    height: 100vh;
}
