/* =============================================================================
   OneG Design System — app.css
   Shared by OneG & OneG. Loads AFTER Bootstrap 5.3.
   Prefer Bootstrap utilities/components; this file = tokens + app chrome + brand.
   Breakpoints: mobile <768 | tablet ≤1024 | desktop >1024
   ============================================================================= */

/* ---------------------------------------------------------------------------
   1. Design tokens
   --------------------------------------------------------------------------- */
:root {
  /* Brand */
  --af-bg: #f3f5fa;
  --af-surface: #ffffff;
  --af-sidebar: #12142b;
  --af-sidebar-soft: #1b1e3d;
  --af-primary: #3d5afe;
  --af-primary-dark: #2a3eb1;
  --af-teal: #14b8a6;
  --af-amber: #f5a623;
  --af-rose: #ef476f;
  --af-text: #12172b;
  --af-text-muted: #6b7280;
  --af-text-faint: #9aa1b1;
  --af-border: #e6e9f2;
  --af-success: #1fae6b;
  --af-danger: #e5484d;

  /* Semantic aliases */
  --bg: var(--af-bg);
  --surface: var(--af-surface);
  --surface-muted: #fafafa;
  --surface-hover: #f5f5f5;
  --surface-soft: #f9f9f9;
  --surface-tint: #fafbff;
  --border: var(--af-border);
  --border-md: #d5dae8;
  --text: var(--af-text);
  --text-2: var(--af-text-muted);
  --text-3: var(--af-text-faint);
  --brand-accent: var(--af-primary);
  --brand-accent-dark: var(--af-primary-dark);

  /* Sidebar chrome */
  --sidebar-text: #e8eaf2;
  --sidebar-muted: #a8aec3;
  --sidebar-accent-soft: #c5ceff;
  --sidebar-border: rgba(255, 255, 255, 0.08);
  --sidebar-active-bg: rgba(61, 90, 254, 0.18);
  --sidebar-av-bg: rgba(61, 90, 254, 0.25);
  --sidebar-badge-bg: rgba(61, 90, 254, 0.2);

  /* Palette scales */
  --green-50: #e8f8f0;
  --green-100: #b8e8cf;
  --green-200: #6fd4a0;
  --green-400: var(--af-success);
  --green-600: #178a54;
  --green-800: #0f5c38;
  --blue-50: #eef1ff;
  --blue-soft: #c5ceff;
  --blue-400: var(--af-primary);
  --blue-800: var(--af-primary-dark);
  --amber-50: #fff6e5;
  --amber-soft: #fde68a;
  --amber-400: var(--af-amber);
  --amber-border: #fac775;
  --amber-800: #8a5a00;
  --red-50: #fdecec;
  --red-soft: #f5b0b2;
  --red-400: var(--af-danger);
  --red-800: #9b1c1f;
  --purple-50: #eef1ff;
  --purple-400: var(--af-primary);
  --purple-800: var(--af-primary-dark);
  --teal-50: #e6faf7;
  --teal-soft: #99f6e4;
  --teal-400: var(--af-teal);
  --teal-800: #0f766e;
  --pink-50: #fde8ee;
  --pink-400: var(--af-rose);
  --pink-800: #9b1d3a;
  --gray-50: #f3f5fa;
  --gray-100: #e6e9f2;
  --gray-400: var(--af-text-faint);
  --gray-800: var(--af-text-muted);
  --green-soft-alt: #eaf3de;

  /* Spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;

  /* Typography / shape / elevation */
  --font: "Google Sans Flex", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --fs-xs: 11px;
  --fs-sm: 12px;
  --fs-md: 13px;
  --fs-base: 14px;
  --fs-lg: 15px;
  --fs-xl: 16px;
  --fs-2xl: 17px;
  --fs-3xl: 18px;
  --fs-4xl: 20px;
  --fs-5xl: 22px;
  --fs-6xl: 26px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-pill: 20px;
  --sidebar-w: 220px;
  --sidebar-collapsed: 60px;
  --topbar-h: 56px;
  --content-narrow: 720px;
  --panel-aside: 340px;
  --shadow-sm: 0 1px 3px rgba(18, 23, 43, 0.06);
  --shadow-md: 0 4px 16px rgba(18, 23, 43, 0.08);
  --shadow-lg: 0 8px 32px rgba(18, 23, 43, 0.12);
  --focus-ring: 0 0 0 3px rgba(61, 90, 254, 0.15);
  --primary-glow: 0 2px 8px rgba(61, 90, 254, 0.45);
  --transition-fast: 0.15s ease;
  --z-sidebar: 100;
  --z-overlay: 99;
  --z-topbar: 50;
  --z-modal: 200;

  /* Select chevron */
  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");

  /* Bootstrap 5.3 bridge — theme BS components from our tokens */
  --bs-primary: var(--af-primary);
  --bs-primary-rgb: 61, 90, 254;
  --bs-secondary: var(--af-text-muted);
  --bs-secondary-rgb: 107, 114, 128;
  --bs-success: var(--af-success);
  --bs-success-rgb: 31, 174, 107;
  --bs-danger: var(--af-danger);
  --bs-danger-rgb: 229, 72, 77;
  --bs-warning: var(--af-amber);
  --bs-warning-rgb: 245, 166, 35;
  --bs-info: var(--af-teal);
  --bs-info-rgb: 20, 184, 166;
  --bs-body-font-family: var(--font);
  --bs-body-font-size: var(--fs-base);
  --bs-body-color: var(--af-text);
  --bs-body-bg: var(--af-bg);
  --bs-border-color: var(--af-border);
  --bs-border-radius: var(--radius-md);
  --bs-border-radius-sm: var(--radius-sm);
  --bs-border-radius-lg: var(--radius-lg);
  --bs-border-radius-pill: var(--radius-pill);
  --bs-link-color: var(--af-primary);
  --bs-link-hover-color: var(--af-primary-dark);
  --bs-focus-ring-color: rgba(61, 90, 254, 0.25);
}

/* ---------------------------------------------------------------------------
   2. Base
   --------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  font-size: var(--fs-base);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  font-family: var(--font);
  cursor: pointer;
}

i.ti {
  vertical-align: -0.125em;
}

/* ---------------------------------------------------------------------------
   3. App shell — sidebar, main, topbar
   --------------------------------------------------------------------------- */
.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--af-sidebar);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: var(--z-sidebar);
  overflow: hidden;
  transition: width var(--transition-fast), transform var(--transition-fast);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: var(--space-4) var(--space-4) 9px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.logo-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--af-primary);
  box-shadow: var(--primary-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-icon .ti {
  color: #fff;
  font-size: 15px;
  line-height: 1;
}

.logo-icon.logo-icon-sm {
  width: 28px;
  height: 28px;
  border-radius: 7px;
}

.logo-icon.logo-icon-sm .ti {
  font-size: 12px;
}

.logo-icon.accent-blue {
  background: var(--af-primary);
  box-shadow: var(--primary-glow);
}

.brand-logo {
  width: auto;
  display: block;
  flex-shrink: 0;
}

.brand-logo-login {
  height: 40px;
}

.brand-logo-sidebar {
  height: 32px;
}

.brand-logo-topbar {
  height: 28px;
}

.brand-with-fallback {
  justify-content: center;
}

.brand-fallback {
  display: none;
  text-align: center;
}

.brand-with-fallback.is-fallback .brand-logo {
  display: none;
}

.brand-with-fallback.is-fallback .brand-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.logo-text {
  font-size: var(--fs-xl);
  font-weight: 600;
  white-space: nowrap;
  color: #fff;
}

.sidebar-tenant {
  font-size: var(--fs-xs);
  color: var(--af-text-faint);
  margin-top: 1px;
}

.sidebar-nav {
  flex: 1 1 auto;
  min-height: 0;
  padding: 10px var(--space-2);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
}

.sidebar-nav::-webkit-scrollbar {
  width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.22);
  border-radius: 3px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.35);
}

.nav-group-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: var(--space-2) var(--space-2) var(--space-2);
  border: 0;
  background: transparent;
  cursor: pointer;
}

.nav-group-label {
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--af-text-faint);
  text-transform: capitalize;
  white-space: nowrap;
  margin: 8px 0;
  line-height: 1;
}

.nav-group-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  line-height: 1;
}

.nav-group-icon {
  font-size: 15px;
  width: 18px;
  text-align: center;
  color: var(--af-text-faint);
  flex-shrink: 0;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-group-chevron {
  font-size: 14px;
  color: var(--af-text-faint);
  transition: transform var(--transition-fast), color var(--transition-fast);
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-group-items {
  display: none;
  padding: 6px 0 4px 40px;
  position: relative;
}

.nav-group-items::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 18px;
  width: 1px;
  background: rgba(255, 255, 255, 0.12);
}

.nav-group.is-open .nav-group-items {
  display: block;
}

.nav-group.is-open .nav-group-chevron {
  transform: rotate(180deg);
  color: #fff;
}

.nav-group.is-open .nav-group-icon,
.nav-group-toggle:hover .nav-group-icon {
  color: #fff;
}

.nav-group.is-open .nav-group-toggle,
.nav-group-toggle:hover {
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-md);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: var(--space-2) 10px;
  border-radius: var(--radius-md);
  font-size: var(--fs-base);
  color: var(--sidebar-muted);
  margin-bottom: 1px;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.nav-group-items .nav-link {
  position: relative;
  gap: 0;
  padding-left: 12px;
}

.nav-group-items .nav-link::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 50%;
  width: 10px;
  height: 1px;
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-50%);
}

.nav-chat-badge {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.nav-group-items .nav-link .nav-icon,
.nav-group-items .nav-link i.ti,
.nav-group-items .nav-link i.fa-solid,
.nav-group-items .nav-link i.fa-regular {
  display: none;
}

.nav-link:hover {
  background: var(--af-sidebar-soft);
  color: #fff;
}

.nav-link.active {
  background: transparent;
  color: #4a9eff;
  font-weight: 600;
}

.nav-link.active:hover {
  background: transparent;
  color: #6eb0ff;
}

.nav-link .nav-icon,
.nav-link i.ti,
.nav-link i.fa-solid,
.nav-link i.fa-regular {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  line-height: 1;
}

.nav-link.active .nav-icon {
  color: var(--af-primary);
}

.nav-link.nav-link-soon {
  opacity: 0.55;
  cursor: default;
  pointer-events: none;
}

.nav-section-label {
  margin: 10px 0 4px;
  padding: 0 12px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.38);
  user-select: none;
}

.aff-settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  background: var(--af-surface-2, #f3f4f6);
  border-radius: var(--radius-md, 8px);
}

.aff-settings-tab {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: calc(var(--radius-md, 8px) - 2px);
  font-size: var(--fs-base, 14px);
  font-weight: 500;
  color: var(--af-text-muted, #6b7280);
  text-decoration: none;
  transition: background var(--transition-fast, 0.15s), color var(--transition-fast, 0.15s);
}

.aff-settings-tab:hover {
  color: var(--af-text, #111827);
  background: rgba(255, 255, 255, 0.7);
  text-decoration: none;
}

.aff-settings-tab.active {
  background: #fff;
  color: var(--af-primary, #2563eb);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* Affiliate settings — section heading inside panel-header */
.aff-sec {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.aff-sec-ico {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
  background: var(--blue-50);
  color: var(--blue-400);
  font-size: 16px;
}

.aff-sec-ico.is-teal {
  background: var(--teal-50);
  color: var(--teal-400);
}

.aff-sec-ico.is-amber {
  background: var(--amber-50);
  color: var(--amber-400);
}

.aff-sec-ico.is-green {
  background: var(--green-50);
  color: var(--green-400);
}

.aff-sec-txt strong {
  display: block;
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--text);
}

.aff-sec-txt span {
  display: block;
  font-size: var(--fs-sm);
  color: var(--text-2);
  line-height: 1.45;
}

/* Toggle rows */
.aff-toggle-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-5);
  padding: var(--space-4) 0;
  border-top: 0.5px solid var(--border);
}

.aff-toggle-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.aff-toggle-row:last-child {
  padding-bottom: 0;
}

.aff-toggle-text label {
  display: block;
  margin: 0 0 2px;
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.aff-toggle-text p {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--text-2);
  line-height: 1.5;
}

.aff-toggle-ctl {
  flex-shrink: 0;
  min-height: 0;
  margin: 0;
  padding-left: 0;
}

.aff-toggle-ctl .form-check-input {
  margin: 0;
  cursor: pointer;
}

/* Field grid */
.aff-field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-4);
}

.aff-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.aff-field>label {
  margin: 0;
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text);
}

.aff-field-hint {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--text-3);
  line-height: 1.45;
}

/* Callouts */
.aff-callout {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-tint);
  font-size: var(--fs-md);
  color: var(--text-2);
  line-height: 1.55;
}

.aff-callout i {
  flex-shrink: 0;
  margin-top: 1px;
  font-size: 16px;
  color: var(--text-3);
}

.aff-callout strong {
  font-weight: 600;
  color: var(--text);
}

.aff-callout-info {
  background: var(--blue-50);
  border-color: var(--blue-soft);
  color: var(--blue-800);
}

.aff-callout-info i,
.aff-callout-info strong {
  color: var(--blue-800);
}

/* Ranked priority list */
.aff-rank {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: aff-rank;
}

.aff-rank li {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  padding: var(--space-3) var(--space-4);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-tint);
}

.aff-rank li::before {
  counter-increment: aff-rank;
  content: counter(aff-rank);
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--blue-50);
  color: var(--blue-800);
  font-size: var(--fs-sm);
  font-weight: 600;
}

.aff-rank strong {
  display: block;
  font-size: var(--fs-base);
  color: var(--text);
}

.aff-rank span {
  display: block;
  font-size: var(--fs-sm);
  color: var(--text-2);
  line-height: 1.5;
}

/* Numbered steps with connector */
.aff-steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: aff-step;
}

.aff-steps li {
  position: relative;
  display: flex;
  gap: var(--space-3);
  padding-bottom: var(--space-4);
}

.aff-steps li:last-child {
  padding-bottom: 0;
}

.aff-steps li::before {
  counter-increment: aff-step;
  content: counter(aff-step);
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--blue-400);
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: 600;
}

.aff-steps li::after {
  content: "";
  position: absolute;
  left: 11.5px;
  top: 28px;
  bottom: 4px;
  width: 1px;
  background: var(--border-md);
}

.aff-steps li:last-child::after {
  display: none;
}

.aff-step-body {
  padding-top: 3px;
  font-size: var(--fs-base);
  line-height: 1.5;
  color: var(--text);
}

.aff-step-body small {
  display: block;
  margin-top: 2px;
  font-size: var(--fs-sm);
  color: var(--text-2);
  line-height: 1.5;
}

/* Formula strip */
.aff-formula {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4);
  border: 0.5px dashed var(--border-md);
  border-radius: var(--radius-md);
  background: var(--surface-tint);
  font-size: var(--fs-base);
  color: var(--text-2);
}

.aff-formula code {
  padding: 4px 8px;
  border: 0.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: var(--fs-md);
  color: var(--text);
}

.aff-formula .aff-formula-res {
  font-weight: 700;
  color: var(--green-600);
}

/* Special-case list */
.aff-cases {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.aff-cases li {
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
  font-size: var(--fs-md);
  color: var(--text-2);
  line-height: 1.5;
}

.aff-cases li i {
  flex-shrink: 0;
  margin-top: 1px;
  font-size: 16px;
  color: var(--amber-400);
}

.aff-cases code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface-hover);
  font-size: var(--fs-sm);
  color: var(--text);
}

/* Lifecycle cards */
.aff-lifecycle {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: var(--space-3);
}

.aff-lifecycle-step {
  padding: var(--space-4);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-tint);
}

.aff-lifecycle-step .badge {
  margin-bottom: var(--space-2);
}

.aff-lifecycle-step p {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--text-2);
  line-height: 1.5;
}

/* Collapsible howto (campaign / payment flow) */
.aff-howto {
  margin-bottom: var(--space-4);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.aff-howto>summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-5);
  list-style: none;
  cursor: pointer;
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--text);
  background: var(--surface-soft);
  user-select: none;
}

.aff-howto>summary::-webkit-details-marker {
  display: none;
}

.aff-howto>summary .aff-howto-chevron {
  margin-left: auto;
  font-size: 16px;
  color: var(--text-3);
  transition: transform var(--transition-fast);
}

.aff-howto[open]>summary .aff-howto-chevron {
  transform: rotate(180deg);
}

.aff-howto>summary i.aff-howto-ico {
  color: var(--text-3);
  font-size: 16px;
}

.aff-howto-body {
  padding: var(--space-5);
  border-top: 0.5px solid var(--border);
}

.aff-howto-flow {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: aff-howto;
}

.aff-howto-flow>li {
  position: relative;
  counter-increment: aff-howto;
  padding-top: 36px;
}

.aff-howto-flow>li::before {
  content: counter(aff-howto);
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1.5px solid var(--border-md);
  background: var(--surface);
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: 600;
}

.aff-howto-flow>li:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 11px;
  left: 28px;
  right: calc(-1 * var(--space-3));
  height: 1px;
  background: var(--border-md);
}

.aff-howto-flow strong {
  display: block;
  margin-bottom: 4px;
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
}

.aff-howto-flow span {
  display: block;
  font-size: var(--fs-sm);
  color: var(--text-2);
  line-height: 1.5;
}

@media (max-width: 1024px) {
  .aff-howto-flow {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  .aff-howto-flow>li {
    padding-top: 0;
    padding-left: 36px;
  }

  .aff-howto-flow>li::before {
    left: 0;
    top: 0;
  }

  .aff-howto-flow>li:not(:last-child)::after {
    top: 28px;
    left: 11.5px;
    right: auto;
    bottom: calc(-1 * var(--space-4));
    width: 1px;
    height: auto;
  }
}

/* Payout proof upload */
.aff-proof-drop {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 120px;
  height: 120px;
  margin: 0;
  border: 1.5px dashed var(--border-md);
  border-radius: var(--radius-md);
  background: var(--surface-tint);
  cursor: pointer;
  overflow: hidden;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.aff-proof-drop:hover {
  border-color: var(--blue-400);
  background: var(--blue-50);
}

.aff-proof-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-3);
  font-size: var(--fs-sm);
  font-weight: 500;
}

.aff-proof-placeholder i {
  font-size: 22px;
}

.aff-proof-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Sales form: main + aside (collections / promotions) */
.sales-form-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: var(--space-4);
  align-items: start;
}

@media (max-width: 1024px) {
  .sales-form-layout {
    grid-template-columns: 1fr;
  }
}

.promo-choice-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.promo-choice {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: 0;
  padding: var(--space-3) var(--space-4);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  cursor: pointer;
}

.promo-choice:has(input:checked) {
  border-color: var(--blue-400);
  background: var(--blue-50);
}

.promo-choice input {
  margin: 0;
  flex-shrink: 0;
}

.promo-choice span {
  font-size: var(--fs-base);
  font-weight: 500;
  color: var(--text);
}

.nav-soon {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--sidebar-accent-soft);
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-pill);
  padding: 1px 6px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 10px var(--space-2) 14px;
  border-top: 1px solid var(--sidebar-border);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-footer-link {
  margin: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: var(--space-2) 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.sidebar-user:hover {
  background: var(--af-sidebar-soft);
}

.user-menu {
  position: relative;
  width: 100%;
}

.topbar .user-menu {
  width: auto;
  flex-shrink: 0;
}

.user-menu>.sidebar-user,
.user-menu>.topbar-user {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  font: inherit;
  color: inherit;
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-menu>.topbar-user {
  width: auto;
  gap: var(--space-2);
}

.user-menu .dropdown-toggle::after {
  display: none;
}

.user-menu-copy {
  min-width: 0;
  flex: 1;
  text-align: left;
}

.user-menu-caret {
  font-size: 14px;
  opacity: 0.6;
  flex-shrink: 0;
}

.user-menu-dropdown {
  min-width: 200px;
  padding: 6px;
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md, 0 8px 24px rgba(0, 0, 0, .08));
}

.user-menu-dropdown .dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-base);
  padding: 8px 10px;
}

.user-menu-dropdown .dropdown-item i {
  font-size: 16px;
  opacity: 0.85;
}

.user-menu-dropdown form {
  margin: 0;
}

.user-menu-dropdown button.dropdown-item {
  width: 100%;
  border: 0;
  background: transparent;
}

.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg);
  background-image:
    linear-gradient(135deg, rgba(8, 18, 38, 0.58), rgba(12, 32, 66, 0.42)),
    radial-gradient(ellipse at top left, color-mix(in srgb, var(--af-primary) 14%, transparent), transparent 52%),
    url("/img/login-bg.jpg");
  background-size: cover, cover, cover;
  background-position: center, center, center;
  background-repeat: no-repeat, no-repeat, no-repeat;
  padding: var(--space-5);
}

.auth-shell {
  width: 100%;
  max-width: 420px;
}

.auth-card {
  background: color-mix(in srgb, var(--surface) 94%, #fff 6%);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(2px);
  padding: 28px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.auth-brand-name {
  font-size: var(--fs-xl);
  font-weight: 700;
}

.auth-brand-sub {
  font-size: var(--fs-sm);
  color: var(--text-3);
}

.auth-title {
  font-size: var(--fs-3xl);
  font-weight: 600;
  margin: 0 0 6px;
}

.auth-sub {
  color: var(--text-2);
  margin: 0 0 20px;
  font-size: var(--fs-base);
}

.auth-form .field {
  margin-bottom: 14px;
}

.auth-form .inp,
.auth-form .form-control,
.auth-form .form-select {
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--border-md) 88%, #fff 12%);
  border-radius: calc(var(--radius-md) + 2px);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: inset 0 1px 2px rgba(18, 23, 43, 0.04);
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    background-color var(--transition-fast),
    transform var(--transition-fast);
}

.auth-form .inp::placeholder,
.auth-form .form-control::placeholder,
.auth-form .form-select::placeholder {
  color: color-mix(in srgb, var(--text-2) 78%, #fff 22%);
}

.auth-form .inp:hover,
.auth-form .form-control:hover,
.auth-form .form-select:hover {
  border-color: color-mix(in srgb, var(--af-primary) 28%, var(--border-md) 72%);
  background: rgba(255, 255, 255, 0.98);
}

.auth-form .inp:focus,
.auth-form .form-control:focus,
.auth-form .form-select:focus {
  border-color: var(--af-primary);
  background: #fff;
  box-shadow:
    0 0 0 4px rgba(61, 90, 254, 0.12),
    0 8px 20px rgba(61, 90, 254, 0.08);
  transform: translateY(-1px);
}

.auth-form .lbl,
.auth-form .form-label {
  margin-bottom: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  color: color-mix(in srgb, var(--text) 82%, var(--text-2) 18%);
}

.auth-input-wrap {
  position: relative;
}

.auth-input-icon {
  position: absolute;
  /* Input khi focus có transform nên được nâng lên cùng lớp vẽ với icon;
     cần z-index để icon không bị nền input che mất. */
  z-index: 2;
  top: 50%;
  left: 14px;
  transform: translateY(-50%);
  font-size: 18px;
  color: color-mix(in srgb, var(--text-2) 82%, #fff 18%);
  pointer-events: none;
  transition: color var(--transition-fast);
}

.auth-input {
  padding-left: 42px !important;
}

.auth-input-wrap:focus-within .auth-input-icon {
  color: var(--af-primary);
}

.auth-form .form-check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid color-mix(in srgb, var(--border-md) 85%, #fff 15%);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.62);
}

.auth-form .form-check-input,
.auth-form input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 0;
  border: 1px solid color-mix(in srgb, var(--border-md) 80%, var(--af-primary) 20%);
  box-shadow: none;
}

.auth-form .form-check-input:focus,
.auth-form input[type="checkbox"]:focus {
  box-shadow: 0 0 0 3px rgba(61, 90, 254, 0.14);
}

.auth-form .form-check-label,
.auth-form .auth-remember {
  color: var(--text-2);
  font-size: var(--fs-sm);
}

.auth-form .btn,
.auth-form .btn-primary:not(.btn) {
  min-height: 44px;
  font-weight: 600;
  border-radius: calc(var(--radius-md) + 2px);
  box-shadow: 0 10px 24px rgba(61, 90, 254, 0.18);
}

.auth-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 18px;
  font-size: var(--fs-md);
  color: var(--text-2);
  cursor: pointer;
}

.auth-hint {
  margin: 16px 0 0;
  font-size: var(--fs-sm);
  color: var(--text-3);
  text-align: center;
}

.user-av {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--blue-50);
  color: var(--af-primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-md);
  font-weight: 600;
  flex-shrink: 0;
}

.sidebar .user-av {
  background: var(--sidebar-av-bg);
  color: var(--sidebar-accent-soft);
}

.user-name {
  font-size: var(--fs-base);
  font-weight: 500;
  white-space: nowrap;
}

.user-role {
  font-size: var(--fs-sm);
  color: var(--text-3);
  white-space: nowrap;
}

.sidebar .user-name {
  color: #fff;
}

.sidebar .user-role {
  color: var(--af-text-faint);
}

.area-badge {
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  padding: 2px var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--surface-hover);
  color: var(--text-2);
  margin-left: 6px;
}

.sidebar .area-badge {
  background: var(--sidebar-badge-bg);
  color: var(--sidebar-accent-soft);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: var(--z-overlay);
}

.main-wrap {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition-fast);
}

.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0 var(--space-6);
  position: sticky;
  top: 0;
  z-index: var(--z-topbar);
  flex-shrink: 0;
}

.topbar-brand {
  display: none;
  align-items: center;
  gap: 10px;
}

.topbar-brand-name {
  font-size: var(--fs-lg);
  font-weight: 600;
}

.hamburger {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--border-md) 78%, #fff 22%);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 248, 255, 0.96));
  box-shadow:
    0 6px 16px rgba(18, 23, 43, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--af-primary);
  font-size: var(--fs-4xl);
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-fast),
    border-color var(--transition-fast),
    background var(--transition-fast);
}

.hamburger:hover {
  border-color: color-mix(in srgb, var(--af-primary) 38%, var(--border-md) 62%);
  box-shadow:
    0 10px 22px rgba(61, 90, 254, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.92);
  transform: translateY(-1px);
}

.hamburger:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 4px rgba(61, 90, 254, 0.14),
    0 10px 22px rgba(61, 90, 254, 0.12);
}

.topbar-search {
  flex: 1;
  max-width: 400px;
  position: relative;
}

.topbar-search input {
  width: 100%;
  padding: var(--space-2) var(--space-3) var(--space-2) 36px;
  border: 0.5px solid var(--border-md);
  border-radius: var(--radius-md);
  font-size: var(--fs-base);
  color: var(--text);
  background: var(--surface-soft);
  outline: none;
  font-family: var(--font);
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.topbar-search input:focus {
  border-color: var(--af-primary);
  background: #fff;
  box-shadow: var(--focus-ring);
}

.topbar-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  font-size: 16px;
  pointer-events: none;
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  flex-shrink: 0;
}

.topbar-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: 0.5px solid var(--border-md);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-2);
  position: relative;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.topbar-pos-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  border: 0.5px solid rgba(61, 90, 254, 0.35);
  background: rgba(61, 90, 254, 0.08);
  color: var(--af-primary);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.topbar-pos-btn i {
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.topbar-pos-btn:hover {
  background: var(--af-primary);
  border-color: var(--af-primary);
  color: #fff;
}

@media (max-width: 720px) {
  .topbar-pos-btn span {
    display: none;
  }

  .topbar-pos-btn {
    width: 36px;
    padding: 0;
    justify-content: center;
  }
}

.topbar-icon-btn:hover,
.topbar-icon-btn.is-active,
.settings-menu-trigger.show {
  background: var(--surface-hover);
  color: var(--af-primary);
  border-color: rgba(61, 90, 254, 0.35);
}

.notif-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--af-rose);
  border: 1.5px solid #fff;
}

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

.notif-menu {
  width: min(360px, calc(100vw - 24px));
  padding: 0;
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 40px rgba(18, 20, 43, 0.12);
  overflow: hidden;
  margin-top: 8px !important;
}

.notif-menu-hd {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 0.5px solid var(--border);
  background: var(--surface);
}

.notif-menu-hd a {
  color: var(--af-primary);
  text-decoration: none;
  font-weight: 500;
}

.notif-menu-list {
  max-height: 360px;
  overflow-y: auto;
}

.notif-empty {
  padding: 24px 16px;
  text-align: center;
  font-size: var(--fs-sm);
}

.notif-item {
  display: flex;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-bottom: 0.5px solid var(--border);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.notif-item:hover {
  background: var(--surface-hover);
}

.notif-item.is-unread {
  background: rgba(61, 90, 254, 0.04);
}

.notif-item-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: rgba(61, 90, 254, 0.08);
  color: var(--af-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}

.notif-item-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.notif-item-title {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-1);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.notif-item-meta {
  font-size: 11px;
  color: var(--text-3);
}

.notif-menu-ft {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 0.5px solid var(--border);
  background: var(--surface);
}

.notif-menu-ft a {
  flex: 1;
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  padding: 8px 6px;
  border-radius: var(--radius-md);
  border: 0.5px solid var(--border-md);
  color: var(--text-2);
  text-decoration: none;
}

.notif-menu-ft a:hover {
  border-color: rgba(61, 90, 254, 0.35);
  color: var(--af-primary);
  background: rgba(61, 90, 254, 0.06);
}

.notif-row-unread .td-main {
  font-weight: 600;
}

.notif-unread-pip {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--af-primary);
}

.text-truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.settings-menu {
  position: relative;
}

.settings-mega {
  width: min(440px, calc(100vw - 24px));
  padding: 0;
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 40px rgba(18, 20, 43, 0.12);
  overflow: hidden;
  margin-top: 8px !important;
}

.settings-mega-hd {
  padding: 12px 16px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-2);
  border-bottom: 0.5px solid var(--border);
  background: var(--surface-soft);
}

.settings-mega-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 0;
}

.settings-mega-col {
  padding: 10px;
}

.settings-mega-col+.settings-mega-col {
  border-left: 0.5px solid var(--border);
}

.settings-mega-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 4px 8px 8px;
}

.settings-mega-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-md);
  color: var(--text);
  text-decoration: none;
  transition: background var(--transition-fast);
}

.settings-mega-item:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.settings-mega-item.active {
  background: rgba(61, 90, 254, 0.08);
}

.settings-mega-item>i {
  width: 20px;
  font-size: 18px;
  color: var(--af-primary);
  margin-top: 1px;
  flex-shrink: 0;
}

.settings-mega-item strong {
  display: block;
  font-size: var(--fs-base);
  font-weight: 600;
  line-height: 1.25;
}

.settings-mega-item small {
  display: block;
  margin-top: 2px;
  font-size: var(--fs-sm);
  color: var(--text-3);
  line-height: 1.35;
}

@media (max-width: 576px) {
  .settings-mega-grid {
    grid-template-columns: 1fr;
  }

  .settings-mega-col+.settings-mega-col {
    border-left: 0;
    border-top: 0.5px solid var(--border);
  }
}

.topbar-divider {
  width: 1px;
  height: 24px;
  background: var(--border-md);
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.topbar-user:hover {
  background: var(--surface-hover);
}

.topbar-user .user-av {
  width: 32px;
  height: 32px;
  font-size: var(--fs-md);
}

.topbar-user-name {
  font-size: var(--fs-base);
  font-weight: 500;
}

.topbar-user-role {
  font-size: var(--fs-sm);
  color: var(--text-3);
}

.page-content {
  flex: 1;
  padding: var(--space-6);
  min-width: 0;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
  gap: var(--space-3);
}

.page-title {
  font-size: var(--fs-5xl);
  font-weight: 600;
}

.page-sub {
  font-size: var(--fs-base);
  color: var(--text-2);
  margin-top: 3px;
}

.page-sub-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.page-sub-inline>span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.page-sub-inline>span:not(:last-child)::after {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: var(--text-3);
  margin-left: 6px;
}

.page-sub-inline .page-sub-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.page-sub-inline .page-sub-link:hover {
  text-decoration: underline;
}

.page-header-actions,
.page-back-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.page-back-copy {
  min-width: 0;
  flex: 1;
}

/* ---------------------------------------------------------------------------
   4. Buttons — Bootstrap .btn themed; legacy .btn-* kept as aliases
   --------------------------------------------------------------------------- */
.btn {
  --bs-btn-font-size: var(--fs-base);
  --bs-btn-padding-y: 0.5rem;
  --bs-btn-padding-x: 1rem;
  --bs-btn-border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 500;
}

.btn-sm,
.btn-icon-sm {
  --bs-btn-padding-y: 0.4rem;
  --bs-btn-padding-x: 0.65rem;
  --bs-btn-font-size: var(--fs-base);
}

.btn-xs {
  padding: 5px 10px;
  font-size: var(--fs-md);
  border-radius: var(--radius-md);
}

/* Legacy aliases (no .btn required) — same look as BS primary/outline */
.btn-primary:not(.btn),
a.btn-primary:not(.btn) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: var(--space-2) var(--space-4);
  border: none;
  border-radius: var(--radius-md);
  background: var(--bs-primary);
  color: #fff;
  font-size: var(--fs-base);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--transition-fast), box-shadow var(--transition-fast);
}

.btn-primary:not(.btn):hover,
a.btn-primary:not(.btn):hover {
  background: var(--af-primary-dark);
  box-shadow: var(--primary-glow);
}

.btn-secondary:not(.btn),
a.btn-secondary:not(.btn) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border: 0.5px solid var(--border-md);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-base);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.btn-secondary:not(.btn):hover,
a.btn-secondary:not(.btn):hover {
  background: var(--surface-hover);
}

.btn-icon-sm:not(.btn) {
  padding: 7px 10px;
}

.btn-icon-ghost {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-2);
  padding: 4px;
  border-radius: var(--radius-sm);
}

/* ---------------------------------------------------------------------------
   5. Stats & trends
   --------------------------------------------------------------------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 0.5px solid var(--border);
  padding: 18px var(--space-5);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

a.product-stat {
  text-decoration: none;
  color: inherit;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

a.product-stat:hover {
  border-color: color-mix(in srgb, var(--af-primary) 40%, var(--border));
  box-shadow: var(--shadow-sm);
}

a.product-stat.is-active {
  border-color: var(--af-primary);
  box-shadow: inset 0 0 0 1px var(--af-primary);
  background: color-mix(in srgb, var(--af-primary) 4%, var(--surface));
}

.product-stats .stat-val-money {
  font-size: var(--fs-3xl);
  letter-spacing: -0.02em;
}

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.stat-icon .ti {
  font-size: 18px;
  color: inherit;
}

.stat-icon-blue {
  background: var(--blue-50);
  color: var(--af-primary);
}

.stat-icon-teal {
  background: var(--teal-50);
  color: var(--af-teal);
}

.stat-icon-amber {
  background: var(--amber-50);
  color: var(--af-amber);
}

.stat-icon-red {
  background: var(--red-50);
  color: var(--af-danger);
}

.stat-icon-green {
  background: var(--green-50);
  color: var(--af-success);
}

.stat-icon-green-soft {
  background: var(--green-soft-alt);
  color: var(--green-600);
}

.stat-icon-purple {
  background: var(--purple-50);
  color: var(--purple-400);
}

.stat-lbl {
  font-size: var(--fs-md);
  color: var(--text-2);
  font-weight: 500;
}

.stat-val {
  font-size: var(--fs-6xl);
  font-weight: 600;
  line-height: 1;
}

.stat-val-amber {
  color: var(--amber-800);
}

.stat-val-danger,
.stat-val-red {
  color: var(--af-danger);
}

.stat-val-red {
  color: var(--red-800);
}

.stat-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-md);
}

.stat-more {
  color: var(--text-3);
  font-size: 16px;
  cursor: pointer;
}

.mini-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
}

.mini-bars-mt {
  margin-top: var(--space-2);
}

.mini-bar {
  width: 5px;
  border-radius: 2px;
}

.mini-bar-h10 {
  height: 10px;
}

.mini-bar-h14 {
  height: 14px;
}

.mini-bar-h16 {
  height: 16px;
}

.mini-bar-h18 {
  height: 18px;
}

.mini-bar-h20 {
  height: 20px;
}

.mini-bar-h22 {
  height: 22px;
}

.mini-bar-h24 {
  height: 24px;
}

.mini-bar-blue-soft {
  background: var(--blue-soft);
}

.mini-bar-blue {
  background: var(--af-primary);
}

.mini-bar-teal-soft {
  background: var(--teal-soft);
}

.mini-bar-teal {
  background: var(--af-teal);
}

.mini-bar-green-soft {
  background: var(--green-100);
}

.mini-bar-green {
  background: var(--af-success);
}

.mini-bar-amber-soft {
  background: var(--amber-soft);
}

.mini-bar-amber {
  background: var(--af-amber);
}

.trend-up {
  color: var(--af-success);
}

.trend-warn {
  color: var(--amber-800);
}

.trend-danger {
  color: var(--red-800);
}

.trend-info {
  color: var(--blue-800);
}


/* Bootstrap card bridge — optional .card surfaces match .panel */
.card {
  --bs-card-border-color: var(--border);
  --bs-card-border-radius: var(--radius-lg);
  --bs-card-bg: var(--surface);
  box-shadow: var(--shadow-sm);
}

/* ---------------------------------------------------------------------------
   6. Panels, empty states, KPI
   --------------------------------------------------------------------------- */
.panel,
.form-section,
.pf-section,
.analytics-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 0.5px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.panel-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.panel-title {
  font-size: var(--fs-xl);
  font-weight: 600;
}

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

.panel-body-sm {
  font-size: var(--fs-base);
}

.panel-footer {
  padding: var(--space-3) var(--space-5);
  border-top: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
}

.panel-spaced {
  margin-bottom: var(--space-4);
}

.panel-stack {
  margin-top: var(--space-4);
}

.form-section {
  margin-bottom: var(--space-4);
}

.form-section .sec-hd {
  padding: 14px var(--space-5);
  border-bottom: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--fs-lg);
  font-weight: 600;
}

.form-section .sec-bd {
  padding: var(--space-5);
}


.empty-state {
  text-align: center;
  padding: 48px var(--space-5);
  color: var(--text-2);
}

.empty-state i {
  font-size: 36px;
  margin-bottom: var(--space-3);
  display: block;
  color: var(--text-3);
}

.empty-state-pad {
  padding: var(--space-6);
}


.create-layout {
  display: grid;
  grid-template-columns: 1fr var(--panel-aside);
  gap: var(--space-5);
  align-items: start;
}

.product-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 6fr) minmax(0, 4fr);
  gap: var(--space-5);
  align-items: start;
}

.product-detail-layout .data-table th,
.product-detail-layout .data-table td {
  white-space: nowrap;
}

.product-detail-layout .data-table td .td-main,
.product-detail-layout .data-table td.td-sub {
  white-space: normal;
  word-break: break-word;
}

.order-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 1fr);
  gap: var(--space-5);
  align-items: start;
}

.detail-main,
.detail-aside {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}

.detail-aside .form-section {
  margin-bottom: 0;
}

.sec-hd-leading {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--blue-50);
  color: var(--af-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 15px;
}

.sec-hd-title {
  flex: 1;
  min-width: 0;
}

.sec-hd-actions {
  flex-shrink: 0;
  font-size: var(--fs-sm);
  font-weight: 500;
}

.sec-hd-actions a {
  color: var(--af-primary);
  text-decoration: none;
}

.sec-hd-actions a:hover {
  color: var(--af-primary-dark);
}

.detail-fields-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 20px;
}

.detail-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.detail-field-wide {
  grid-column: 1 / -1;
}

.detail-field-lbl {
  font-size: var(--fs-sm);
  color: var(--text-3);
  line-height: 1.3;
}

.detail-field-val {
  font-size: var(--fs-base);
  font-weight: 500;
  color: var(--text);
  line-height: 1.45;
  word-break: break-word;
}

.detail-field-val a {
  color: var(--af-primary);
  text-decoration: none;
}

.detail-field-val a:hover {
  color: var(--af-primary-dark);
  text-decoration: underline;
}

.detail-inline-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.detail-product-list {
  display: flex;
  flex-direction: column;
}

.detail-totals-box {
  margin-top: var(--space-4);
  padding: 14px 16px;
  border: 1px dashed color-mix(in srgb, var(--af-primary) 28%, var(--border));
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--blue-50) 55%, transparent);
}

.detail-total-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 4px 0;
  font-size: var(--fs-base);
  color: var(--text-2);
}

.detail-total-line+.detail-total-line {
  margin-top: 2px;
}

.detail-total-line strong,
.detail-total-line .detail-total-amount {
  font-weight: 600;
  color: var(--text);
}

.detail-total-grand {
  margin-top: 8px;
  padding-top: 10px;
  border-top: 0.5px solid color-mix(in srgb, var(--af-primary) 18%, var(--border));
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--af-primary-dark);
}

.detail-total-grand .detail-total-amount {
  font-size: var(--fs-3xl);
  font-weight: 700;
  color: var(--af-primary-dark);
  line-height: 1.1;
}

.detail-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.detail-timeline-item {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 0 12px;
  position: relative;
}

.detail-timeline-item:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 18px;
  bottom: -4px;
  width: 2px;
  background: var(--border);
}

.detail-timeline-item.is-done:not(:last-child)::before {
  background: color-mix(in srgb, var(--af-primary) 35%, var(--border));
}

.detail-timeline-dot {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid var(--border-md);
  background: var(--surface);
  margin-top: 2px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.detail-timeline-item.is-done .detail-timeline-dot {
  border-color: var(--af-primary);
  background: var(--af-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--af-primary) 14%, transparent);
}

.detail-timeline-item.is-current .detail-timeline-dot {
  border-color: var(--af-primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--af-primary) 18%, transparent);
}

.detail-timeline-body {
  padding-bottom: 14px;
  min-width: 0;
}

.detail-timeline-item:last-child .detail-timeline-body {
  padding-bottom: 0;
}

.detail-timeline-label {
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.detail-timeline-item:not(.is-done):not(.is-current) .detail-timeline-label {
  color: var(--text-3);
  font-weight: 500;
}

.detail-timeline-date {
  font-size: var(--fs-sm);
  color: var(--text-3);
  margin-top: 2px;
}

.detail-card-footer {
  padding: 12px var(--space-5);
  border-top: 0.5px solid var(--border);
}

.detail-actions-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-actions-stack form {
  display: block;
}

.detail-action-btn {
  width: 100%;
  height: 40px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  border: 0.5px solid var(--border-md);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-base);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: border-color var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
  box-sizing: border-box;
}

.detail-action-btn i {
  font-size: 16px;
  flex-shrink: 0;
}

.detail-action-btn:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--af-primary) 35%, var(--border));
  background: var(--surface-hover);
  color: var(--af-primary);
}

.detail-action-btn.is-current,
.detail-action-btn:disabled {
  background: var(--af-primary);
  border-color: var(--af-primary);
  color: #fff;
  cursor: default;
  opacity: 1;
}

.detail-action-btn.is-danger {
  color: var(--danger, #dc3545);
}

.detail-action-btn.is-danger:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--danger, #dc3545) 45%, var(--border));
  background: color-mix(in srgb, var(--danger, #dc3545) 8%, var(--surface));
  color: var(--danger, #dc3545);
}

.detail-action-btn.is-success {
  color: var(--success, #198754);
}

.detail-action-btn.is-success:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--success, #198754) 45%, var(--border));
  background: color-mix(in srgb, var(--success, #198754) 8%, var(--surface));
  color: var(--success, #198754);
}

.detail-action-form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.detail-action-form-row .form-control {
  flex: 1 1 140px;
  min-width: 0;
  height: 40px;
  min-height: 40px;
}

.detail-action-form-row .detail-action-btn {
  flex: 0 0 auto;
  width: auto;
  min-width: 110px;
}

.detail-meta-note {
  margin: 0;
  padding-top: 10px;
  font-size: var(--fs-sm);
  color: var(--text-3);
  line-height: 1.45;
}

.detail-empty-hint {
  font-size: var(--fs-base);
  color: var(--text-3);
  padding: 4px 0;
}

.dash-two-col {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: var(--space-5);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr var(--panel-aside);
  gap: var(--space-5);
  margin-bottom: var(--space-5);
}

/* ---------------------------------------------------------------------------
   7. Tables
   --------------------------------------------------------------------------- */

.data-table,
.variant-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-base);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.variant-table {
  min-width: 640px;
}

.data-table th,
.variant-table th {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-2);
  text-align: left;
  border-bottom: 0.5px solid var(--border);
  background: var(--surface-muted);
  white-space: nowrap;
  text-transform: uppercase;
}

.data-table th {
  padding: 10px 14px;
}

.data-table th:first-child {
  border-radius: var(--radius-md) 0 0 0;
}

.data-table th:last-child {
  border-radius: 0 var(--radius-md) 0 0;
}

.data-table td {
  padding: var(--space-3) 14px;
  border-bottom: 0.5px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr {
  transition: background 0.1s;
}

.data-table tbody tr:hover {
  background: var(--surface-muted);
}

.row-clickable {
  cursor: pointer;
}

.data-table .check-cell {
  width: 40px;
}

.row-check {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 0.5px solid var(--border-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
}

.row-check.checked {
  background: var(--af-primary);
  border-color: var(--af-primary);
}

.td-main {
  font-weight: 500;
  font-size: var(--fs-base);
}

.td-sub {
  font-size: var(--fs-sm);
  color: var(--text-2);
  margin-top: 2px;
}

.td-actions,
.table-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.td-actions form,
.table-actions form {
  display: inline-flex;
  margin: 0;
}

.td-action-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  border: 0.5px solid color-mix(in srgb, var(--af-primary) 35%, var(--border));
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--af-primary);
  text-decoration: none;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}

.td-action-btn:hover {
  background: color-mix(in srgb, var(--af-primary) 8%, var(--surface));
  border-color: var(--af-primary);
  color: var(--af-primary-dark);
}

.td-action-btn .ti {
  font-size: 14px;
}

/* Nút icon nhấn mạnh — dùng cho hành động chính trên mỗi dòng */
.td-action-btn.is-solid {
  background: var(--af-primary);
  border-color: var(--af-primary);
  color: #fff;
}

.td-action-btn.is-solid:hover {
  background: var(--af-primary-dark);
  border-color: var(--af-primary-dark);
  color: #fff;
}

.data-table th.th-actions {
  text-align: right;
}

.btn-table-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  min-width: 0;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  border-radius: var(--radius-md);
}

.btn-table-action .ti {
  font-size: 14px;
  flex-shrink: 0;
}

.btn-table-action.is-danger,
.btn-table-action.btn-outline-danger {
  color: var(--danger, #dc3545);
  border-color: color-mix(in srgb, var(--danger, #dc3545) 40%, var(--border));
}

.btn-table-action.is-danger:hover,
.btn-table-action.btn-outline-danger:hover {
  color: var(--danger, #dc3545);
  background: color-mix(in srgb, var(--danger, #dc3545) 8%, var(--surface));
  border-color: var(--danger, #dc3545);
}

.variant-table {
  margin-top: 10px;
}

.variant-table th {
  padding: 6px 10px;
}

.variant-table td {
  padding: 7px 10px;
  border-bottom: 0.5px solid var(--border);
  vertical-align: middle;
}

.variant-table tr:last-child td {
  border-bottom: none;
}

.variant-table .inp {
  padding: 5px var(--space-2);
  font-size: var(--fs-md);
}

.product-thumb,
.pl-thumb {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--surface-hover);
  border: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.product-thumb {
  font-size: 18px;
  color: var(--text-3);
}

.product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-sku-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text);
  padding: 2px 7px;
  white-space: nowrap;
}

.avatar {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  flex-shrink: 0;
}

.avatar-sm {
  width: 32px;
  height: 32px;
  font-size: var(--fs-sm);
  background: var(--blue-50);
  color: var(--af-primary-dark);
}

.avatar-md {
  width: 36px;
  height: 36px;
  font-size: var(--fs-md);
  background: var(--blue-50);
  color: var(--af-primary-dark);
}

.avatar-lg {
  width: 48px;
  height: 48px;
  font-size: 16px;
  background: var(--blue-50);
  color: var(--blue-800);
}

.cell-with-avatar {
  display: flex;
  align-items: center;
  gap: 9px;
}

.cell-with-avatar-md {
  display: flex;
  align-items: center;
  gap: 10px;
}

.entity-thumb {
  flex-shrink: 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface-2, var(--blue-50));
  border: 0.5px solid var(--border);
}

.entity-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.entity-thumb-md {
  width: 36px;
  height: 36px;
}

.entity-thumb-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: var(--fs-md);
  color: var(--af-primary-dark);
  background: var(--blue-50);
}

.entity-image-field {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.entity-image-preview {
  width: 88px;
  height: 88px;
  border-radius: var(--radius-lg);
  border: 0.5px solid var(--border-md);
  background: var(--surface-2, var(--bg));
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.entity-image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.entity-image-preview.is-empty {
  color: var(--text-3);
  font-size: 28px;
}

.entity-image-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.entity-image-pick {
  cursor: pointer;
  margin: 0;
}

.field-hint {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--text-3);
}

.list-row-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 0.5px solid var(--border);
  color: inherit;
  min-width: 0;
}

.list-row-link .flex-fill,
.list-row-link>div:not(.avatar):not(.badge) {
  min-width: 0;
  flex: 1;
}

.list-row-link .td-main,
.list-row-link .td-sub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------------------------------------------------------------------------
   8. Badges
   --------------------------------------------------------------------------- */
/* Status badges — modifiers only; leaves Bootstrap .badge / .text-bg-* intact */
.badge.b-pending,
.badge.b-draft,
.badge.b-low,
.badge.b-processing,
.badge.b-shipped,
.badge.b-delivered,
.badge.b-cancelled,
.badge.b-oos,
.badge.b-refund,
.badge.b-active,
.badge.seg-vip,
.badge.seg-new,
.badge.seg-loyal,
.badge.seg-atrisk,
.badge.seg-inactive,
.badge.seg-pos,
.badge.badge-tag,
.badge.badge-option {
  font-size: var(--fs-sm);
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-weight: 500;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.badge.b-pending,
.badge.b-draft,
.badge.b-low,
.badge.seg-vip {
  background: var(--amber-50);
  color: var(--amber-800);
}

.badge.b-processing,
.badge.seg-new {
  background: var(--blue-50);
  color: var(--blue-800);
}

.badge.b-shipped {
  background: var(--purple-50);
  color: var(--purple-800);
}

.badge.b-delivered {
  background: var(--teal-50);
  color: var(--teal-800);
}

.badge.b-cancelled,
.badge.b-oos,
.badge.seg-atrisk {
  background: var(--red-50);
  color: var(--red-800);
}

.badge.b-refund {
  background: var(--pink-50);
  color: var(--pink-800);
}

.badge.b-active,
.badge.seg-loyal {
  background: var(--green-50);
  color: var(--green-800);
}

.badge.seg-inactive {
  background: var(--gray-50);
  color: var(--gray-800);
}

.badge.seg-pos {
  background: var(--blue-50);
  color: var(--blue-800);
}

.badge.badge-tag {
  background: var(--surface-hover);
  color: var(--text-2);
  margin-right: var(--space-1);
}

.badge.badge-option {
  background: var(--surface-hover);
  color: var(--text);
  border: 0.5px solid var(--border-md);
}

/* ---------------------------------------------------------------------------
   9. Filters & pagination
   --------------------------------------------------------------------------- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

.filter-bar-fill {
  margin: 0;
  flex: 1;
  gap: 10px;
}

.filter-bar-fill-sm {
  margin: 0;
  flex: 1;
}

.filter-bar .search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 360px;
}

.search-wrap-sm {
  max-width: 280px;
}

.filter-bar .search-wrap input {
  width: 100%;
  padding: var(--space-2) var(--space-3) var(--space-2) 36px;
  border: 0.5px solid var(--border-md);
  border-radius: var(--radius-md);
  font-size: var(--fs-base);
  color: var(--text);
  background: var(--surface);
  outline: none;
  font-family: var(--font);
}

.filter-bar .search-wrap input:focus {
  border-color: var(--af-primary);
  box-shadow: var(--focus-ring);
}

.filter-bar .si,
.si.ti {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  font-size: 16px;
  pointer-events: none;
}

.filter-chips {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.f-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px var(--space-3);
  border-radius: var(--radius-pill);
  border: 0.5px solid var(--border-md);
  background: var(--surface);
  font-size: var(--fs-md);
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
  white-space: nowrap;
}

.f-chip:hover {
  background: var(--surface-hover);
}

.f-chip.active {
  background: var(--blue-50);
  border-color: var(--af-primary);
  color: var(--af-primary-dark);
  font-weight: 500;
}

.sort-sel {
  font-size: var(--fs-md);
  color: var(--text);
  border: 0.5px solid var(--border-md);
  border-radius: var(--radius-md);
  padding: 6px 28px 6px 10px;
  background: var(--surface);
  appearance: none;
  background-image: var(--select-chevron);
  background-repeat: no-repeat;
  background-position: right 8px center;
  cursor: pointer;
  outline: none;
  font-family: var(--font);
}

.sort-sel:focus-visible {
  border-color: var(--af-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--af-primary) 14%, transparent);
}

.sort-sel-sm {
  font-size: 13px;
  min-height: 32px;
  padding: 0 26px 0 9px;
  background-position: right 7px center;
  max-width: 150px;
  text-overflow: ellipsis;
}

.einv-publish {
  flex-wrap: nowrap;
}

.einv-done {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #067647;
  background: #ecfdf3;
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}

.einv-code {
  font-size: 12px;
  color: var(--text);
  background: var(--surface-2, #f2f4f7);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 7px;
  white-space: nowrap;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: nowrap;
  padding: 12px var(--space-5);
  border-top: 0.5px solid var(--border);
}

.pager-info {
  font-size: var(--fs-md);
  color: var(--text-2);
  flex-shrink: 0;
}

.pager-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  margin-left: auto;
  justify-content: flex-end;
}

.pager-btn {
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  border: 0.5px solid var(--border-md);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-md);
  font-weight: 500;
  text-decoration: none;
}

.pager-btn:hover:not(.disabled):not(.active) {
  background: var(--surface-hover);
  border-color: var(--border);
}

.pager-btn.active {
  background: var(--af-primary);
  border-color: var(--af-primary);
  color: #fff;
}

.pager-btn.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.pager-ellipsis {
  padding: 0 4px;
  color: var(--text-3);
}


/* ---------------------------------------------------------------------------
   10. Forms & details
   --------------------------------------------------------------------------- */
.inp,
.form-control,
.form-select {
  width: 100%;
  padding: 9px var(--space-3);
  border: 0.5px solid var(--border-md);
  border-radius: var(--radius-md);
  font-size: var(--fs-base);
  color: var(--text);
  background: var(--surface);
  outline: none;
  font-family: var(--font);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.inp:focus,
.form-control:focus,
.form-select:focus {
  border-color: var(--af-primary);
  box-shadow: var(--focus-ring);
}

textarea.inp,
textarea.form-control {
  resize: vertical;
  min-height: 90px;
  line-height: 1.6;
}

select.inp,
.form-select {
  appearance: none;
  background-image: var(--select-chevron);
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

.lbl,
.form-label {
  font-size: var(--fs-md);
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.lbl-spaced {
  margin-bottom: 10px;
}

.lbl-row {
  margin-bottom: var(--space-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
}

.field {
  margin-bottom: var(--space-4);
}

.field:last-child {
  margin-bottom: 0;
}

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

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.form-narrow {
  max-width: var(--content-narrow);
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: var(--space-4);
}

.form-inline {
  display: inline;
}

.inp-prefix {
  position: relative;
}

.inp-prefix .prefix-sym {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  font-size: var(--fs-base);
  color: var(--text-2);
  pointer-events: none;
}

.inp-prefix .inp {
  padding-left: 24px;
}

.inp-min-110 {
  min-width: 110px;
}

.inp-w-70 {
  width: 70px;
}

.inp-w-80 {
  width: 80px;
}

.inp-w-90 {
  width: 90px;
}

.inp-w-100 {
  width: 100px;
}


.toggle {
  position: relative;
  width: 38px;
  height: 22px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-track {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-pill);
  background: var(--border-md);
  transition: background 0.2s;
  cursor: pointer;
}

.toggle input:checked+.toggle-track {
  background: var(--af-primary);
}

.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: left 0.2s;
  pointer-events: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle input:checked~.toggle-thumb {
  left: 19px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) 0;
  border-bottom: 0.5px solid var(--border);
}

.toggle-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.toggle-label {
  font-size: var(--fs-base);
  font-weight: 500;
}

.toggle-sub {
  font-size: var(--fs-md);
  color: var(--text-2);
  margin-top: 2px;
}

.sec-title {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-2);
  margin: var(--space-4) 0 var(--space-2);
  text-transform: uppercase;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: var(--space-2) 0;
  border-bottom: 0.5px solid var(--border);
  font-size: var(--fs-base);
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-row-spaced {
  margin-top: var(--space-3);
}

.detail-lbl {
  color: var(--text-2);
}

.detail-val {
  font-weight: 500;
  text-align: right;
  max-width: 55%;
  word-break: break-word;
}

.detail-total-lbl {
  font-weight: 600;
  font-size: var(--fs-lg);
}

.detail-total-val {
  font-size: var(--fs-3xl);
  font-weight: 600;
}

.product-line {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: var(--space-2) 0;
  border-bottom: 0.5px solid var(--border);
}

.product-line:last-child {
  border-bottom: none;
}

.pl-name {
  font-size: var(--fs-base);
  font-weight: 500;
}

.pl-var {
  font-size: var(--fs-sm);
  color: var(--text-2);
  margin-top: 1px;
}

.pl-price {
  font-size: var(--fs-base);
  font-weight: 500;
  margin-left: auto;
  white-space: nowrap;
}

.option-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}


.tl-item {
  display: flex;
  gap: 10px;
  padding: var(--space-2) 0;
  position: relative;
}

.tl-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 3px;
  border: 2px solid #fff;
  z-index: 1;
}

.tl-line {
  position: absolute;
  left: 4px;
  top: 18px;
  width: 2px;
  bottom: -8px;
  background: var(--border);
}

.tl-item:last-child .tl-line {
  display: none;
}

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

.tl-time {
  font-size: var(--fs-sm);
  color: var(--text-2);
  margin-top: 2px;
}


/* ---------------------------------------------------------------------------
   11. Integrations
   --------------------------------------------------------------------------- */
.integ-section {
  margin-bottom: 28px;
}

.integ-section-head {
  margin-bottom: 12px;
}

.integ-section-title {
  font-size: var(--fs-lg);
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--text);
}

.integ-section-desc {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--text-2);
}

.integ-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.integ-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
  min-height: 100%;
}

.integ-card:hover {
  border-color: color-mix(in srgb, var(--af-primary, #3d5afe) 35%, var(--border));
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.06);
  transform: translateY(-1px);
}

.integ-card-active {
  border-color: color-mix(in srgb, var(--af-primary, #3d5afe) 45%, var(--border));
  background: linear-gradient(180deg, color-mix(in srgb, var(--af-primary, #3d5afe) 5%, #fff) 0%, var(--surface) 48%);
}

.integ-card-soon {
  opacity: 0.72;
}

.integ-card-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.integ-card-identity {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.integ-card-name {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  color: var(--text);
  line-height: 1.25;
}

.integ-card-desc {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--text-2);
  line-height: 1.45;
  min-height: 2.9em;
}

.integ-card-meta {
  margin-top: auto;
  padding-top: 4px;
  border-top: 1px dashed var(--border);
}

.integ-meta-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  padding-top: 10px;
}

.integ-meta-label {
  color: var(--text-2);
}

.integ-meta-value {
  color: var(--text);
  font-weight: 500;
  text-align: right;
}

.integ-meta-value.muted {
  color: var(--text-3);
  font-weight: 400;
}

.integ-card-error {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #b54708;
  background: #fffaeb;
  border-radius: 999px;
  padding: 4px 10px;
  width: fit-content;
}

.integ-card-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.integ-card-action:hover {
  border-color: var(--af-primary, #3d5afe);
  color: var(--af-primary, #3d5afe);
  background: color-mix(in srgb, var(--af-primary, #3d5afe) 6%, #fff);
}

.integ-card-actions {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.integ-card-actions>.integ-card-action {
  flex: 1 1 0;
}

.integ-card-action-form {
  flex: 0 0 auto;
  display: flex;
}

.integ-card-action-form .integ-card-action {
  width: auto;
  padding: 0 14px;
  cursor: pointer;
}

.integ-card-action-primary {
  background: var(--af-primary, #3d5afe);
  border-color: var(--af-primary, #3d5afe);
  color: #fff;
}

.integ-card-action-primary:hover {
  background: var(--af-primary-dark, #2a3eb1);
  border-color: transparent;
  color: #fff;
}

.integ-status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  line-height: 1.2;
  white-space: nowrap;
}

.integ-status-on {
  background: #ecfdf3;
  color: #067647;
}

.integ-status-off {
  background: #fffaeb;
  color: #b54708;
}

.integ-status-none {
  background: #f2f4f7;
  color: #475467;
}

.integ-status-soon {
  background: #ffe8ee;
  color: #c2185b;
}

.partner-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.partner-logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.partner-logo-sm {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.partner-logo-md {
  width: 44px;
  height: 44px;
  border-radius: 11px;
}

.partner-logo-lg {
  width: 52px;
  height: 52px;
  border-radius: 14px;
}

.integ-page-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.integ-info-box {
  font-size: var(--fs-sm);
  color: var(--text-2);
  background: color-mix(in srgb, var(--af-primary, #3d5afe) 6%, #fff);
  border: 1px solid color-mix(in srgb, var(--af-primary, #3d5afe) 16%, var(--border));
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: var(--space-4);
  line-height: 1.45;
}

.integ-stat-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.integ-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.integ-stat-label {
  color: var(--text-2);
}

.integ-stat-value {
  color: var(--text);
  font-weight: 550;
  text-align: right;
}

.integ-lead,
.integ-steps,
.integ-meta {
  font-size: var(--fs-base);
  color: var(--text-2);
}

.integ-lead {
  margin-bottom: var(--space-4);
}

.integ-steps {
  padding-left: 18px;
  margin-bottom: var(--space-4);
}

.integ-steps li {
  margin-bottom: var(--space-1);
}

.integ-sync-stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  font-size: var(--fs-base);
}

.integ-sync-errors {
  font-size: var(--fs-md);
  white-space: pre-wrap;
  overflow-x: auto;
  max-width: 100%;
  word-break: break-word;
  color: var(--af-danger);
  margin: var(--space-2) 0 0;
}

@media (max-width: 1100px) {
  .integ-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .integ-grid {
    grid-template-columns: 1fr;
  }
}

.alert.alert-compact {
  font-size: var(--fs-md);
  padding: 0.65rem 0.85rem;
}

.alert.alert-dismissible {
  position: relative;
  padding-right: 2.75rem;
}

.alert-close {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  opacity: 0.55;
  cursor: pointer;
  line-height: 1;
  font-size: 1rem;
  padding: 0;
}

.alert-close:hover {
  opacity: 1;
  background: rgba(15, 23, 42, 0.06);
}

.alert-close:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 1px;
}

.alert.alert-compact.alert-dismissible {
  padding-right: 2.4rem;
}

.alert.alert-compact .alert-close {
  top: 0.35rem;
  right: 0.35rem;
  width: 24px;
  height: 24px;
  font-size: 0.9rem;
}

/* ---------------------------------------------------------------------------
   12. Product form
   --------------------------------------------------------------------------- */
.pf-section {
  margin-bottom: var(--space-4);
}

.pf-section:last-child {
  margin-bottom: 0;
}

.pf-sec-hd {
  padding: 14px var(--space-5);
  border-bottom: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.pf-sec-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.pf-sec-icon .ti {
  font-size: 15px;
  color: inherit;
}

.pf-sec-icon-success {
  background: var(--green-50);
  color: var(--af-success);
}

.pf-sec-icon-blue {
  background: var(--blue-50);
  color: var(--af-primary-dark);
}

.pf-sec-icon-amber {
  background: var(--amber-50);
  color: var(--amber-800);
}

.pf-sec-icon-teal {
  background: var(--teal-50);
  color: var(--teal-800);
}

.pf-sec-icon-pink {
  background: var(--pink-50);
  color: var(--pink-800);
}

.pf-sec-title {
  font-size: var(--fs-lg);
  font-weight: 600;
}

.pf-sec-bd {
  padding: var(--space-5);
}

.field .tox-tinymce {
  border: 0.5px solid var(--border-md);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.field .tox-tinymce:hover {
  border-color: color-mix(in srgb, var(--af-primary) 35%, var(--border-md));
}

.field .tox .tox-edit-area::before {
  border: none !important;
}

.field .tox-editor-header {
  border-bottom: 0.5px solid var(--border) !important;
  box-shadow: none !important;
  padding: 4px !important;
}

.field .tox .tox-statusbar {
  border-top: 0.5px solid var(--border) !important;
}

.pf-req {
  color: var(--af-danger);
  margin-left: 2px;
}

.pf-char {
  font-size: var(--fs-xs);
  color: var(--text-3);
  font-weight: 400;
}

.pf-dropzone {
  border: 2px dashed var(--border-md);
  border-radius: var(--radius-lg);
  padding: 28px var(--space-5);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: var(--surface-tint);
}

.pf-dropzone:hover,
.pf-dropzone.drag-over {
  border-color: var(--af-primary);
  background: var(--blue-50);
}

.pf-dz-icon {
  font-size: 32px;
  color: var(--text-3);
  margin-bottom: 10px;
}

.pf-dz-text {
  font-size: var(--fs-base);
  color: var(--text-2);
}

.pf-dz-hint {
  font-size: var(--fs-md);
  color: var(--text-3);
  margin-top: var(--space-1);
}

.pf-gallery {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.pf-gallery-item {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 0.5px solid var(--border);
  aspect-ratio: 1;
  background: var(--surface-hover);
}

.pf-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pf-gallery-del {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  font-size: var(--fs-sm);
}

.pf-gallery-main {
  position: absolute;
  bottom: 5px;
  left: 5px;
  font-size: var(--fs-xs);
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--af-primary);
  color: #fff;
  font-weight: 500;
}

.pf-gallery-set {
  font-size: var(--fs-xs);
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-weight: 500;
}

.pf-gallery-feat {
  position: absolute;
  bottom: 5px;
  left: 5px;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.pf-gallery-empty {
  grid-column: 1 / -1;
  padding: var(--space-4);
  text-align: center;
  font-size: var(--fs-base);
}

.pf-gallery-item.is-primary {
  outline: 2px solid var(--af-primary);
  outline-offset: 1px;
}

.pf-media-axis {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.pf-media-axis-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 0.5px solid var(--border-md);
  border-radius: var(--radius-pill);
  font-size: var(--fs-md);
  cursor: pointer;
  background: var(--surface);
  margin: 0;
}

.pf-media-axis-item:has(input:checked) {
  border-color: var(--af-primary);
  background: var(--blue-50);
  color: var(--af-primary-dark);
  font-weight: 500;
}

.pf-album-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.pf-album-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--radius-md);
  border: 0.5px solid var(--border-md);
  background: var(--surface);
  font-size: var(--fs-md);
  color: var(--text-2);
  cursor: pointer;
  font-family: var(--font);
}

.pf-album-tab.active {
  border-color: var(--af-primary);
  background: var(--blue-50);
  color: var(--af-primary-dark);
  font-weight: 600;
}

.pf-album-count {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--surface-hover);
  font-size: var(--fs-xs);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pf-album-tab.active .pf-album-count {
  background: var(--af-primary);
  color: #fff;
}

.pf-detail-albums {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.pf-detail-album-title {
  font-size: var(--fs-base);
  font-weight: 600;
  margin-bottom: var(--space-2);
}

.pf-detail-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pf-detail-thumb {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 0.5px solid var(--border);
  background: var(--surface-hover);
}

.pf-detail-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pf-detail-thumb.is-primary {
  outline: 2px solid var(--af-primary);
}

.pf-vtype-chips {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.pf-vtype-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px var(--space-3);
  border-radius: var(--radius-pill);
  border: 0.5px solid var(--border-md);
  font-size: var(--fs-md);
  cursor: pointer;
  background: var(--surface);
  transition: background 0.1s, border-color 0.1s;
  user-select: none;
}

.pf-vtype-chip.active {
  border-color: var(--af-primary);
  background: var(--blue-50);
  color: var(--af-primary-dark);
  font-weight: 500;
}

.pf-variant-group {
  margin-bottom: 14px;
  padding: var(--space-3) 14px;
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-tint);
}

.pf-vg-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.pf-vg-name {
  font-size: var(--fs-base);
  font-weight: 500;
}

.pf-vg-add {
  font-size: var(--fs-md);
  color: var(--af-primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  font-family: var(--font);
}

.pf-opt-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pf-opt-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) 10px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 0.5px solid var(--border-md);
  font-size: var(--fs-md);
}

.pf-opt-tag button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-2);
  padding: 0;
  line-height: 1;
}

.pf-add-opt-row {
  display: none;
  gap: var(--space-2);
  margin-top: 10px;
}

.pf-add-opt-row.show {
  display: flex;
}

.pf-add-opt-row .inp {
  flex: 1;
}

.pf-add-opt-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: var(--space-2) 14px;
  border-radius: var(--radius-md);
  border: 0.5px solid var(--af-primary);
  background: var(--blue-50);
  color: var(--af-primary-dark);
  font-size: var(--fs-base);
  cursor: pointer;
  white-space: nowrap;
  font-family: var(--font);
}

.pf-seo-preview {
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  background: var(--surface-tint);
  margin-bottom: 14px;
}

.pf-seo-url {
  font-size: var(--fs-md);
  color: var(--af-success);
  margin-bottom: var(--space-1);
}

.pf-seo-tp {
  font-size: var(--fs-xl);
  color: var(--af-primary-dark);
  font-weight: 500;
  margin-bottom: 3px;
  line-height: 1.3;
}

.pf-seo-dp {
  font-size: var(--fs-base);
  color: var(--text-2);
  line-height: 1.5;
}

.pf-seo-bar {
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  margin-top: 6px;
  overflow: hidden;
}

.pf-seo-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s;
  width: 0%;
  background: var(--af-danger);
}

.pf-seo-score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  font-size: var(--fs-md);
}

.pf-seo-score-val {
  font-weight: 600;
  color: var(--af-danger);
}

.pf-slug-wrap {
  display: flex;
  align-items: stretch;
}

.pf-slug-prefix {
  font-size: var(--fs-base);
  color: var(--text-2);
  background: var(--surface-tint);
  border: 0.5px solid var(--border-md);
  border-right: none;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
  padding: 9px 10px;
  white-space: nowrap;
  display: flex;
  align-items: center;
}

.pf-slug-wrap .inp {
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.pf-badge-status {
  font-size: var(--fs-md);
  padding: var(--space-1) 10px;
  border-radius: var(--radius-pill);
  border: 0.5px solid;
  font-weight: 500;
}

.pf-badge-draft {
  background: var(--amber-50);
  color: var(--amber-800);
  border-color: var(--amber-border);
}

.pf-badge-active {
  background: var(--green-50);
  color: var(--green-800);
  border-color: var(--green-100);
}

.sticky-actions {
  position: sticky;
  top: calc(var(--topbar-h) + var(--space-4));
}

/* ---------------------------------------------------------------------------
   13. Dashboard charts
   --------------------------------------------------------------------------- */
.chart-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: nowrap;
}

.chart-header .panel-title {
  flex: 1;
  min-width: 0;
  margin: 0;
}

.chart-header-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-metric-sel {
  width: auto;
  min-width: 168px;
  max-width: 220px;
}

.chart-wrap {
  padding: var(--space-4) var(--space-5) var(--space-5);
  height: 260px;
  position: relative;
  min-width: 0;
}

.donut-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
  gap: 14px;
}

.donut-canvas-wrap {
  position: relative;
  width: 160px;
  height: 160px;
}

.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.donut-pct {
  font-size: var(--fs-6xl);
  font-weight: 600;
  color: var(--af-text);
}

.donut-sub {
  font-size: var(--fs-sm);
  color: var(--text-2);
}

.legend {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: 100%;
  min-width: 0;
}

.leg-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--fs-md);
}

.leg-left {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-2);
}

.leg-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.leg-dot-dynamic {
  background: var(--dot-color, var(--af-primary));
}

.leg-val {
  font-weight: 500;
  color: var(--text);
}


/* ---------------------------------------------------------------------------
   14. Responsive
   Breakpoints: tablet ≤1024 | form stack ≤900 | mobile ≤767 | compact ≤480
   --------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sidebar {
    width: var(--sidebar-collapsed);
  }

  .sidebar .logo-text,
  .sidebar .nav-link span,
  .sidebar .nav-badge,
  .sidebar .nav-group-label,
  .sidebar .user-name,
  .sidebar .user-role {
    display: none;
  }

  .sidebar .nav-link {
    justify-content: center;
    padding: 10px;
  }

  .sidebar .nav-icon {
    width: auto;
  }

  .sidebar .sidebar-logo {
    justify-content: center;
    padding: var(--space-4) var(--space-3) 8px;
  }

  .sidebar .sidebar-user {
    justify-content: center;
    padding: var(--space-2);
  }

  .main-wrap {
    margin-left: var(--sidebar-collapsed);
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .page-content {
    padding: var(--space-5);
  }

  .sticky-actions {
    position: static;
  }
}

@media (max-width: 900px) {

  .create-layout,
  .product-detail-layout,
  .dash-two-col,
  .order-detail-grid,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pf-gallery {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .page-header {
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .page-header-actions {
    width: auto;
    flex: 0 1 auto;
    margin-left: auto;
    justify-content: flex-end;
  }

  .form-narrow {
    max-width: none;
  }

  .chart-wrap {
    height: 220px;
  }
}

@media (max-width: 767px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-w) !important;
  }

  .sidebar .logo-text,
  .sidebar .nav-link span,
  .sidebar .nav-badge,
  .sidebar .nav-group-label,
  .sidebar .user-name,
  .sidebar .user-role {
    display: block !important;
  }

  .sidebar .nav-link {
    justify-content: flex-start !important;
    padding: var(--space-2) 10px !important;
  }

  .sidebar .nav-icon {
    width: 20px !important;
  }

  .sidebar .sidebar-logo {
    justify-content: flex-start !important;
    padding: var(--space-4) !important;
  }

  .sidebar .sidebar-user {
    justify-content: flex-start !important;
    padding: var(--space-2) 10px !important;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.open {
    display: block;
  }

  .main-wrap {
    margin-left: 0;
  }

  .hamburger {
    display: flex;
  }

  .topbar {
    padding: 0 12px;
    gap: 8px;
  }

  .topbar-brand {
    display: flex;
    flex-shrink: 0;
  }

  .topbar-brand-name {
    display: none;
  }

  /* Mobile: ẩn search, icon actions dồn sát phải */
  .topbar-search {
    display: none;
  }

  .topbar-actions {
    margin-left: auto;
    gap: 6px;
  }

  .topbar-pos-btn {
    width: 36px;
    padding: 0;
    justify-content: center;
  }

  .topbar-pos-btn span {
    display: none;
  }

  /* Topbar user: avatar only on mobile */
  .topbar .user-menu-copy,
  .topbar .user-menu-caret,
  .topbar-divider {
    display: none;
  }

  .topbar-user {
    padding: 0;
    gap: 0;
  }

  .topbar-user .user-av {
    width: 34px;
    height: 34px;
  }

  .page-content {
    padding: var(--space-4);
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: var(--space-4);
  }

  .panel,
  .form-section,
  .pf-section,
  .analytics-card {
    border-radius: var(--radius-md);
  }

  .panel-header,
  .form-section .sec-hd,
  .pf-sec-hd,
  .chart-header,
  .stock-doc-panel-hd,
  .stock-doc-aside-hd,
  .notif-menu-hd {
    padding: 12px 14px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
  }

  .panel-header > strong,
  .panel-header > .panel-title,
  .panel-header > .aff-sec,
  .form-section .sec-hd > .sec-hd-title,
  .form-section .sec-hd > strong,
  .pf-sec-hd > strong,
  .pf-sec-hd > .panel-title,
  .chart-header > .panel-title,
  .stock-doc-panel-hd > .stock-doc-panel-title,
  .stock-doc-aside-hd > .stock-doc-panel-title,
  .notif-menu-hd > strong {
    flex: 1 1 auto;
    min-width: 0;
    text-align: left;
  }

  .panel-header > .btn-secondary,
  .panel-header > .btn,
  .panel-header > a.btn-secondary,
  .panel-header > a.btn,
  .panel-header > a.small,
  .panel-header > .ops-result-meta,
  .form-section .sec-hd > .sec-hd-actions,
  .form-section .sec-hd > a,
  .pf-sec-hd > a,
  .chart-header > .chart-header-actions,
  .chart-header > a,
  .stock-doc-panel-hd > a,
  .stock-doc-aside-hd > a,
  .notif-menu-hd > a {
    flex: 0 0 auto;
    margin-left: auto;
    white-space: nowrap;
  }

  .panel-header > .filter-bar,
  .panel-header > .filter-bar-fill,
  .panel-header > form.filter-bar,
  .panel-header > .sort-sel,
  .form-section .sec-hd > .filter-bar,
  .pf-sec-hd > .filter-bar {
    width: 100%;
    flex-basis: 100%;
    margin-left: 0;
  }

  .panel-body,
  .form-section .sec-bd,
  .pf-sec-bd {
    padding: 14px;
  }

  .data-table {
    font-size: var(--fs-md);
  }

  .data-table th,
  .data-table td {
    padding: 10px;
  }

  .grid-2,
  .grid-3,
  .order-detail-grid {
    grid-template-columns: 1fr;
  }

  .page-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: var(--space-4);
  }

  .page-back-row {
    width: 100%;
    align-items: flex-start;
  }

  .page-back-copy,
  .page-back-row .page-title,
  .page-header > div:first-child {
    min-width: 0;
    flex: 1 1 auto;
    text-align: left;
  }

  .page-back-row .badge {
    flex-shrink: 0;
  }

  .page-header-actions {
    width: auto;
    flex: 0 1 auto;
    margin-left: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
  }

  .page-header-actions .btn-primary:not(.btn),
  .page-header-actions .btn-secondary:not(.btn),
  .page-header-actions .btn,
  .page-header-actions a.btn-primary,
  .page-header-actions a.btn-secondary {
    flex: 0 0 auto;
    justify-content: center;
  }

  .page-title {
    font-size: var(--fs-3xl);
    word-break: break-word;
  }

  .page-sub {
    word-break: break-word;
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-2);
  }

  .filter-bar .search-wrap,
  .search-wrap-sm {
    min-width: 0;
    max-width: none;
    width: 100%;
  }

  .filter-bar .sort-sel,
  .sort-sel {
    width: 100%;
  }

  .filter-chips {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
    scrollbar-width: none;
    width: 100%;
  }

  .filter-chips::-webkit-scrollbar {
    display: none;
  }

  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .form-actions .btn-primary:not(.btn),
  .form-actions .btn-secondary:not(.btn),
  .form-actions .btn,
  .form-actions a {
    width: 100%;
    justify-content: center;
  }

  .detail-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .detail-val {
    max-width: 100%;
    width: 100%;
    text-align: left;
  }

  .detail-fields-grid {
    grid-template-columns: 1fr;
  }

  .detail-total-grand .detail-total-amount {
    font-size: var(--fs-2xl);
  }

  .detail-action-form-row {
    flex-direction: column;
    align-items: stretch;
  }

  .detail-action-form-row .detail-action-btn {
    width: 100%;
  }
}

.pf-album-tabs,
.pf-media-axis,
.pf-vtype-chips {
  overflow-x: auto;
  flex-wrap: nowrap;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}

.pf-album-tabs::-webkit-scrollbar,
.pf-media-axis::-webkit-scrollbar,
.pf-vtype-chips::-webkit-scrollbar {
  display: none;
}

.pf-album-tab,
.pf-media-axis-item,
.pf-vtype-chip {
  flex-shrink: 0;
}

.pf-dropzone {
  padding: 20px 14px;
}

.pf-slug-wrap {
  flex-wrap: wrap;
}

.pf-slug-prefix {
  border-right: 0.5px solid var(--border-md);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  width: 100%;
}

.pf-slug-wrap .inp {
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.variant-table {
  min-width: 560px;
}

.integ-sync-stats {
  flex-direction: column;
  align-items: flex-start;
}

.integ-action-row,
.modal-action-grid {
  grid-template-columns: 1fr;
}

.donut-wrap {
  padding: var(--space-4);
}

.chart-wrap {
  height: 220px;
  padding: var(--space-3);
}

.chart-header {
  padding: 12px 14px;
  gap: 8px;
}

.chart-header .panel-title {
  width: auto;
  flex: 1;
  min-width: 0;
}

.chart-metric-sel {
  min-width: 140px;
  max-width: 180px;
}

.donut-canvas-wrap {
  width: 140px;
  height: 140px;
}

.donut-center {
  text-align: center;
}

.donut-pct {
  font-size: var(--fs-5xl);
}

.leg-item {
  gap: 10px;
  align-items: flex-start;
}

.leg-left {
  min-width: 0;
  flex: 1;
  line-height: 1.4;
}

.leg-val {
  flex-shrink: 0;
}

.dashboard-grid {
  gap: var(--space-3);
}

.product-line {
  flex-wrap: wrap;
}

.pl-price {
  margin-left: 0;
  width: 100%;
  text-align: right;
}

.pf-detail-thumbs {
  gap: 6px;
}

.pf-detail-thumb {
  width: 64px;
  height: 64px;
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .stat-val {
    font-size: var(--fs-4xl);
  }

  .stat-card {
    padding: 14px;
  }

  .topbar {
    padding: 0 10px;
    gap: 6px;
  }

  .topbar-user-name,
  .topbar-user-role,
  .topbar-divider {
    display: none;
  }

  .topbar-search {
    display: none;
  }

  .page-content {
    padding: var(--space-3);
  }

  .page-header-actions .btn-primary:not(.btn),
  .page-header-actions .btn-secondary:not(.btn),
  .page-header-actions .btn,
  .page-header-actions a.btn-primary,
  .page-header-actions a.btn-secondary {
    flex: 0 0 auto;
    min-width: 0;
  }

  .pf-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .pf-sec-title,
  .panel-header strong,
  .form-section .sec-hd {
    font-size: var(--fs-base);
  }

  .empty-state {
    padding: 32px 14px;
  }
}

/* ---------------------------------------------------------------------------
   13. Fulfillment / ShippingProviders
   --------------------------------------------------------------------------- */
.shipping-provider-card {
  position: relative;
  height: 100%;
}

.shipping-provider-card-soon {
  opacity: 0.85;
}

.shipping-provider-badge-soon {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1;
  background: #ffe8ee;
  color: #c2185b;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
}

.package-preset-block {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  background: var(--surface-2, #fafbfc);
}

.shipping-provider-picker {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.shipping-provider-pick {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  background: var(--surface);
}

.shipping-provider-pick input {
  margin: 0;
}

.shipping-provider-pick-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.shipping-provider-badge-soon-inline {
  font-size: 10px;
  background: #ffe8ee;
  color: #c2185b;
  padding: 1px 6px;
  border-radius: 999px;
  margin-left: 4px;
}

.form-section-title {
  font-size: var(--fs-md);
  font-weight: 600;
  margin: var(--space-3) 0 var(--space-2);
}

/* Order sources */
.order-source-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 14px;
}

.order-src-chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}

.order-src-chip:hover,
.order-src-chip.active {
  border-color: var(--af-primary, #3d5afe);
  color: var(--af-primary, #3d5afe);
  background: color-mix(in srgb, var(--af-primary, #3d5afe) 8%, #fff);
}

.order-source-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
  background: #f2f4f7;
  color: #475467;
}

.order-source-badge.src-pos {
  background: #eff8ff;
  color: #175cd3;
}

.order-source-badge.src-web {
  background: #f4f3ff;
  color: #5925dc;
}

.order-source-badge.src-miniapp {
  background: #fdf2fa;
  color: #c11574;
}

.order-source-badge.src-affiliate {
  background: #ecfdf3;
  color: #067647;
}

.order-source-badge.src-shopee {
  background: #fff4ed;
  color: #c4320a;
}

.order-source-badge.src-tiktok {
  background: #f2f4f7;
  color: #101828;
}

.order-source-badge.src-lazada {
  background: #eef4ff;
  color: #3538cd;
}

.order-source-badge.src-facebook {
  background: #eff8ff;
  color: #1849a9;
}

.order-source-badge.src-zalo {
  background: #eff8ff;
  color: #026aa2;
}

.order-source-badge.src-shopify {
  background: #ecfdf3;
  color: #3f621a;
}

.order-source-badge.src-haravan {
  background: #eff8ff;
  color: #175cd3;
}

.order-source-badge.src-bigseller {
  background: #fffaeb;
  color: #b54708;
}

/* Order processing / fulfillment ops */
/* —— Xử lý đơn hàng: thanh công cụ trên header —— */
.ops-header {
  align-items: flex-start;
}

.ops-header-copy {
  min-width: 0;
}

.ops-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ops-toolbar-select {
  position: relative;
}

.ops-toolbar-select-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 15px;
  color: var(--text-3);
  pointer-events: none;
}

.ops-toolbar .sort-sel {
  min-height: 40px;
  padding: 7px 30px 7px 32px;
  font-size: var(--fs-base);
  font-weight: 500;
}

.ops-toolbar .btn-icon-sm {
  min-height: 40px;
  min-width: 40px;
  justify-content: center;
}

/* —— Xử lý đơn hàng: tab giai đoạn —— */
.ops-phase-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(186px, 1fr));
  gap: 10px;
  margin-bottom: var(--space-5);
}

.ops-phase-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  background: var(--surface);
  border: 0.5px solid var(--border-md);
  border-radius: var(--radius-lg, 12px);
  color: inherit;
  text-decoration: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast),
    background var(--transition-fast);
}

.ops-phase-tab:hover {
  border-color: color-mix(in srgb, var(--af-primary) 45%, var(--border-md));
  box-shadow: var(--shadow-sm);
}

.ops-phase-tab.is-active {
  border-color: var(--af-primary);
  box-shadow: inset 0 0 0 1px var(--af-primary);
  background: color-mix(in srgb, var(--af-primary) 4%, var(--surface));
}

.ops-tab-icon {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
}

.ops-phase-tab.tone-all .ops-tab-icon {
  background: var(--surface-muted);
  color: var(--text-2);
}

.ops-phase-tab.tone-amber .ops-tab-icon {
  background: var(--amber-50);
  color: var(--af-amber);
}

.ops-phase-tab.tone-blue .ops-tab-icon {
  background: var(--blue-50);
  color: var(--af-primary);
}

.ops-phase-tab.tone-teal .ops-tab-icon {
  background: var(--teal-50);
  color: var(--af-teal);
}

.ops-phase-tab.tone-green .ops-tab-icon {
  background: var(--green-50);
  color: var(--af-success);
}

.ops-phase-tab.tone-red .ops-tab-icon {
  background: var(--red-50);
  color: var(--af-danger);
}

.ops-tab-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
}

.ops-tab-lbl {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ops-tab-sub {
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ops-tab-count {
  font-size: var(--fs-4xl);
  font-weight: 650;
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* —— Xử lý đơn hàng: hàng chip trạng thái —— */
.ops-panel-header {
  padding-bottom: 0;
  border-bottom: 0;
}

.ops-result-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-md);
  color: var(--text-3);
  white-space: nowrap;
}

.ops-result-meta strong {
  color: var(--text);
  font-weight: 600;
}

.ops-bulk-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 0.5px solid var(--border);
  background: var(--af-surface-2, #f8fafc);
}

.ops-bulk-bar[hidden] {
  display: none !important;
}

.ops-bulk-count {
  font-size: var(--fs-md);
  color: var(--text-2);
  margin-right: 4px;
}

.ops-actions .td-action-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.ops-status-bar {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px 14px;
  border-bottom: 0.5px solid var(--border);
}

.ops-status-bar-lbl {
  flex: 0 0 auto;
  padding-top: 5px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-3);
}

.ops-status-chips .f-chip .ti {
  font-size: 14px;
  opacity: 0.75;
}

.ops-chip-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 4px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
  font-size: 11px;
  font-weight: 600;
}

.f-chip.active .ops-chip-count {
  background: rgba(255, 255, 255, 0.25);
}

.ops-pipeline-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  padding: 10px 16px;
  border-bottom: 0.5px solid var(--border);
  font-size: 12px;
  color: var(--text-3);
}

.ops-pipe-lbl {
  font-weight: 600;
  margin-right: 4px;
  color: var(--text-2);
}

.ops-pipe-step {
  white-space: nowrap;
}

.ops-pipe-step.is-current {
  color: var(--af-primary);
  font-weight: 700;
}

.ops-pipe-arrow {
  font-size: 12px;
  opacity: 0.45;
}

.ops-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.ops-more {
  position: relative;
}

.ops-more > summary {
  list-style: none;
  cursor: pointer;
}

.ops-more > summary::-webkit-details-marker {
  display: none;
}

.ops-more-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 20;
  min-width: 180px;
  max-height: 280px;
  overflow: auto;
  padding: 6px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.ops-more-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  color: var(--text);
  cursor: pointer;
}

.ops-more-item .ti {
  font-size: 15px;
  color: var(--text-2);
}

.ops-more-item:hover {
  background: var(--surface-hover);
}

.ops-stock-modal-body {
  padding: 16px 20px;
  background: var(--surface-muted);
}

.ops-stock-modal-body .modal-sub,
.modal-header .modal-sub {
  margin: 4px 0 0;
  font-size: var(--fs-md);
  color: var(--text-3);
}

.ops-stock-lines {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ops-stock-line {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.ops-stock-line.is-ok {
  border-left: 3px solid var(--af-success);
}

.ops-stock-line.is-partial {
  border-left: 3px solid var(--af-amber);
}

.ops-stock-line.is-out,
.ops-stock-line.is-unknown {
  border-left: 3px solid var(--af-danger);
}

.ops-stock-line-hd {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border-bottom: 0.5px solid var(--border);
}

.ops-stock-line-main {
  min-width: 0;
  flex: 1;
}

.ops-stock-line-main .td-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
}

.ops-stock-line-meta {
  display: flex;
  gap: 14px;
  flex-shrink: 0;
}

.ops-stock-meta-item {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 48px;
}

.ops-stock-meta-lbl {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-3);
}

.ops-stock-meta-item strong {
  font-size: var(--fs-xl);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.ops-stock-wh-table {
  margin: 0;
}

.ops-stock-wh-table th,
.ops-stock-wh-table td {
  padding: 8px 14px;
}

.ops-stock-wh-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.ops-stock-wh-actions .btn-sm {
  min-height: 28px;
  padding: 0 8px;
  font-size: 12px;
  gap: 4px;
}

.ops-stock-modal-footer {
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
}

.ops-stock-modal-footer .btn-secondary[data-bs-dismiss] {
  margin-left: auto;
}

.ops-status-chips {
  flex-wrap: wrap;
  max-width: 100%;
}

.order-source-badge.src-manual {
  background: #f2f4f7;
  color: #344054;
}


/* ---------------------------------------------------------------------------
   POS fullscreen sell
   --------------------------------------------------------------------------- */
.pos-body {
  margin: 0;
  background: #eef1f6;
  overflow: hidden;
  height: 100vh;
}

.pos-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: 100dvh;
}

.pos-topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  background: #fff;
  border-bottom: 0.5px solid var(--border);
  flex-shrink: 0;
}

.pos-topbar-left,
.pos-topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.pos-topbar-right {
  align-items: flex-end;
}

.pos-exit {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  border: 0.5px solid var(--border-md);
  color: var(--text-2);
  text-decoration: none;
}

.pos-exit:hover {
  background: var(--surface-hover);
  color: var(--af-primary);
}

.pos-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pos-brand>img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
}

.pos-brand strong {
  display: block;
  font-size: 14px;
  line-height: 1.2;
}

.pos-brand span {
  display: block;
  font-size: 12px;
  color: var(--text-3);
}

.pos-search-wrap {
  flex: 1;
  position: relative;
  max-width: 520px;
  margin: 0 auto;
}

.pos-search-wrap i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
}

.pos-search-wrap input {
  width: 100%;
  height: 40px;
  border-radius: 10px;
  border: 0.5px solid var(--border-md);
  padding: 0 12px 0 36px;
  background: var(--surface-soft, #f7f8fb);
  font-size: 14px;
}

.pos-search-wrap input:focus {
  outline: none;
  border-color: var(--af-primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(61, 90, 254, 0.12);
}

.pos-sp-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
  color: var(--text-3);
  margin: 0;
}

.pos-sp-label select {
  min-width: 180px;
  height: 40px;
  min-height: 40px;
  padding: 0 30px 0 12px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  border-radius: 10px;
}

.pos-sp-empty {
  font-size: 12px;
  color: var(--text-3);
}

.pos-topbar-btn {
  height: 40px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  box-sizing: border-box;
  border: 0.5px solid var(--border-md);
  background: #fff;
  color: var(--text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: border-color var(--transition-fast), color var(--transition-fast), background var(--transition-fast);
}

.pos-topbar-btn:hover {
  border-color: rgba(61, 90, 254, 0.35);
  background: var(--surface-hover);
  color: var(--af-primary);
}

.pos-main {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr minmax(320px, 400px);
  min-height: 0;
}

.pos-catalog {
  overflow: auto;
  padding: 16px;
}

.pos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.pos-grid-empty,
.pos-cart-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-3);
  padding: 48px 16px;
  font-size: 14px;
}

.pos-card {
  display: flex;
  flex-direction: column;
  text-align: left;
  border: 0.5px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, transform .12s ease;
}

.pos-card:hover:not(:disabled) {
  border-color: rgba(61, 90, 254, 0.45);
  box-shadow: 0 8px 20px rgba(18, 20, 43, 0.08);
  transform: translateY(-1px);
}

.pos-card:disabled,
.pos-card.is-out {
  opacity: 0.55;
  cursor: not-allowed;
}

.pos-card-media {
  aspect-ratio: 1.15 / 1;
  background: #f3f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.pos-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pos-card-ph {
  color: #b0b7c3;
  font-size: 28px;
}

.pos-card-body {
  padding: 10px 12px 12px;
}

.pos-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.6em;
}

.pos-card-variant {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
}

.pos-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-3);
}

.pos-card-meta strong {
  font-size: 13px;
  color: var(--af-primary);
}

.pos-cart {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-left: 0.5px solid var(--border);
  min-height: 0;
}

.pos-cart-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 8px;
  border-bottom: 0.5px solid var(--border);
}

.pos-cart-customer {
  padding: 12px 16px;
  border-bottom: 0.5px solid var(--border);
  position: relative;
}

.pos-customer-hint {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-3);
  min-height: 16px;
}

.pos-customer-hint.is-found {
  color: #067647;
}

.pos-customer-suggest {
  margin-top: 8px;
  border: 0.5px solid var(--border);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 12px 24px rgba(18, 23, 43, 0.08);
  overflow: hidden;
}

.pos-customer-item {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pos-customer-item+.pos-customer-item {
  border-top: 0.5px solid var(--border);
}

.pos-customer-item strong {
  font-size: 13px;
  color: var(--text);
}

.pos-customer-item span {
  font-size: 11px;
  color: var(--text-3);
}

.pos-customer-item:hover {
  background: var(--surface-hover);
}

.pos-cart-lines {
  flex: 1;
  overflow: auto;
  padding: 8px 12px;
}

.pos-line {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 8px;
  align-items: center;
  padding: 10px 8px;
  border-bottom: 0.5px solid var(--border);
}

.pos-line-info {
  min-width: 0;
}

.pos-line-info strong {
  display: block;
  font-size: 13px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pos-line-info span {
  font-size: 11px;
  color: var(--text-3);
}

.pos-line-qty {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.pos-qty-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 0.5px solid var(--border-md);
  background: var(--surface-soft, #f7f8fb);
  font-size: 16px;
  line-height: 1;
}

.pos-qty-input {
  width: 42px;
  height: 28px;
  text-align: center;
  border: 0.5px solid var(--border-md);
  border-radius: 8px;
  font-size: 13px;
}

.pos-line-price {
  font-size: 13px;
  font-weight: 600;
  min-width: 72px;
  text-align: right;
}

.pos-line-remove {
  border: 0;
  background: transparent;
  color: var(--text-3);
  width: 28px;
  height: 28px;
}

.pos-line-remove:hover {
  color: #c2185b;
}

.pos-cart-footer {
  padding: 12px 16px 16px;
  border-top: 0.5px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #fbfcfe;
}

.pos-sale-tabs {
  display: flex;
  gap: 8px;
  padding: 10px 16px 0;
  overflow-x: auto;
}

.pos-sale-tab {
  border: 0.5px solid var(--border-md);
  background: #fff;
  border-radius: 999px;
  min-height: 34px;
  padding: 0 12px;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 600;
}

.pos-sale-tab.active {
  border-color: rgba(61, 90, 254, 0.32);
  background: rgba(61, 90, 254, 0.08);
  color: var(--af-primary);
}

.pos-sale-tab-close {
  font-size: 12px;
}

.pos-sale-tab-add {
  margin: 10px 16px 0;
  min-height: 34px;
  border: 1px dashed var(--border-md);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
}

.pos-sale-tab-add:hover {
  color: var(--af-primary);
  border-color: rgba(61, 90, 254, 0.35);
}

.pos-totals {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pos-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-2);
}

.pos-discount-input {
  width: 120px;
  text-align: right;
}

.pos-total-grand {
  font-size: 16px;
  color: var(--text);
  margin-top: 4px;
}

.pos-total-grand strong {
  font-size: 20px;
  color: var(--af-primary);
}

.pos-pay-methods {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.pos-pay-methods.has-qr {
  grid-template-columns: repeat(4, 1fr);
}

.pos-pay-btn {
  border: 0.5px solid var(--border-md);
  background: #fff;
  border-radius: 10px;
  padding: 8px 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.pos-pay-btn i {
  font-size: 18px;
}

.pos-pay-btn.active {
  border-color: var(--af-primary);
  color: var(--af-primary);
  background: rgba(61, 90, 254, 0.08);
}

.pos-qr-panel {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 0.5px solid var(--border-md);
  border-radius: 12px;
  background: #fafbfc;
}

.pos-qr-img-wrap {
  flex-shrink: 0;
  width: 120px;
  height: 120px;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  border: 0.5px solid var(--border-md);
}

.pos-qr-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.pos-qr-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  font-size: 12px;
  color: var(--text-2);
}

.pos-qr-meta strong {
  font-size: 13px;
  color: var(--text-1);
}

.pos-qr-hint {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-3, #889);
  line-height: 1.35;
}

.pos-paid-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  margin: 0;
  color: var(--text-2);
}

.pos-checkout-btn {
  height: 48px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 12px;
}

.pos-checkout-btn.is-busy {
  opacity: 0.7;
  pointer-events: none;
}

.pos-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #101828;
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 40;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.25);
}

.pos-toast.is-error {
  background: #c2185b;
}

.pos-success-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 24px;
}

.pos-success-card {
  background: #fff;
  border-radius: 16px;
  padding: 28px 24px;
  text-align: center;
  width: min(360px, 100%);
  box-shadow: 0 20px 50px rgba(16, 24, 40, 0.2);
}

.pos-success-card>i {
  font-size: 48px;
  color: #067647;
}

.pos-success-card h2 {
  margin: 8px 0 4px;
  font-size: 22px;
}

.pos-success-no {
  font-weight: 700;
  color: var(--af-primary);
  margin: 0;
}

.pos-success-total {
  font-size: 20px;
  font-weight: 700;
  margin: 8px 0 18px;
}

.pos-success-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

@media (max-width: 900px) {
  .pos-main {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
  }

  .pos-cart {
    border-left: 0;
    border-top: 0.5px solid var(--border);
  }

  .pos-topbar {
    flex-wrap: wrap;
  }

  .pos-search-wrap {
    order: 3;
    max-width: none;
    width: 100%;
  }
}

/* ---------------------------------------------------------------------------
   Reports
   --------------------------------------------------------------------------- */
.report-filters .panel-body {
  padding: 14px 16px;
}

.stock-filter-panel {
  padding: 14px 16px;
}

.stock-filter-row {
  row-gap: 10px;
}

.stock-filter-field .form-label {
  font-size: var(--fs-md);
  color: var(--text-3);
  margin-bottom: 6px;
}

.stock-filter-actions {
  display: flex;
  align-items: flex-end;
}

.stock-filter-actions .btn {
  min-height: 40px;
  font-weight: 600;
}

.report-filters-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}

.report-filter-field {
  min-width: 140px;
}

.report-filter-field .form-label {
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 4px;
}

.report-filter-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.report-share {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 110px;
}

.report-share-bar {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--af-primary, #3d5afe) 18%, #eef1f6);
  position: relative;
  overflow: hidden;
}

.report-share-bar::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--share, 0%);
  background: var(--af-primary, #3d5afe);
  border-radius: inherit;
}

.report-share span {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  min-width: 40px;
  text-align: right;
}

@media (max-width: 720px) {
  .report-filter-actions {
    margin-left: 0;
    width: 100%;
  }

  .report-filter-actions .btn {
    flex: 1;
  }
}

/* ---------------------------------------------------------------------------
   Report catalog + tabular sheet
   --------------------------------------------------------------------------- */
.report-catalog {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.report-catalog-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  text-decoration: none;
  color: inherit;
  transition: border-color .15s ease, box-shadow .15s ease, transform .12s ease;
}

.report-catalog-card:hover {
  border-color: rgba(61, 90, 254, 0.4);
  box-shadow: 0 8px 20px rgba(18, 20, 43, 0.06);
  transform: translateY(-1px);
  color: inherit;
}

.report-catalog-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(61, 90, 254, 0.08);
  color: var(--af-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.report-catalog-card strong {
  display: block;
  font-size: 14px;
  margin-bottom: 4px;
}

.report-catalog-card p {
  margin: 0;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.4;
}

.report-catalog-arrow {
  margin-left: auto;
  color: var(--text-3);
  align-self: center;
}

.report-preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.report-sheet-hd {
  text-align: center;
  padding: 18px 16px 10px;
  border-bottom: 0.5px solid var(--border);
}

.report-sheet-title {
  font-size: 18px;
  font-weight: 700;
}

.report-sheet-meta {
  font-size: 13px;
  color: var(--text-3);
  margin-top: 2px;
}

.report-summary-row td {
  background: #fff8e6;
  font-weight: 650;
}

.report-data-table th:not(:first-child),
.report-data-table td:not(:first-child) {
  text-align: right;
}


/* ---------------------------------------------------------------------------
   Utilities — extracted from inline styles in views
   --------------------------------------------------------------------------- */
.panel-narrow {
  max-width: 40rem;
}

.input-w-12 {
  width: 12rem;
}

.w-col-40 {
  width: 40px;
}

.w-col-50 {
  width: 50px;
}

.w-col-90 {
  width: 90px;
}

.w-col-100 {
  width: 100px;
}

.w-col-120 {
  width: 120px;
}

.w-col-140 {
  width: 140px;
}

.icon-display-sm {
  font-size: 1.75rem;
}

.icon-display-md {
  font-size: 2rem;
}

.icon-display-lg {
  font-size: 2.5rem;
  opacity: 0.4;
}

.icon-display-xl {
  font-size: 3rem;
  opacity: 0.45;
}

.qr-preview-img {
  border-radius: 8px;
  background: #fff;
}

.list-relaxed {
  line-height: 1.7;
}

.text-measure {
  max-width: 28rem;
}

.partner-logo-fallback {
  display: none;
  width: 100%;
  height: 100%;
  place-items: center;
  font-weight: 700;
  font-size: 0.85em;
  color: var(--text-2, #64748b);
  background: color-mix(in srgb, var(--af-primary, #3d5afe) 10%, #fff);
}

.partner-logo.is-fallback img {
  display: none;
}

.partner-logo.is-fallback .partner-logo-fallback {
  display: grid;
}

/* Date range picker — quick presets + floating panel */
.date-range-field {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.date-range-field-label {
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 6px;
}

.report-filter-field--range,
.filter-bar .date-range-field {
  min-width: auto;
  flex-shrink: 0;
}

.date-range-picker {
  position: relative;
  display: inline-flex;
  width: 100%;
}

.date-range-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 40px;
  padding: 7px 12px 7px 10px;
  border: 0.5px solid var(--border-md);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-base);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.date-range-trigger:hover {
  background: var(--surface-hover);
}

.date-range-trigger[aria-expanded="true"] {
  border-color: var(--af-primary);
  box-shadow: var(--focus-ring);
  background: var(--surface-tint);
}

.date-range-trigger-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--blue-50);
  color: var(--af-primary);
  flex-shrink: 0;
}

.date-range-trigger-icon .ti {
  font-size: 16px;
}

.date-range-trigger-label {
  color: var(--text);
  line-height: 1.2;
}

.date-range-trigger-chevron {
  display: inline-flex;
  color: var(--text-3);
  margin-left: 2px;
  transition: transform var(--transition-fast);
}

.date-range-trigger-chevron .ti {
  font-size: 14px;
}

.date-range-trigger[aria-expanded="true"] .date-range-trigger-chevron {
  transform: rotate(180deg);
  color: var(--af-primary);
}

.date-range-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 1050;
  display: flex;
  min-width: min(680px, calc(100vw - 2rem));
  background: var(--surface);
  border: 0.5px solid var(--border-md);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.date-range-dropdown.is-floating {
  position: fixed;
  z-index: 2000;
  right: auto;
}

.stock-filter-panel,
.report-filters .panel-body,
.panel-header,
.filter-bar {
  overflow: visible;
}

.date-range-presets {
  display: flex;
  flex-direction: column;
  width: 176px;
  padding: 12px 8px;
  border-right: 0.5px solid var(--border);
  background: var(--surface-soft);
  flex-shrink: 0;
  max-height: min(420px, calc(100vh - 48px));
  overflow-y: auto;
}

.date-range-presets-title {
  padding: 0 10px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-3);
}

.date-range-preset {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0.5px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-2);
  font-family: var(--font);
  font-size: var(--fs-md);
  text-align: left;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.date-range-preset:hover {
  background: var(--surface);
  color: var(--text);
}

.date-range-preset.is-active {
  background: var(--blue-50);
  border-color: color-mix(in srgb, var(--af-primary) 24%, var(--border));
  color: var(--af-primary-dark);
  font-weight: 600;
}

.date-range-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 14px 16px 12px;
  background: var(--surface);
}

.date-range-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin-bottom: 12px;
  border: 0.5px solid var(--border-md);
  border-radius: var(--radius-md);
  background: var(--surface-tint);
}

.date-range-inputs:focus-within {
  border-color: var(--af-primary);
  box-shadow: var(--focus-ring);
}

.date-range-input {
  flex: 1;
  min-width: 0;
  padding: 4px 0;
  border: 0;
  background: transparent;
  font-family: var(--font);
  font-size: var(--fs-md);
  font-weight: 500;
  color: var(--text);
  color-scheme: light;
}

.date-range-input:focus {
  outline: none;
}

.date-range-arrow {
  display: inline-flex;
  color: var(--text-3);
  flex-shrink: 0;
}

.date-range-arrow .ti {
  font-size: 14px;
}

.date-range-input-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 0.5px solid var(--border);
  color: var(--text-3);
  flex-shrink: 0;
}

.date-range-input-icon .ti {
  font-size: 15px;
}

.date-range-calendars {
  position: relative;
  flex: 1;
  min-height: 268px;
}

.date-range-cal-nav {
  position: absolute;
  top: 2px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  z-index: 1;
  padding: 0 4px;
}

.date-range-nav-btn {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 0.5px solid var(--border-md);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.date-range-nav-btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-md);
  color: var(--text);
}

.date-range-nav-btn .ti {
  font-size: 16px;
}

.date-range-months {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding-top: 4px;
}

.date-range-month-title {
  margin-bottom: 10px;
  font-weight: 600;
  font-size: var(--fs-md);
  color: var(--text);
  text-align: center;
}

.date-range-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0;
  margin-bottom: 6px;
}

.date-range-weekdays span {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.02em;
}

.date-range-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0;
}

.date-range-day {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 34px;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-family: var(--font);
  font-size: var(--fs-md);
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.date-range-day.is-empty {
  cursor: default;
  pointer-events: none;
}

.date-range-day:not(.is-empty):hover {
  background: var(--surface-hover);
}

.date-range-day.in-range {
  background: var(--blue-50);
  color: var(--af-primary-dark);
}

.date-range-day.is-start,
.date-range-day.is-end {
  background: var(--af-primary);
  color: #fff;
  font-weight: 600;
}

.date-range-day.is-start {
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.date-range-day.is-end {
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.date-range-day.is-start.is-end {
  border-radius: var(--radius-md);
}

.date-range-day.is-picking {
  box-shadow: inset 0 0 0 2px var(--af-primary);
}

.date-range-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 0.5px solid var(--border);
}

.date-range-footer .btn-secondary,
.date-range-footer .btn-primary {
  min-height: 36px;
  padding: 7px 14px;
  font-size: var(--fs-md);
}

.filter-bar .date-range-picker,
.report-filters-row .date-range-picker,
.page-header-actions .date-range-picker {
  flex-shrink: 0;
  width: auto;
}

.page-header-actions .date-range-field {
  width: auto;
}

.page-header-actions .date-range-trigger {
  width: auto;
  min-width: 220px;
}

.report-filter-field--search {
  min-width: 180px;
  flex: 1;
  max-width: 280px;
}

.report-filter-field--search .form-control-sm {
  min-height: 40px;
}

.date-range-field-label,
.report-filter-field--range .form-label {
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 6px;
}

.page-header-actions form:has(.date-range-picker),
.page-header-actions form:has(.date-range-field) {
  display: inline-flex;
}

.analytics-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.analytics-filters .analytics-source-select {
  width: auto;
  min-width: 150px;
  min-height: 40px;
}

.analytics-filters .btn {
  min-height: 40px;
  padding-inline: 14px;
  font-weight: 600;
}

.analytics-overview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.analytics-overview-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-4);
  min-width: 0;
}

.analytics-overview-title {
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--space-3);
}

.analytics-overview-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}

.analytics-donut-wrap {
  position: relative;
  width: 148px;
  height: 148px;
}

.analytics-donut-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

.analytics-donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  padding: 12px;
  text-align: center;
}

.analytics-donut-label {
  font-size: var(--fs-sm);
  color: var(--af-primary);
  font-weight: 500;
}

.analytics-donut-value {
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--af-primary);
  line-height: 1.25;
  word-break: break-word;
}

.analytics-customer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-4);
}

.analytics-overview-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  max-height: 120px;
  overflow-y: auto;
}

.analytics-leg {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-sm);
  color: var(--text-2);
}

.analytics-leg-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--c, #94a3b8);
  flex-shrink: 0;
}

.analytics-section {
  margin-bottom: var(--space-5);
}

.analytics-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}

.analytics-section-title {
  margin: 0;
  font-size: var(--fs-xl);
  font-weight: 650;
  color: var(--text);
}

.analytics-metric {
  color: var(--af-primary);
  font-weight: 700;
}

.analytics-sales-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.analytics-products-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-4);
}

.analytics-time-row {
  margin-bottom: var(--space-5);
}

.analytics-time-row .chart-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
}

.chart-wrap-lg {
  height: 280px;
}

.analytics-card .chart-wrap {
  height: 220px;
  padding: 0 var(--space-4) var(--space-4);
}

.analytics-card .chart-header {
  padding: var(--space-4) var(--space-5) var(--space-2);
}

@media (max-width: 1100px) {
  .analytics-overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .analytics-customer-grid {
    grid-template-columns: 1fr;
  }

  .analytics-products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {

  .analytics-overview-grid,
  .analytics-sales-grid,
  .analytics-customer-grid,
  .analytics-products-grid {
    grid-template-columns: 1fr;
  }

  .chart-wrap-lg {
    height: 220px;
  }
}

@media (max-width: 768px) {
  .date-range-dropdown {
    min-width: min(100vw - 1.5rem, 680px);
    flex-direction: column;
    right: auto;
    left: 0;
  }

  .date-range-presets {
    flex-direction: row;
    flex-wrap: wrap;
    width: 100%;
    border-right: 0;
    border-bottom: 0.5px solid var(--border);
    padding: 10px;
    gap: 6px;
  }

  .date-range-presets-title {
    width: 100%;
    padding: 0 4px 4px;
  }

  .date-range-preset {
    width: auto;
    padding: 6px 10px;
    font-size: var(--fs-sm);
  }

  .date-range-months {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .date-range-trigger-label {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* ---------------------------------------------------------------------------
   Stock document workspace (Nhập hàng create / detail)
   --------------------------------------------------------------------------- */
.stock-doc-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 320px);
  gap: var(--space-5);
  align-items: start;
}

.stock-doc-main,
.stock-doc-aside {
  min-width: 0;
}

.stock-doc-panel {
  padding: 0;
  overflow: visible;
}

.stock-doc-panel-hd,
.stock-doc-aside-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 0.5px solid var(--border);
  background: var(--surface-soft);
}

.stock-doc-panel-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text);
}

.stock-doc-panel-title .ti {
  color: var(--af-primary);
  font-size: 18px;
}

.stock-doc-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--af-primary);
  border-bottom: none;
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
}

.stock-doc-search-field {
  position: relative;
  flex: 1;
  min-width: 0;
}

.stock-doc-search-field>.ti {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
  font-size: 16px;
  z-index: 1;
}

.stock-doc-search-input {
  width: 100%;
  height: 40px;
  min-height: 40px;
  padding: 8px 14px 8px 36px;
  border: none;
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-size: var(--fs-md);
  outline: none;
  box-shadow: none;
  transition: box-shadow 0.15s ease;
}

.stock-doc-search-input:focus {
  border: none;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.stock-doc-search-results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 40;
  max-height: 280px;
  overflow: auto;
  background: var(--surface);
  border: 0.5px solid var(--border-md);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

.stock-doc-search-item {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border: 0;
  border-bottom: 0.5px solid var(--border);
  background: transparent;
  text-align: left;
  color: var(--text);
  font-size: var(--fs-md);
  cursor: pointer;
}

.stock-doc-search-item:last-child {
  border-bottom: 0;
}

.stock-doc-search-item:hover {
  background: var(--blue-50);
  color: var(--af-primary);
}

.stock-doc-search-empty {
  padding: 14px;
  color: var(--text-3);
  font-size: var(--fs-sm);
  text-align: center;
}

.stock-doc-search-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
}

.stock-doc-search-add:hover {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.stock-doc-lines {
  margin: 0;
}

.stock-doc-lines thead th {
  white-space: nowrap;
  background: var(--surface-soft);
}

.stock-doc-lines td,
.stock-doc-lines th {
  vertical-align: middle;
}

.stock-doc-lines .form-select,
.stock-doc-lines .form-control {
  min-height: 36px;
  font-size: var(--fs-md);
  border-radius: var(--radius-md);
}

.stock-doc-lines .stock-line-amount {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  white-space: nowrap;
}

.stock-doc-sku {
  color: var(--af-primary);
  font-weight: 500;
}

.stock-doc-lines-footer {
  display: none;
}

.stock-doc-aside-panel {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 16px;
}

.stock-doc-aside-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stock-doc-note {
  resize: vertical;
  min-height: 72px;
}

.stock-doc-summary {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  border: 0.5px solid var(--border);
}

.stock-doc-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: var(--fs-md);
  color: var(--text-2);
}

.stock-doc-summary-row strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.stock-doc-summary-total {
  padding-top: 10px;
  border-top: 0.5px solid var(--border);
  color: var(--text);
  font-weight: 500;
}

.stock-doc-summary-total strong {
  color: var(--af-primary);
  font-size: 1.1em;
}

.stock-doc-save {
  width: 100%;
  min-height: 44px;
  justify-content: center;
}

.stock-doc-detail-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(220px, 1fr);
  gap: 16px;
  padding: 16px;
  border-top: 0.5px solid var(--border);
  background: var(--surface-soft);
}

.stock-doc-note-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 88px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 0.5px solid var(--border);
}

.stock-doc-note-text {
  margin: 0;
  color: var(--text);
  white-space: pre-wrap;
  line-height: 1.5;
}

.stock-doc-summary--inline {
  margin: 0;
}

.stock-doc-meta-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stock-doc-meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stock-doc-aside-actions {
  margin-top: 4px;
}

.w-col-40 {
  width: 40px;
}

.w-col-48 {
  width: 48px;
}

.w-col-100 {
  width: 100px;
}

@media (max-width: 1024px) {
  .stock-doc-workspace {
    grid-template-columns: 1fr;
  }

  .stock-doc-aside-panel {
    position: static;
  }

  .stock-doc-detail-bottom {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .stock-doc-search-add span {
    display: none;
  }
}

/* ---------------------------------------------------------------------------
   Suppliers list + detail modal tabs
   --------------------------------------------------------------------------- */
.td-link-btn {
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  cursor: pointer;
  color: inherit;
}

.td-link-btn:hover .td-main {
  color: var(--af-primary);
}

.td-action-btn.is-danger {
  color: var(--af-danger);
  border-color: color-mix(in srgb, var(--af-danger) 35%, var(--border));
}

.td-action-btn.is-danger:hover {
  background: var(--red-50);
  color: var(--red-800);
}

.supplier-modal-header {
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.supplier-modal-heading {
  min-width: 0;
  flex: 1;
}

.supplier-modal-header .modal-title {
  font-size: 1.15rem;
  font-weight: 650;
  margin-bottom: 4px;
}

.supplier-modal-header .modal-sub {
  font-size: var(--fs-sm);
  color: var(--text-3);
}

.supplier-modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

.supplier-modal-close {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  color: var(--text-2);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.supplier-modal-close:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.supplier-modal-body {
  padding-top: 0;
}

.supplier-tabs {
  border-bottom: 0.5px solid var(--border);
  gap: 4px;
  flex-wrap: wrap;
}

.supplier-tabs .nav-link {
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--text-2);
  font-size: var(--fs-md);
  font-weight: 500;
  padding: 10px 12px;
  background: transparent;
}

.supplier-tabs .nav-link:hover {
  color: var(--af-primary);
}

.supplier-tabs .nav-link.active {
  color: var(--af-primary);
  border-bottom-color: var(--af-primary);
  background: transparent;
}

.supplier-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  margin-left: 4px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text-3);
  font-size: 11px;
  font-weight: 600;
}

.supplier-tabs .nav-link.active .supplier-tab-count {
  background: var(--blue-50);
  color: var(--af-primary);
}

.supplier-tab-content {
  min-height: 220px;
}

.supplier-debt-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.supplier-debt-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 0.5px solid var(--border);
  background: var(--surface-soft);
  min-width: 0;
}

.supplier-debt-card strong {
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.supplier-debt-card.is-total {
  background: var(--blue-50);
  border-color: color-mix(in srgb, var(--af-primary) 25%, var(--border));
}

.supplier-debt-card.is-total strong {
  color: var(--af-primary);
  font-size: 1.25rem;
}

.supplier-debt-hint {
  font-size: var(--fs-sm);
  color: var(--text-3);
}

.supplier-debt-payments-hd {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.supplier-debt-pay-form {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 0.5px solid var(--border);
  background: var(--surface-soft);
}

.supplier-debt-pay-form .form-label {
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 4px;
}

.entity-form-section {
  margin-bottom: 18px;
}

.entity-form-section:last-child {
  margin-bottom: 0;
}

.entity-form-sec-title {
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 0.5px solid var(--border);
}

.entity-form-modal .modal-sub {
  font-size: var(--fs-sm);
  color: var(--text-3);
  margin-top: 2px;
}

.entity-form-modal .modal-footer {
  gap: 8px;
}

@media (max-width: 992px) {
  .supplier-debt-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .supplier-debt-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------------------------------------------------------------------------
   Confirm modal (replace native window.confirm)
   --------------------------------------------------------------------------- */
.confirm-modal .modal-dialog {
  max-width: 400px;
}

.confirm-modal .modal-content {
  position: relative;
  border: 0.5px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 22px 56px rgba(18, 23, 43, 0.18);
  overflow: hidden;
  text-align: center;
}

.confirm-modal-x {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-3);
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  cursor: pointer;
  z-index: 2;
}

.confirm-modal-x:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.confirm-modal-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 28px 28px 8px;
}

.confirm-modal-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 1.55rem;
  margin-bottom: 4px;
}

.confirm-modal-icon.is-danger {
  background: var(--red-50);
  color: var(--af-danger);
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--af-danger) 8%, transparent);
}

.confirm-modal-icon.is-primary {
  background: var(--blue-50, #eef2ff);
  color: var(--af-primary);
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--af-primary) 8%, transparent);
}

.confirm-modal-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  max-width: 20em;
}

.confirm-modal-message {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-2);
  line-height: 1.5;
  max-width: 28em;
}

.confirm-modal-message[hidden],
.confirm-modal-hint[hidden] {
  display: none !important;
}

.confirm-modal-hint {
  margin: 0;
  padding: 10px 12px;
  width: 100%;
  border-radius: 10px;
  background: var(--red-50);
  color: #9b1c1f;
  font-size: 0.82rem;
  line-height: 1.45;
}

.confirm-modal.is-primary .confirm-modal-hint {
  background: var(--blue-50, #eef2ff);
  color: var(--af-primary-dark, #2a3eb1);
}

.confirm-modal-footer {
  border-top: 0;
  padding: 16px 24px 24px;
  gap: 10px;
  display: flex;
  justify-content: center;
}

.confirm-modal-btn-cancel,
.confirm-modal-btn-ok {
  min-width: 118px;
  min-height: 42px;
  border-radius: 10px;
  font-weight: 650;
}

.confirm-modal-btn-cancel {
  border: 0.5px solid var(--border-md);
  background: var(--surface);
  color: var(--text-2);
}

.confirm-modal-btn-cancel:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.confirm-modal-btn-ok.is-danger {
  border: none;
  background: var(--af-danger);
  color: #fff;
}

.confirm-modal-btn-ok.is-danger:hover {
  background: var(--red-800, #9b1c1f);
  color: #fff;
}

.confirm-modal-btn-ok.is-primary {
  border: none;
  background: var(--af-primary);
  color: #fff;
}

.confirm-modal-btn-ok.is-primary:hover {
  background: var(--af-primary-dark);
  color: #fff;
}

/* ---------------------------------------------------------------------------
   Customer form / detail (CRM)
   --------------------------------------------------------------------------- */
.cust-page-form {
  max-width: 980px;
}

.cust-form-panel .panel-body {
  padding: 20px 22px;
}

.cust-form-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.cust-form-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 20px;
  align-items: start;
  margin-bottom: 8px;
}

.cust-form-avatar .field {
  margin: 0;
}

.cust-form-avatar .entity-image-preview {
  width: 140px;
  height: 140px;
  border-radius: 999px;
  margin: 0 auto 10px;
}

.cust-form-avatar .entity-image-actions {
  justify-content: center;
  text-align: center;
}

.cust-form-section {
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  margin-top: 14px;
  background: var(--surface);
  overflow: hidden;
}

.cust-form-section>summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 650;
  color: var(--text);
  background: var(--surface-soft);
  user-select: none;
}

.cust-form-section>summary::-webkit-details-marker {
  display: none;
}

.cust-form-section>summary i {
  color: var(--text-3);
  transition: transform 0.15s ease;
}

.cust-form-section:not([open])>summary i {
  transform: rotate(180deg);
}

.cust-form-section-body {
  padding: 16px;
  border-top: 0.5px solid var(--border);
}

.cust-type-radios {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: center;
}

.cust-type-radios .form-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  min-height: 0;
  float: none;
}

.cust-type-radios .form-check-input {
  float: none;
  position: static;
  margin: 0;
  flex-shrink: 0;
}

.cust-type-radios .form-check-label {
  margin: 0;
  padding: 0;
  line-height: 1.3;
}

.cust-code {
  margin-left: 8px;
  font-size: 0.85em;
  font-weight: 600;
  color: var(--text-3);
}

.cust-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.cust-stat {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 0.5px solid var(--border);
  background: var(--surface);
}

.cust-stat-lbl {
  display: block;
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 4px;
}

.cust-stat-val {
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}

.cust-stat-val.is-primary {
  color: var(--af-primary);
}

.cust-tabs {
  border-bottom: 0.5px solid var(--border);
  gap: 4px;
  margin-bottom: 16px;
}

.cust-tabs .nav-link {
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  margin-bottom: -1px;
  color: var(--text-2);
  font-weight: 600;
  padding: 10px 14px;
  background: transparent;
}

.cust-tabs .nav-link:hover {
  color: var(--af-primary);
  border-color: transparent;
}

.cust-tabs .nav-link.active {
  color: var(--af-primary);
  border-bottom-color: var(--af-primary);
  background: transparent;
}

.cust-tab-content {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg, 12px);
  padding: 18px 20px;
}

.cust-detail-layout {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.cust-detail-avatar {
  text-align: center;
}

.cust-avatar-img,
.cust-avatar-fallback {
  width: 120px;
  height: 120px;
  border-radius: 999px;
  object-fit: cover;
  display: grid;
  place-items: center;
  margin: 0 auto;
  background: var(--surface-soft);
  border: 0.5px solid var(--border);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--af-primary);
}

.cust-detail-cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 28px;
}

.cust-detail-cols--single {
  grid-template-columns: 1fr;
  max-width: 560px;
}

.cust-kv {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 0;
  border-bottom: 0.5px solid var(--border);
  align-items: start;
}

.cust-kv span {
  color: var(--text-3);
  font-size: 13px;
}

.cust-kv strong {
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}

.cust-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  margin: 0 4px 4px 0;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 0.5px solid var(--border);
  font-size: 12px;
  font-weight: 500;
}

@media (max-width: 900px) {

  .cust-form-top,
  .cust-detail-layout,
  .cust-detail-cols,
  .cust-stats {
    grid-template-columns: 1fr;
  }

  .cust-kv {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

.creator-kyc-img {
  display: block;
  width: 100%;
  max-width: 420px;
  max-height: 260px;
  object-fit: contain;
  border-radius: 10px;
  border: 0.5px solid var(--border);
  background: var(--surface-soft);
}

.creator-bank-row {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px 16px;
  margin-bottom: 12px;
}

.creator-bank-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.creator-bank-head .app-form-check {
  min-height: 0;
}

.creator-channel-group>.input-group-text {
  width: 42px;
  justify-content: center;
  color: var(--text-3);
  background: var(--surface-soft);
}

.creator-doc-field .field {
  margin: 0;
}

.creator-doc-field .entity-image-field {
  display: block;
}

.creator-doc-field .entity-image-preview {
  width: 100%;
  height: 160px;
  border-radius: var(--radius-md);
  margin-bottom: 10px;
}

.creator-doc-field .entity-image-preview img {
  object-fit: contain;
}

.creator-doc-field .entity-image-actions {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.creator-doc-field .entity-image-actions .field-hint {
  flex: 1 1 100%;
}

.cust-form-fields {
  min-width: 0;
}

.cust-form-avatar .entity-image-field {
  max-width: 220px;
  justify-content: center;
}


/* ---------------------------------------------------------------------------
   App form layouts (create/edit pages)
   --------------------------------------------------------------------------- */
.app-form-narrow {
  max-width: 920px;
}

.app-form-panel .panel-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.app-form-panel .panel-body .form-label {
  margin-bottom: 6px;
}

.app-form-panel .form-control,
.app-form-panel .form-select {
  min-height: 40px;
}

.app-form-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  margin: 0;
  padding: 0;
  cursor: pointer;
}

.app-form-check .form-check-input {
  margin: 0;
  float: none;
}

.app-form-check .form-check-label {
  margin: 0;
  color: var(--text);
  font-weight: 500;
}

.app-form-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.app-form-lines {
  margin: 0;
}

.app-form-lines th,
.app-form-lines td {
  vertical-align: middle;
  padding: 10px 14px;
}

.app-form-lines thead th {
  white-space: nowrap;
}

.app-form-lines .form-control,
.app-form-lines .form-select {
  min-height: 38px;
}

.w-col-56 {
  width: 56px;
}

.w-col-160 {
  width: 160px;
}

@media (max-width: 768px) {
  .app-form-narrow {
    max-width: none;
  }

  .app-form-lines .w-col-100,
  .app-form-lines .w-col-140,
  .app-form-lines .w-col-160 {
    width: auto;
    min-width: 88px;
  }
}

/* ---------------------------------------------------------------------------
   Sales return workspace (POS-inspired)
   --------------------------------------------------------------------------- */
.sr-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  align-items: start;
  min-height: calc(100vh - 180px);
}

.sr-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.sr-lines {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 220px;
}

.sr-line-card {
  display: grid;
  grid-template-columns:
    28px minmax(88px, 110px) minmax(140px, 1.6fr) minmax(90px, 1fr) auto minmax(100px, 120px) minmax(72px, 96px) 32px;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.sr-line-card>input[type="hidden"] {
  display: none;
}

.sr-line-card .form-control,
.sr-line-card .form-select {
  min-height: 36px;
  border-radius: var(--radius-md);
}

.sr-line-index {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  background: var(--surface-soft);
  color: var(--text-3);
  font-size: 12px;
  font-weight: 650;
}

.sr-line-remove {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--af-danger);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
}

.sr-line-remove:hover {
  background: var(--red-50);
}

.sr-line-variant {
  color: #c2410c;
  font-weight: 500;
}

.sr-qty {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 36px;
  background: var(--surface-soft);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 2px;
  box-sizing: border-box;
}

.sr-qty-btn {
  width: 30px;
  height: 100%;
  min-height: 0;
  border: none;
  border-radius: calc(var(--radius-md) - 2px);
  background: var(--surface);
  color: var(--af-primary);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
}

.sr-qty-btn:hover {
  background: var(--blue-50, #eef2ff);
}

.sr-line-qty {
  width: 44px;
  height: 100% !important;
  min-height: 0 !important;
  border: none !important;
  background: transparent !important;
  padding: 0 2px !important;
  font-weight: 600;
}

.sr-line-total {
  font-size: 0.95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  text-align: right;
  white-space: nowrap;
}

.sr-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
  background: var(--af-primary);
  color: #fff;
}

.sr-order-ac {
  position: relative;
}

.sr-order-ac-input {
  position: relative;
}

.sr-order-ac-input>i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}

.sr-order-ac-input .form-control {
  padding-left: 36px;
  padding-right: 36px;
  border-radius: var(--radius-md);
}

.sr-order-ac-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-3);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.sr-order-ac-clear:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.sr-order-ac-list {
  position: absolute;
  z-index: 30;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 280px;
  overflow: auto;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 28px rgba(18, 23, 43, 0.12);
  padding: 4px;
}

.sr-order-ac-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
}

.sr-order-ac-item:hover {
  background: var(--blue-50, #eef2ff);
}

.sr-order-ac-item strong {
  font-size: 13px;
  color: var(--text);
}

.sr-order-ac-item span {
  font-size: 12px;
  color: var(--text-3);
}

.sr-order-ac-empty {
  padding: 12px;
  font-size: 13px;
  color: var(--text-3);
  text-align: center;
}

.sr-search {
  position: relative;
  flex: 1;
  min-width: 0;
}

.sr-search i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}

.sr-search input {
  width: 100%;
  height: 40px;
  border: none;
  border-radius: var(--radius-md);
  padding: 0 12px 0 36px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  outline: none;
}

.sr-toolbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.sr-toolbar-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

.sr-note {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg, 12px);
}

.sr-note>i {
  color: var(--text-3);
  flex-shrink: 0;
}

.sr-note .form-control {
  border: none;
  box-shadow: none;
  min-height: 36px;
  padding-left: 0;
  background: transparent;
}

.sr-aside {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 12px;
}

.sr-aside-card {
  padding: 14px 16px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg, 12px);
  box-shadow: var(--shadow-sm);
}

.sr-customer-hd {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.sr-summary-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--af-success);
  margin-bottom: 12px;
}

.sr-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 0.5px solid var(--border);
  font-size: 14px;
  color: var(--text-2);
}

.sr-summary-row strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.sr-summary-due {
  border-bottom: none;
  padding-top: 12px;
}

.sr-summary-due span,
.sr-summary-due strong {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--af-primary);
}

.sr-aside-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sr-submit {
  width: 100%;
  min-height: 48px;
  border: none;
  border-radius: 12px;
  background: var(--af-primary);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--af-primary) 28%, transparent);
}

.sr-submit:hover {
  background: var(--af-primary-dark);
}

.sr-submit-secondary {
  width: 100%;
  min-height: 42px;
  border: 0.5px solid var(--border-md);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text-2);
  font-weight: 600;
  cursor: pointer;
}

.sr-submit-secondary:hover {
  background: var(--surface-hover);
  color: var(--text);
}

@media (max-width: 1100px) {
  .sr-workspace {
    grid-template-columns: 1fr;
  }

  .sr-aside {
    position: static;
  }
}

@media (max-width: 900px) {
  .sr-line-card {
    grid-template-columns:
      28px minmax(0, 1fr) minmax(0, 1.4fr) auto minmax(90px, 110px) 72px 32px;
  }

  .sr-line-variant {
    grid-column: 2 / -2;
  }
}

@media (max-width: 640px) {
  .sr-line-card {
    grid-template-columns: 28px minmax(0, 1fr) 32px;
  }

  .sr-line-sku,
  .sr-line-title,
  .sr-line-variant,
  .sr-qty,
  .sr-line-price,
  .sr-line-total {
    grid-column: 2;
  }

  .sr-line-remove {
    grid-column: 3;
    grid-row: 1;
  }

  .sr-line-total {
    text-align: left;
  }

  .sr-toolbar-btn span {
    display: none;
  }
}


/* —— Loyalty —— */
.loyalty-card-thumb {
  width: 72px;
  height: 44px;
  border-radius: 6px;
  overflow: hidden;
  background: #e5e7eb;
  border: 0.5px solid var(--border, #e5e7eb);
}

.loyalty-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.loyalty-card-placeholder {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #d1d5db, #9ca3af);
}

.loyalty-radio-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.loyalty-radio {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  font-size: var(--fs-md, 13px);
  color: var(--text-2, #4b5563);
  line-height: 1.5;
  cursor: pointer;
}

.loyalty-radio input {
  margin-top: 3px;
  flex-shrink: 0;
}

.loyalty-settings-form .panel-spaced+.panel-spaced {
  margin-top: var(--space-4, 16px);
}

.entity-thumb-round {
  border-radius: 999px;
}

/* Trong lưới nhiều cột, nhãn/hint dài khác nhau vẫn giữ input thẳng hàng */
.aff-field-grid>.aff-field>.form-control,
.aff-field-grid>.aff-field>.form-select,
.aff-field-grid>.aff-field>.input-group,
.aff-field-grid>.aff-field>textarea {
  margin-top: auto;
}

/* ---------------------------------------------------------------------------
   Product picker (collections / promotions)
   --------------------------------------------------------------------------- */
.product-picker {
  border: 0.5px solid var(--border-md);
  border-radius: var(--radius-md);
  background: var(--surface);
  overflow: visible;
}

.product-picker-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-bottom: 0.5px solid var(--border);
  flex-wrap: wrap;
}

.product-picker-search {
  position: relative;
  flex: 1;
  min-width: 180px;
}

.product-picker-search>.ti {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
  font-size: 16px;
  z-index: 1;
}

.product-picker-search-input {
  width: 100%;
  height: 40px;
  padding: 8px 12px 8px 36px;
  border: 0.5px solid var(--border-md);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-md);
  font-family: var(--font);
  outline: none;
}

.product-picker-search-input:focus {
  border-color: var(--af-primary);
  box-shadow: var(--focus-ring);
}

.product-picker-results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 50;
  max-height: 280px;
  overflow: auto;
  background: var(--surface);
  border: 0.5px solid var(--border-md);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

.product-picker-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-bottom: 0.5px solid var(--border);
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: var(--text);
}

.product-picker-result-item:last-child {
  border-bottom: 0;
}

.product-picker-result-item:hover {
  background: var(--surface-hover);
}

.product-picker-result-thumb,
.product-picker-thumb {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-soft, #f3f4f6);
  border: 0.5px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-picker-result-thumb img,
.product-picker-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.product-picker-thumb-fallback {
  color: var(--text-3);
  font-size: 16px;
}

.product-picker-thumb-fallback.sm {
  font-size: 14px;
}

.product-picker-result-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.product-picker-result-title {
  font-size: var(--fs-md);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-picker-result-price {
  font-size: var(--fs-sm);
  color: var(--text-3);
}

.product-picker-results-empty {
  padding: 14px;
  text-align: center;
  color: var(--text-3);
  font-size: var(--fs-md);
}

.product-picker-list {
  min-height: 72px;
}

.product-picker-empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--text-3);
  font-size: var(--fs-md);
}

.product-picker-empty .ti {
  display: block;
  font-size: 28px;
  margin-bottom: 8px;
}

.product-picker-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 88px 120px 36px;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 0.5px solid var(--border);
}

.product-picker-row:last-child {
  border-bottom: 0;
}

.product-picker-title {
  font-size: var(--fs-md);
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-picker.is-mode-simple .product-picker-qty,
.product-picker.is-mode-simple .product-picker-price,
.product-picker.is-mode-bundle .product-picker-price {
  display: none;
}

.product-picker-retail {
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
  min-width: 72px;
  text-align: right;
}

.product-picker-qty,
.product-picker-price {
  height: 36px;
  min-height: 36px;
  padding: 6px 10px;
  text-align: center;
}

.product-picker-price {
  text-align: right;
}

.product-picker-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-top: 0.5px solid var(--border);
  flex-wrap: wrap;
}

.product-picker-sum {
  margin: 0;
  padding: 10px 14px 14px;
  border-top: 0.5px solid var(--border);
}

.product-picker-hint {
  margin: 8px 0 0;
  padding: 0 2px;
}

.product-picker-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.product-picker-add-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--af-primary);
  color: #fff;
  font-size: 12px;
}

.product-picker-pager {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.product-picker-page-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 0.5px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-2);
  font-size: var(--fs-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.product-picker-page-btn:hover:not(:disabled) {
  background: var(--surface-hover);
}

.product-picker-page-btn.is-active {
  border-color: var(--af-primary);
  color: var(--af-primary);
  font-weight: 600;
}

.product-picker-page-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

@media (max-width: 720px) {
  .product-picker-row {
    grid-template-columns: 40px minmax(0, 1fr) 36px;
    grid-template-areas:
      "thumb title remove"
      "thumb qty price";
  }

  .product-picker-thumb {
    grid-area: thumb;
  }

  .product-picker-title {
    grid-area: title;
  }

  .product-picker-qty {
    grid-area: qty;
  }

  .product-picker-price {
    grid-area: price;
  }

  .product-picker-row .td-action-btn {
    grid-area: remove;
    justify-self: end;
  }
}

/* —— Tenant settings hub —— */
.ts-hub-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
}

.ts-hub-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 12px);
  padding: var(--space-4) var(--space-5);
  text-decoration: none;
  color: inherit;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.ts-hub-card:hover {
  border-color: var(--af-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  color: inherit;
}

.ts-hub-card-hd {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
}

.ts-hub-card-hd>i {
  font-size: 1.25rem;
  color: var(--af-primary);
}

.ts-hub-card-hd strong {
  font-size: var(--fs-base);
  font-weight: 600;
}

.ts-hub-card-desc {
  margin: 0;
  font-size: var(--fs-md);
  color: var(--text-2);
  line-height: 1.45;
}

.breadcrumb-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-md);
  color: var(--text-2);
}

.breadcrumb-nav a {
  color: var(--af-primary);
  text-decoration: none;
}

.breadcrumb-nav a:hover {
  text-decoration: underline;
}

.ts-form-rows {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 520px;
}

.ts-form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.ts-form-label {
  margin: 0;
  font-size: var(--fs-base);
  font-weight: 500;
  color: var(--text-1);
}

.ts-num {
  width: 120px;
  flex-shrink: 0;
}

.ts-event-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.ts-event-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 12px);
  padding: var(--space-3) var(--space-4);
}

.ts-event-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

@media (max-width: 900px) {
  .ts-hub-grid {
    grid-template-columns: 1fr;
  }
}

/* —— HR dashboard —— */
.hr-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.hr-kpi-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 12px);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.hr-kpi-card:hover {
  border-color: var(--af-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  color: inherit;
}

.hr-kpi-ico {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.hr-kpi-card.is-blue .hr-kpi-ico {
  background: #DBEAFE;
  color: #1D4ED8;
}

.hr-kpi-card.is-green .hr-kpi-ico {
  background: #DCFCE7;
  color: #16A34A;
}

.hr-kpi-card.is-amber .hr-kpi-ico {
  background: #FEF3C7;
  color: #D97706;
}

.hr-kpi-card.is-red .hr-kpi-ico {
  background: #FEE2E2;
  color: #DC2626;
}

.hr-kpi-card.is-purple .hr-kpi-ico {
  background: #EDE9FE;
  color: #7C3AED;
}

.hr-kpi-card.is-blue .hr-kpi-val {
  color: #1D4ED8;
}

.hr-kpi-card.is-green .hr-kpi-val {
  color: #16A34A;
}

.hr-kpi-card.is-amber .hr-kpi-val {
  color: #D97706;
}

.hr-kpi-card.is-red .hr-kpi-val {
  color: #DC2626;
}

.hr-kpi-card.is-purple .hr-kpi-val {
  color: #7C3AED;
}

.hr-kpi-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.hr-kpi-lbl {
  font-size: var(--fs-sm);
  color: var(--text-2);
}

.hr-kpi-val {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.2;
}

.hr-dash-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.hr-dash-wide {
  grid-column: 1 / -1;
}

.hr-shortcut-list {
  display: flex;
  flex-direction: column;
  padding: 0 var(--space-4) var(--space-4);
  gap: 2px;
}

.hr-shortcut-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md, 8px);
  text-decoration: none;
  color: var(--text);
  font-weight: 500;
}

.hr-shortcut-list a:hover {
  background: var(--surface-hover);
  color: var(--af-primary);
}

.hr-shortcut-list a>i {
  color: var(--text-2);
  font-size: 1.1rem;
}

@media (max-width: 1100px) {
  .hr-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {

  .hr-kpi-grid,
  .hr-dash-grid {
    grid-template-columns: 1fr;
  }

  .hr-dash-wide {
    grid-column: auto;
  }
}

/* ---------------------------------------------------------------------------
   Help pages (Hướng dẫn / Hỗ trợ)
   --------------------------------------------------------------------------- */
.help-hero {
  position: relative;
  overflow: hidden;
  padding: 26px 28px;
  margin-bottom: var(--space-4);
  border-radius: var(--radius-lg);
  background: linear-gradient(125deg, var(--af-sidebar) 0%, var(--af-primary-dark) 58%, var(--af-teal) 145%);
  color: #fff;
}

.help-hero::after {
  content: "";
  position: absolute;
  top: -90px;
  right: -70px;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  pointer-events: none;
}

.help-hero-inner {
  position: relative;
  z-index: 1;
  max-width: 46rem;
}

.help-hero-logo {
  display: block;
  height: 32px;
  width: auto;
  margin-bottom: 14px;
}

.help-hero-title {
  margin: 0 0 6px;
  font-size: var(--fs-5xl);
  font-weight: 650;
  letter-spacing: -0.01em;
}

.help-hero-sub {
  margin: 0;
  font-size: var(--fs-base);
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.8);
}

.help-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: 18px;
}

.help-hero-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  border: 0.5px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: var(--fs-base);
  font-weight: 500;
  text-decoration: none;
  transition: background var(--transition-fast);
}

.help-hero-btn:hover {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.help-hero-btn.is-solid {
  background: #fff;
  border-color: #fff;
  color: var(--af-primary-dark);
}

.help-hero-btn.is-solid:hover {
  background: var(--blue-50);
  color: var(--af-primary-dark);
}

.help-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.help-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-3);
}

.help-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text);
  text-decoration: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

a.help-card:hover {
  border-color: var(--blue-soft);
  box-shadow: 0 4px 16px rgba(61, 90, 254, 0.08);
  color: var(--text);
  text-decoration: none;
}

.help-card-ico {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--blue-50);
  color: var(--af-primary);
  font-size: 19px;
}

.help-card-ico.is-teal {
  background: var(--teal-50);
  color: var(--af-teal);
}

.help-card-ico.is-amber {
  background: var(--amber-50);
  color: var(--amber-800);
}

.help-card-body {
  min-width: 0;
}

.help-card-title {
  display: block;
  font-weight: 600;
  line-height: 1.3;
}

.help-card-desc {
  display: block;
  margin-top: 3px;
  font-size: var(--fs-sm);
  color: var(--text-3);
  line-height: 1.45;
}

.help-card-meta {
  display: block;
  margin-top: 8px;
  font-size: var(--fs-md);
  font-weight: 500;
  color: var(--af-primary);
  word-break: break-word;
}

.help-card-arrow {
  align-self: center;
  margin-left: auto;
  color: var(--text-3);
  flex-shrink: 0;
}

.help-steps {
  list-style: none;
  counter-reset: help-step;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: var(--space-3);
  margin: 0;
  padding: 0;
}

.help-step {
  counter-increment: help-step;
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-tint);
}

.help-step::before {
  content: counter(help-step, decimal-leading-zero);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-pill);
  background: var(--af-primary);
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: 700;
}

.help-step strong {
  display: block;
  margin-bottom: 2px;
}

.help-step p {
  margin: 0;
  font-size: var(--fs-md);
  color: var(--text-2);
  line-height: 1.55;
}

.help-faq-item {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.help-faq-item+.help-faq-item {
  margin-top: var(--space-2);
}

.help-faq-item>summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 12px 14px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.help-faq-item>summary::-webkit-details-marker {
  display: none;
}

.help-faq-item>summary i {
  color: var(--text-3);
  transition: transform 0.15s ease;
}

.help-faq-item:not([open])>summary i {
  transform: rotate(180deg);
}

.help-faq-body {
  padding: 0 14px 14px;
  font-size: var(--fs-base);
  color: var(--text-2);
  line-height: 1.6;
}

@media (max-width: 767.98px) {
  .help-hero {
    padding: 20px 18px;
  }

  .help-hero-title {
    font-size: var(--fs-4xl);
  }
}


/* ---------------------------------------------------------------------------
   Chat — kết nối kênh (card tích hợp + webhook)
--------------------------------------------------------------------------- */
.chat-conn-webhook {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 7px 8px 7px 10px;
  border-radius: var(--radius-md);
  background: var(--surface-soft, #f8fafc);
  border: 1px solid var(--border);
}

.chat-conn-webhook.is-block {
  margin-top: 0;
}

.chat-conn-webhook-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
}

.chat-conn-webhook-url {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11.5px;
  color: var(--text-2);
  background: transparent;
  padding: 0;
}

.chat-conn-copy {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}

.chat-conn-copy:hover {
  background: var(--surface-hover);
  color: var(--af-primary, #3d5afe);
}

.chat-conn-copy.is-copied {
  background: #ecfdf3;
  color: #067647;
}

.chat-conn-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  margin-bottom: 18px;
  border-radius: var(--radius-md);
  background: var(--surface-soft, #f8fafc);
  border: 1px solid var(--border);
}

.chat-conn-toggle-title {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
}

.chat-conn-toggle-desc {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-3);
}

.chat-conn-switch {
  margin: 0;
  padding-left: 2.6em;
  flex-shrink: 0;
}

.chat-conn-switch .form-check-input {
  width: 2.2em;
  height: 1.2em;
  margin-top: 0;
  cursor: pointer;
}

.chat-conn-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
}

.chat-conn-note {
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-3);
}

@media (max-width: 720px) {
  .chat-conn-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------------------------------------------------------------------------
   Chat đa kênh — 3 pane (list / thread / CRM)
--------------------------------------------------------------------------- */
.chat-shell {
  display: grid;
  grid-template-columns: minmax(260px, 300px) minmax(0, 1fr) minmax(280px, 340px);
  gap: 0;
  /* Trừ topbar + page-header + padding để ô nhập tin nhắn luôn nằm trong khung nhìn */
  height: calc(100dvh - 210px);
  min-height: 420px;
  max-height: 810px;
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
}

.chat-list {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 0.5px solid var(--border);
  background: var(--surface-2, var(--surface));
}

.chat-list-hd {
  padding: 12px;
  border-bottom: 0.5px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-list-search {
  position: relative;
  display: flex;
  align-items: center;
}

.chat-list-search>i {
  position: absolute;
  left: 10px;
  color: var(--text-3);
  font-size: 1rem;
  pointer-events: none;
}

.chat-list-search .inp {
  padding-left: 32px;
  width: 100%;
}

.chat-list-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chat-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  border: 0.5px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-size: 12px;
  text-decoration: none;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.chat-chip:hover {
  background: var(--surface-hover);
}

.chat-chip.is-active {
  background: rgba(61, 90, 254, 0.1);
  border-color: rgba(61, 90, 254, 0.35);
  color: var(--af-primary);
}

.chat-list-scroll {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.chat-list-item {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  text-decoration: none;
  color: inherit;
  border-bottom: 0.5px solid var(--border);
  transition: background var(--transition-fast);
}

.chat-list-item:hover {
  background: var(--surface-hover);
}

.chat-list-item.is-active {
  background: rgba(61, 90, 254, 0.08);
  box-shadow: inset 2px 0 0 var(--af-primary);
}

.chat-list-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface);
  border: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--af-primary);
  flex-shrink: 0;
}

.chat-list-avatar.is-lg {
  width: 44px;
  height: 44px;
}

.chat-list-body {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.chat-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.chat-list-name {
  font-weight: 600;
  font-size: var(--fs-sm);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-list-item.has-unread .chat-list-name,
.chat-list-item.needs-reply .chat-list-name {
  font-weight: 700;
}

.chat-list-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.chat-unread,
.chat-unanswered {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

.chat-unread {
  background: var(--af-danger);
  color: #fff;
}

.chat-unanswered {
  background: #f59e0b;
  color: #fff;
}

.chat-tag-wait {
  background: rgba(245, 158, 11, 0.15);
  color: #b45309;
}

.chat-list-time {
  font-size: 11px;
  color: var(--text-3);
  flex-shrink: 0;
}

.chat-list-preview.is-emphasis {
  color: var(--text);
  font-weight: 500;
}

.chat-list-preview {
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-list-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}

.chat-tag {
  font-size: 10px;
  line-height: 1.4;
  padding: 1px 6px;
  border-radius: 4px;
  border: 0.5px solid var(--border);
  color: var(--text-2);
  background: var(--surface);
}

.chat-tag-channel {
  color: var(--af-primary);
  border-color: rgba(61, 90, 254, 0.25);
  background: rgba(61, 90, 254, 0.06);
}

.chat-tag-wf-1 {
  color: var(--af-danger);
  border-color: var(--red-soft);
  background: var(--red-50);
}

.chat-tag-wf-2 {
  color: #b45309;
  border-color: var(--amber-border);
  background: var(--amber-50);
}

.chat-tag-wf-3 {
  color: #15803d;
  border-color: #86efac;
  background: #f0fdf4;
}

.chat-thread {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border-right: 0.5px solid var(--border);
}

.chat-thread-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 0.5px solid var(--border);
}

.chat-thread-who {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.chat-thread-sub {
  font-size: 12px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}

.chat-thread-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: linear-gradient(180deg, rgba(61, 90, 254, 0.03), transparent 140px);
}

.chat-bubble {
  max-width: min(78%, 520px);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-bubble.is-in {
  align-self: flex-start;
}

.chat-bubble.is-out {
  align-self: flex-end;
}

.chat-bubble-body {
  padding: 10px 12px;
  border-radius: 14px;
  font-size: var(--fs-sm);
  line-height: 1.45;
}

.chat-bubble.is-in .chat-bubble-body {
  background: #fff4e8;
  border: 0.5px solid #f5d5b8;
  color: var(--text-1);
  border-bottom-left-radius: 4px;
}

.chat-bubble.is-out .chat-bubble-body {
  background: rgba(61, 90, 254, 0.12);
  border: 0.5px solid rgba(61, 90, 254, 0.22);
  color: var(--text-1);
  border-bottom-right-radius: 4px;
}

.chat-bubble-meta {
  font-size: 11px;
  color: var(--text-3);
  padding: 0 4px;
}

.chat-bubble.is-out .chat-bubble-meta {
  text-align: right;
}

.chat-reply {
  padding: 10px 14px 12px;
  border-top: 0.5px solid var(--border);
  background: var(--surface);
}

.chat-composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.chat-composer-tools {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  padding-bottom: 4px;
}

.chat-tool-btn {
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  color: var(--text-3);
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.15rem;
  margin: 0;
}

.chat-tool-btn:hover {
  background: var(--surface-hover);
  color: var(--af-primary);
}

.chat-emoji-panel {
  position: absolute;
  bottom: 40px;
  left: 0;
  z-index: 20;
  width: 260px;
  max-height: 180px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 2px;
  padding: 8px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.chat-emoji-item {
  border: 0;
  background: transparent;
  font-size: 1.25rem;
  line-height: 1.4;
  cursor: pointer;
  border-radius: 6px;
  padding: 4px;
}

.chat-emoji-item:hover {
  background: var(--surface-hover);
}

.chat-composer-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-composer-main textarea {
  width: 100%;
  resize: none;
  min-height: 42px;
  max-height: 120px;
  border-radius: 999px;
  padding: 10px 16px;
}

.chat-attach-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 10px;
  background: var(--surface-soft);
  border: 0.5px solid var(--border);
  font-size: 12px;
  color: var(--text-2);
}

.chat-attach-preview img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
}

.chat-attach-preview span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-preview-clear {
  border: 0;
  background: transparent;
  font-size: 1.1rem;
  color: var(--text-3);
  cursor: pointer;
  line-height: 1;
}

.chat-send {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: var(--af-amber);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: filter var(--transition-fast);
}

.chat-send:hover {
  filter: brightness(0.95);
}

.chat-attach-img {
  display: block;
  margin-bottom: 6px;
}

.chat-attach-img img {
  max-width: min(240px, 100%);
  max-height: 220px;
  border-radius: 10px;
  display: block;
  object-fit: cover;
}

.chat-attach-file {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.55);
  border: 0.5px solid var(--border);
  text-decoration: none;
  color: inherit;
  font-size: 13px;
  margin-bottom: 6px;
}

.chat-attach-file small {
  color: var(--text-3);
}

.chat-bubble-text {
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.chat-empty-lg {
  flex: 1;
  justify-content: center;
}

.chat-empty i {
  font-size: 2rem;
  opacity: 0.5;
}

/* CRM right pane */
.chat-crm {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--surface);
}

.chat-crm-tabs {
  display: flex;
  border-bottom: 0.5px solid var(--border);
  flex-shrink: 0;
}

.chat-crm-tab {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 12px 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-3);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -0.5px;
}

.chat-crm-tab.is-active {
  color: var(--af-primary);
  border-bottom-color: var(--af-primary);
}

.chat-crm-scroll {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.chat-crm-pane {
  display: none;
  padding: 14px;
  flex-direction: column;
  gap: 14px;
}

.chat-crm-pane.is-active {
  display: flex;
}

.chat-crm-profile {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-wf-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chat-wf-form {
  margin: 0;
}

.chat-wf-btn {
  border: 0.5px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
}

.chat-wf-btn.is-active {
  background: var(--af-amber);
  border-color: var(--af-amber);
  color: #fff;
  font-weight: 600;
}

.chat-crm-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-crm-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-3);
}

.chat-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-2);
}

.chat-pipeline {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chat-pipe-btn {
  border: 0.5px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-size: 11px;
  padding: 5px 8px;
  border-radius: 6px;
  cursor: pointer;
}

.chat-pipe-btn.is-active {
  background: rgba(61, 90, 254, 0.12);
  border-color: rgba(61, 90, 254, 0.35);
  color: var(--af-primary);
  font-weight: 600;
}

.chat-crm-hint {
  font-size: 12px;
  color: var(--text-3);
}

.chat-crm-hint.is-ok {
  color: #15803d;
}

.chat-crm-hint.is-err {
  color: var(--af-danger);
}

.chat-product-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-product-card {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.chat-product-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
}

.chat-product-var,
.chat-product-meta {
  color: var(--text-3);
  font-size: 11px;
}

.chat-product-meta .is-err {
  color: var(--af-danger);
}

.chat-order-cart {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-cart-row {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
}

.chat-cart-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
}

.chat-cart-info span {
  color: var(--text-3);
  font-size: 11px;
}

.chat-cart-qty {
  display: flex;
  align-items: center;
  gap: 4px;
}

.chat-cart-qty button {
  width: 26px;
  height: 26px;
  border: 0.5px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chat-order-total {
  font-size: 14px;
  padding: 4px 0;
}

.chat-crm .w-100 {
  width: 100%;
}

@media (max-width: 1200px) {
  .chat-shell {
    grid-template-columns: minmax(220px, 260px) 1fr minmax(260px, 300px);
  }
}

@media (max-width: 960px) {
  .chat-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: auto;
    max-height: none;
  }

  .chat-list {
    max-height: 260px;
    border-right: 0;
    border-bottom: 0.5px solid var(--border);
  }

  .chat-thread {
    border-right: 0;
    min-height: 420px;
  }

  .chat-crm {
    border-top: 0.5px solid var(--border);
    max-height: 480px;
  }
}

/* ---------------------------------------------------------------------------
   Công cụ tính thuế HKD
--------------------------------------------------------------------------- */
.tax-tool {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 16px;
  align-items: start;
  max-width: 1200px;
}

.tax-tool-main,
.tax-tool-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.tax-tool-side {
  position: sticky;
  top: 16px;
}

.tax-tool-side .tax-edu-grid {
  grid-template-columns: 1fr;
}

@media (max-width: 960px) {
  .tax-tool {
    grid-template-columns: 1fr;
  }

  .tax-tool-side {
    position: static;
  }
}

.tax-card {
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 18px 20px;
}

.tax-card-hd {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 14px;
  color: var(--text-1);
}

.tax-card-hd i {
  color: var(--af-primary);
}

.tax-intro p {
  margin: 0 0 14px;
  line-height: 1.55;
  color: var(--text-2);
}

.tax-intro p>i {
  color: var(--af-primary);
  margin-right: 4px;
}

.tax-legal ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.55;
}

.tax-crm-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 6px;
}

.tax-form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 720px) {
  .tax-form-grid {
    grid-template-columns: 1fr 1fr;
  }

  .tax-form-grid .tax-field:last-of-type {
    grid-column: 1 / -1;
  }
}

.tax-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--text-2);
}

.tax-field em {
  color: var(--af-danger);
  font-style: normal;
}

.tax-field small {
  color: var(--text-3);
  font-size: 12px;
}

.tax-submit {
  margin-top: 14px;
  background: linear-gradient(135deg, #5b6cff, #7c3aed);
  border: 0;
}

.tax-req-note {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--text-3);
}

.tax-result-hero {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 0.5px solid rgba(91, 108, 255, 0.25);
  background: var(--surface);
}

.tax-result-hero-hd {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  color: #fff;
  font-weight: 700;
  background: linear-gradient(135deg, #4f6ef7, #7c3aed);
}

.tax-result-hero-bd {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  padding: 16px 18px;
}

@media (min-width: 720px) {
  .tax-result-hero-bd {
    grid-template-columns: 1.2fr 1fr;
    align-items: stretch;
  }
}

.tax-result-lines {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tax-result-line {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  border: 0.5px solid var(--border);
  font-size: 14px;
  color: var(--text-2);
}

.tax-result-total {
  border-radius: var(--radius-md);
  padding: 18px 16px;
  background: linear-gradient(135deg, #5b6cff, #7c3aed);
  color: #fff;
  text-align: center;
}

.tax-result-total-lbl {
  font-size: 13px;
  opacity: 0.9;
}

.tax-result-total-val {
  font-size: 1.45rem;
  font-weight: 800;
  margin: 6px 0;
  letter-spacing: -0.02em;
}

.tax-result-total-sub {
  font-size: 12px;
  opacity: 0.85;
}

.tax-optimal {
  border-style: dashed;
  border-color: rgba(91, 108, 255, 0.45);
  background: rgba(91, 108, 255, 0.04);
}

.tax-optimal p,
.tax-optimal ul {
  margin: 0;
  color: #166534;
  font-size: 14px;
  line-height: 1.5;
}

.tax-optimal ul {
  margin-top: 8px;
  padding-left: 18px;
}

.tax-group-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(91, 108, 255, 0.15), rgba(124, 58, 237, 0.15));
  color: var(--af-primary);
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 14px;
}

.tax-ob-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 720px) {
  .tax-ob-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.tax-ob-card {
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  background: var(--surface-soft);
}

.tax-ob-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(91, 108, 255, 0.1);
  color: var(--af-primary);
  margin-bottom: 8px;
}

.tax-ob-title {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 6px;
}

.tax-ob-body {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.45;
}

.tax-ob-list {
  margin: 0;
  padding-left: 16px;
  font-size: 13px;
  color: var(--text-2);
}

.tax-method-block {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 0.5px solid var(--border);
}

.tax-method-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.tax-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 0.5px solid var(--border);
  font-size: 13px;
  color: var(--text-1);
}

.tax-pill::before {
  content: "→";
  color: var(--af-primary);
  font-weight: 700;
}

.tax-filing-docs,
.tax-filing-deadlines {
  border-radius: var(--radius-md);
  padding: 14px;
  margin-top: 10px;
}

.tax-filing-docs {
  background: var(--surface-soft);
  border: 0.5px solid var(--border);
}

.tax-filing-deadlines {
  background: rgba(124, 58, 237, 0.06);
  border: 0.5px solid rgba(124, 58, 237, 0.18);
}

.tax-check-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  color: var(--text-2);
}

.tax-check-list i {
  color: #16a34a;
  margin-right: 4px;
}

.tax-filing-note {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--af-danger);
}

.tax-filing-deadlines ul {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.55;
}

.tax-params {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  border: 0.5px solid var(--border);
  margin-bottom: 12px;
}

@media (min-width: 640px) {
  .tax-params {
    grid-template-columns: 1fr 1fr;
  }
}

.tax-params>div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
}

.tax-params span {
  color: var(--text-3);
  font-size: 12px;
}

.tax-accent {
  color: var(--af-primary);
}

.tax-blue {
  color: #2563eb;
}

.tax-step-note {
  font-size: 13px;
  color: var(--text-2);
  margin: 0 0 10px;
}

.tax-step-note i {
  color: #16a34a;
}

.tax-calc-banner {
  background: rgba(59, 130, 246, 0.12);
  color: #1d4ed8;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.03em;
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 12px;
}

.tax-steps {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.5;
}

.tax-formula {
  color: var(--text-3);
  font-size: 12px;
  margin: 4px 0;
}

.tax-step-total {
  padding: 12px;
  border-radius: var(--radius-md);
  background: rgba(91, 108, 255, 0.08);
  border: 0.5px solid rgba(91, 108, 255, 0.2);
  list-style-position: inside;
}

.tax-edu-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 720px) {
  .tax-edu-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.tax-edu {
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  background: var(--surface-soft);
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.5;
}

.tax-edu h3 {
  font-size: 14px;
  margin: 0 0 8px;
  color: var(--text-1);
}

.tax-example {
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(91, 108, 255, 0.06);
  border: 0.5px dashed rgba(91, 108, 255, 0.3);
}
/* ---------------------------------------------------------------------------
   Settings forms: permission matrix + warehouse ACL picker
   --------------------------------------------------------------------------- */

/* Tránh hộp alert rỗng khi validation summary không có lỗi. */
.validation-summary-valid {
  display: none;
}

.link-btn {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-size: var(--fs-md);
  font-weight: 500;
  color: var(--brand-accent);
  cursor: pointer;
}

.link-btn:hover {
  color: var(--brand-accent-dark);
  text-decoration: underline;
}

.role-form .app-form-check {
  min-height: 40px;
}

.perm-matrix-hd {
  align-items: flex-start;
}

.perm-matrix-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.tool-sep {
  width: 1px;
  height: 14px;
  background: var(--border-md);
}

.perm-search {
  position: relative;
}

.perm-search i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 15px;
  color: var(--text-3);
  pointer-events: none;
}

.perm-search .form-control {
  width: 220px;
  min-height: 36px;
  padding-left: 32px;
}

.perm-groups {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.perm-group {
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  overflow: hidden;
}

.perm-group-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border-bottom: 0.5px solid var(--border);
}

.perm-group-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  cursor: pointer;
}

.perm-group-toggle .form-check-input {
  margin: 0;
  float: none;
}

.perm-group-name {
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--text);
}

.perm-group-count {
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
}

.perm-list {
  display: flex;
  flex-direction: column;
  padding: 6px 0;
}

.perm-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.12s ease;
}

.perm-item:hover {
  background: var(--surface-hover);
}

.perm-item .form-check-input {
  margin: 2px 0 0;
  float: none;
  flex: 0 0 auto;
}

.perm-item-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.perm-item-label {
  font-size: var(--fs-base);
  color: var(--text);
  line-height: 1.35;
}

.perm-item-key {
  font-size: var(--fs-xs);
  color: var(--text-3);
  background: none;
  padding: 0;
}

.perm-matrix-ft {
  position: sticky;
  bottom: 0;
  background: var(--surface);
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
}

.acl-picker {
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  overflow: hidden;
}

.acl-picker-hd {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  background: var(--surface);
  border-bottom: 0.5px solid var(--border);
}

.acl-picker-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: var(--fs-base);
}

.acl-picker-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.acl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 2px;
  padding: 8px;
}

.acl-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s ease;
}

.acl-item:hover {
  background: var(--surface-hover);
}

.acl-item .form-check-input {
  margin: 0;
  float: none;
  flex: 0 0 auto;
}

.acl-item-name {
  font-size: var(--fs-base);
  color: var(--text);
}

.acl-picker-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 22px 14px;
  font-size: var(--fs-base);
  color: var(--text-3);
}

.wh-provider-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wh-provider-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.2fr) auto minmax(140px, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.wh-provider-check,
.wh-provider-default {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: var(--fs-base);
  cursor: pointer;
}

.wh-provider-default {
  color: var(--text-2);
  white-space: nowrap;
}

@media (max-width: 768px) {
  .perm-search .form-control {
    width: 100%;
  }

  .perm-matrix-tools {
    width: 100%;
  }

  .wh-provider-row {
    grid-template-columns: 1fr;
  }
}

/* Reconciliation (Đối soát) */
.recon-tabs {
  margin-bottom: var(--space-3, 12px);
}

.recon-stats {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: var(--space-3, 12px);
}

@media (max-width: 1200px) {
  .recon-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .recon-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .recon-stats {
    grid-template-columns: 1fr;
  }
}

.recon-diff-pos {
  color: var(--teal-700, #0f766e);
  font-weight: 600;
}

.recon-diff-neg {
  color: var(--red-800, #991b1b);
  font-weight: 600;
}

.wh-map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.85fr);
  gap: 16px;
  align-items: start;
}

.wh-map-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.wh-map-wh-switch {
  min-width: 220px;
}

.wh-map-search-form {
  margin: 0;
}

.wh-map-search {
  position: relative;
  min-width: 220px;
}

.wh-map-search > .ti-search {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}

.wh-map-search .form-control {
  padding-left: 32px;
  padding-right: 32px;
}

.wh-map-search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  line-height: 1;
}

.wh-map-canvas.is-searching .wh-map-cell.is-bin:not(.is-match) {
  opacity: 0.28;
  filter: grayscale(0.4);
}

.wh-map-canvas.is-searching .wh-map-cell.is-zone:not(.is-match) {
  opacity: 0.4;
}

.wh-map-cell.is-match {
  box-shadow: 0 0 0 2px #f59e0b, 0 8px 18px rgba(245, 158, 11, 0.28);
  z-index: 4;
  animation: wh-map-match-pulse 1.4s ease-in-out 2;
}

@keyframes wh-map-match-pulse {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

.inv-bin-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.inv-bin-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2, #f8fafc);
  text-decoration: none;
  color: inherit;
  font-size: 12px;
}

.inv-bin-chip:hover {
  border-color: var(--af-primary, #2563eb);
  color: var(--af-primary, #2563eb);
}

.stock-line-bins {
  margin-top: 6px;
}

.stock-line-bins .inv-bin-chip {
  cursor: default;
}

.inv-bin-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  font-size: 13px;
  color: var(--text-2);
}

.inv-bin-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.inv-bin-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.inv-bin-row > div:first-child {
  flex: 1;
  min-width: 0;
}

.inv-bin-row-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.wh-map-panel-hd {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.wh-map-body {
  padding-top: 12px;
}

.wh-map-canvas {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  border: 1px solid var(--border);
  border-radius: 14px;
  background:
    radial-gradient(circle at 20% 20%, rgba(37, 99, 235, 0.05), transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(15, 118, 110, 0.06), transparent 45%),
    linear-gradient(90deg, rgba(15, 23, 42, 0.035) 1px, transparent 1px),
    linear-gradient(rgba(15, 23, 42, 0.035) 1px, transparent 1px);
  background-size: auto, auto, 24px 24px, 24px 24px;
  background-color: #f4f7fb;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.wh-map-cell {
  position: absolute;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  transition: box-shadow .15s ease, transform .15s ease, border-color .15s ease;
}

.wh-map-cell.is-zone {
  z-index: 1;
  pointer-events: none;
  border-style: dashed;
  border-color: rgba(15, 23, 42, 0.14);
  opacity: 0.95;
  padding: 8px 10px;
  justify-content: space-between;
}

.wh-map-zone-label {
  align-self: flex-start;
  font-size: 12px;
  font-weight: 650;
  color: var(--text-2);
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  max-width: calc(100% - 8px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wh-map-zone-code {
  align-self: flex-start;
  font-size: 10px;
  color: var(--text-3);
  letter-spacing: 0.02em;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.55);
}

.wh-map-cell.is-bin {
  z-index: 2;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(4px);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.wh-map-cell.is-bin:hover,
.wh-map-cell.is-selected {
  box-shadow: 0 0 0 2px var(--af-primary, #2563eb), 0 8px 18px rgba(37, 99, 235, 0.12);
  transform: translateY(-1px);
  z-index: 3;
}

.wh-map-cell-code {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.wh-map-cell-name {
  font-size: 10px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wh-map-cell-qty {
  font-size: 13px;
  font-weight: 700;
  align-self: flex-end;
  color: var(--text);
}

.wh-map-fill {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  background: currentColor;
  opacity: 0.35;
}

.wh-map-cell.is-empty { color: #64748b; }
.wh-map-cell.is-low { color: #0f766e; background: linear-gradient(180deg, #fff, #ecfdf5); border-color: #99f6e4; }
.wh-map-cell.is-mid { color: #1d4ed8; background: linear-gradient(180deg, #fff, #eff6ff); border-color: #93c5fd; }
.wh-map-cell.is-high { color: #c2410c; background: linear-gradient(180deg, #fff, #fff7ed); border-color: #fdba74; }
.wh-map-cell.is-full { color: #b91c1c; background: linear-gradient(180deg, #fff, #fef2f2); border-color: #fca5a5; }

.wh-map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: var(--text-3);
}

.wh-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  margin-right: 4px;
  vertical-align: middle;
  border: 1px solid rgba(15, 23, 42, 0.12);
}

.wh-dot.is-empty { background: #fff; }
.wh-dot.is-low { background: #2dd4bf; }
.wh-dot.is-mid { background: #60a5fa; }
.wh-dot.is-high { background: #fb923c; }
.wh-dot.is-full { background: #f87171; }

.wh-map-detail-empty {
  text-align: center;
  padding: 36px 12px;
  color: var(--text-3);
}

.wh-map-detail-empty i {
  font-size: 28px;
  display: block;
  margin-bottom: 8px;
  opacity: 0.7;
}

.wh-map-detail-hero {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.wh-map-detail-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 700;
  color: #be185d;
  font-size: 1.05rem;
}

.wh-map-detail-title {
  font-weight: 600;
  margin-top: 2px;
}

.wh-map-capacity {
  padding: 12px;
  border-radius: 10px;
  background: var(--surface-2, #f8fafc);
  border: 1px solid var(--border);
}

.wh-map-capacity-meta {
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-sm);
  margin-bottom: 8px;
}

.wh-map-capacity-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

.wh-map-capacity-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #38bdf8, #2563eb);
}

.wh-map-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}

.wh-map-dirty {
  font-size: 12px;
}

.wh-map-canvas.is-editable .wh-map-cell {
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.wh-map-canvas.is-editable .wh-map-cell.is-zone {
  pointer-events: auto;
  z-index: 1;
}

.wh-map-canvas.is-editable .wh-map-cell.is-dragging {
  cursor: grabbing;
  z-index: 5;
  opacity: 0.95;
  box-shadow: 0 0 0 2px var(--af-primary, #2563eb), 0 12px 24px rgba(15, 23, 42, 0.18);
}

.wh-map-cell.is-inactive {
  opacity: 0.55;
  filter: grayscale(0.35);
}

.wh-map-resize {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 12px;
  height: 12px;
  border-radius: 2px 0 6px 0;
  background:
    linear-gradient(135deg, transparent 45%, rgba(15, 23, 42, 0.35) 45%, rgba(15, 23, 42, 0.35) 55%, transparent 55%),
    linear-gradient(135deg, transparent 65%, rgba(15, 23, 42, 0.35) 65%, rgba(15, 23, 42, 0.35) 75%, transparent 75%);
  cursor: nwse-resize;
  z-index: 4;
}

.wh-map-loc-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 280px;
  overflow: auto;
  padding-right: 2px;
}

.wh-map-loc-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface, #fff);
}

.wh-map-loc-row.is-active {
  border-color: var(--af-primary, #2563eb);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.2);
}

.wh-map-loc-row.is-inactive {
  opacity: 0.65;
}

.wh-map-loc-select {
  flex: 1;
  min-width: 0;
  text-align: left;
  background: none;
  border: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
}

.wh-map-loc-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.wh-map-loc-actions .form-inline {
  display: inline;
  margin: 0;
}

.pack-cam-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.pack-station-strip-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pack-station-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.pack-station-card {
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 14px;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.pack-station-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.08);
  transform: translateY(-1px);
}

.pack-station-card.is-off {
  opacity: 0.72;
}

.pack-station-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.pack-station-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 700;
  color: #be185d;
}

.pack-station-name {
  font-weight: 600;
  margin-bottom: 8px;
  line-height: 1.3;
}

.pack-station-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-3);
}

.pack-station-meta i {
  margin-right: 4px;
}

.pack-station-card-foot {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.pack-station-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--af-primary, #2563eb);
}

.pack-clip-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
}

.pack-clip-meta {
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-2);
  min-width: 180px;
}

.pack-clip-lbl {
  display: inline-block;
  min-width: 64px;
  color: var(--text-3);
}

.pack-clip-video {
  width: 100%;
  max-height: 70vh;
  display: block;
  background: #0f172a;
}

.pack-session-filters {
  gap: 8px;
}

@media (max-width: 960px) {
  .wh-map-layout { grid-template-columns: 1fr; }
  .wh-map-stats,
  .pack-cam-stats { grid-template-columns: 1fr 1fr; }
}

.ops-recon-code-btn {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--af-primary, #2563eb);
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.ops-recon-code-btn:hover {
  text-decoration: underline;
}

.ops-recon-money-row,
.ops-recon-finance-amounts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--surface-2, #f8fafc);
}

.ops-recon-finance-amounts {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ops-recon-money-row > div,
.ops-recon-finance-amounts > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ops-recon-finance-summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.ops-recon-ship-card {
  border: 0.5px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  background: var(--surface);
}

.ops-recon-ship-card + .ops-recon-ship-card {
  margin-top: 12px;
}

.ops-recon-ship-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.ops-recon-ship-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

@media (max-width: 720px) {
  .ops-recon-money-row,
  .ops-recon-finance-amounts {
    grid-template-columns: 1fr 1fr;
  }
}

/* —— Print slip (In phiếu) —— */
.print-slip {
  max-width: 900px;
  margin: 0 auto;
  font-size: 13px;
  line-height: 1.45;
}

.print-slip-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 2px solid #111;
}

.print-slip-kicker {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #666;
  font-weight: 600;
}

.print-slip-code {
  margin: 4px 0;
  font-size: 22px;
  font-weight: 700;
}

.print-slip-sub {
  margin: 0;
  color: #444;
}

.print-slip-meta {
  text-align: right;
  font-size: 12px;
  color: #333;
}

.print-slip-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 24px;
  margin-bottom: 16px;
}

.print-slip-field {
  display: flex;
  gap: 8px;
}

.print-slip-lbl {
  color: #666;
  min-width: 90px;
}

.print-slip-val {
  font-weight: 600;
}

.print-slip-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 14px;
}

.print-slip-table th,
.print-slip-table td {
  border: 1px solid #ccc;
  padding: 6px 8px;
  text-align: left;
}

.print-slip-table th {
  background: #f3f4f6;
  font-size: 11px;
  text-transform: uppercase;
}

.print-slip-totals {
  margin-left: auto;
  width: 280px;
  margin-bottom: 16px;
}

.print-slip-total-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid #eee;
}

.print-slip-note {
  margin: 12px 0 24px;
  color: #333;
}

.print-slip-sign {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  margin-top: 40px;
  text-align: center;
}

.print-slip-sign-lbl {
  font-weight: 600;
  margin-bottom: 48px;
}

.print-slip-sign-line {
  border-top: 1px solid #999;
  margin: 0 24px;
}

.dept-work-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.dept-work-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface, #fff);
  color: var(--text-2);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}

.dept-work-tab:hover {
  border-color: var(--af-primary, #2563eb);
  color: var(--af-primary, #2563eb);
}


.dept-work-tab.is-active {
  background: color-mix(in srgb, var(--af-primary, #2563eb) 12%, #fff);
  border-color: var(--af-primary, #2563eb);
  color: var(--af-primary-dark, #1d4ed8);
}

.dept-work-hero {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  margin-bottom: 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background:
    radial-gradient(circle at 0% 0%, rgba(37, 99, 235, 0.08), transparent 45%),
    var(--surface, #fff);
}

.dept-work-hero-ico {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--af-primary, #2563eb) 12%, #fff);
  color: var(--af-primary, #2563eb);
  font-size: 22px;
  flex-shrink: 0;
}

.dept-work-hero-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 4px;
}

.dept-work-hero-sub {
  color: var(--text-3);
  font-size: 14px;
}

.dept-work-kpi {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.dept-work-kpi .hr-kpi-card.is-placeholder {
  opacity: 0.35;
  pointer-events: none;
}

.dept-work-queues {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.dept-work-queues .panel-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 12px;
}

.dept-work-queues .panel-header > strong {
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
}

.dept-work-queues .panel-header > a {
  flex: 0 0 auto;
  white-space: nowrap;
}

.dept-work-empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}

.dept-work-task-list {
  display: flex;
  flex-direction: column;
}

.dept-work-task {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
}

.dept-work-task:last-child {
  border-bottom: 0;
}

.dept-work-task:hover {
  background: var(--surface-2, #f8fafc);
}

.dept-work-task-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dept-work-task > .ti {
  color: var(--text-3);
}

@media (max-width: 1200px) {
  .dept-work-kpi { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
  .dept-work-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dept-work-queues { grid-template-columns: 1fr; }
}

