/* =============================================================================
   OneG Design System — slim (shell + core components)
   Shared by OneCRM / OneFul portals. Extracted from OneG Hub app.css.
   Loads AFTER Bootstrap 5.3. Module-specific CSS omitted.
   ============================================================================= */


/* --- OneG app.css L1-528 --- */
/* =============================================================================
   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", ui-sans-serif, system-ui, sans-serif;
  --bs-font-sans-serif: var(--font);
  --fs-xs: 11px;
  --fs-sm: 12px;
  --fs-md: 13px;
  --fs-base: 13px;
  --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);
}

.password-input-wrap { position: relative; }
.password-input-wrap .form-control { padding-right: 44px; }
.password-toggle { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; color: var(--text-3); background: transparent; border: 0; border-radius: var(--radius-sm); }
.password-toggle:hover, .password-toggle:focus-visible { color: var(--text); background: var(--surface-soft); outline: none; }

/* ---------------------------------------------------------------------------
   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;
}

input,
select,
textarea,
button,
.btn,
.form-control,
.form-select,
.dropdown-menu,
.nav,
.table,
.modal {
  font-family: var(--font);
}


/* —— Secret field: show / hide + copy —— */
.secret-field {
  position: relative;
  display: flex;
  align-items: stretch;
  width: 100%;
}

.secret-field > .form-control,
.secret-field > input {
  padding-right: 4.75rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.02em;
}

.secret-field:has(.secret-field-actions .secret-field-btn:only-child) > .form-control,
.secret-field:has(.secret-field-actions .secret-field-btn:only-child) > input {
  padding-right: 2.75rem;
}

.secret-field-inline {
  display: inline-flex;
  width: auto;
  max-width: 100%;
  align-items: center;
  gap: 0.35rem;
  background: var(--surface-2, #f1f5f9);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 0.5rem;
  padding: 0.2rem 0.35rem 0.2rem 0.65rem;
}

.secret-field-inline > code,
.secret-field-inline > [data-copyable] {
  font-size: 0.8rem;
  word-break: break-all;
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--text, #0f172a);
}

.secret-field-inline .secret-field-actions {
  position: static;
  transform: none;
  padding-right: 0;
}

.secret-field-actions {
  position: absolute;
  right: 0.3rem;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  gap: 0.1rem;
  z-index: 2;
}

.secret-field-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  border: 0;
  border-radius: 0.4rem;
  background: transparent;
  color: var(--muted, #64748b);
  padding: 0;
  line-height: 1;
  transition: background 0.15s ease, color 0.15s ease;
}

.secret-field-btn:hover,
.secret-field-btn:focus-visible {
  background: var(--surface-2, #e2e8f0);
  color: var(--text, #0f172a);
  outline: none;
}

.secret-field-btn.is-active {
  color: var(--primary, #2563eb);
}

.secret-field-btn.is-copied {
  color: #16a34a;
}

.secret-field-btn .ti {
  font-size: 1.05rem;
}

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

button {
  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: 48px;
}

.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: 8px;
}

.nav-group-items .nav-link .nav-link-icon {
  font-size: 15px;
  width: 1.1em;
  flex-shrink: 0;
  opacity: 0.9;
  line-height: 1;
}

.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:not(.nav-link-icon),
.nav-group-items .nav-link i.fa-solid:not(.nav-link-icon),
.nav-group-items .nav-link i.fa-regular:not(.nav-link-icon) {
  display: none;
}

.nav-group-items .nav-link i.ti.nav-link-icon {
  display: inline-block;
  font-size: 15px;
  width: 1.1em;
  flex-shrink: 0;
  opacity: 0.9;
  line-height: 1;
}

.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;
}


/* --- OneG app.css L1209-2106 --- */
.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: 220px;
  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-meta {
  max-width: 260px;
  line-height: 1.35;
}

.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;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  margin-bottom: 20px;
}

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

.auth-brand-sub {
  font-size: var(--fs-sm);
  color: var(--text-3);
  line-height: 1.4;
  text-wrap: balance;
}

.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-input-wrap .secret-field > .form-control,
.auth-input-wrap .secret-field > input {
  padding-left: 42px;
}

.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: #fff;
  color: var(--af-primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-md);
  font-weight: 600;
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid var(--border);
}

.user-av img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.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;
  font-size: var(--fs-sm);
  line-height: 1.2;
}

.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-menu { width: min(400px, calc(100vw - 20px)); }
.notif-menu-hd { padding: 14px 16px; }
.notif-menu-hd strong { font-size: var(--fs-lg); color: var(--text-1); }
.notif-menu-hd a { display: inline-flex; align-items: center; gap: 5px; }
.notif-menu-list { max-height: min(430px, calc(100vh - 190px)); }
.notif-item { position: relative; gap: 12px; padding: 14px 16px; align-items: flex-start; }
.notif-item.is-unread { background: linear-gradient(90deg, rgba(61, 90, 254, .075), rgba(61, 90, 254, .018)); }
.notif-item.is-unread::before {
  content: ""; position: absolute; left: 0; inset-block: 0; width: 3px; background: var(--af-primary);
}
.notif-item-icon { width: 36px; height: 36px; border-radius: 11px; font-size: 18px; }
.notif-item-body { flex: 1; gap: 4px; }
.notif-item-title { font-size: 13px; line-height: 1.4; }
.notif-item-message {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  color: var(--text-2); font-size: 11px; line-height: 1.45;
}
.notif-item-meta { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; }
.notif-item-unread {
  width: 7px; height: 7px; margin-top: 6px; flex: 0 0 auto;
  border-radius: 50%; background: transparent;
}
.notif-item.is-unread .notif-item-unread { background: var(--af-primary); box-shadow: 0 0 0 3px rgba(61, 90, 254, .1); }
.notif-menu-ft { padding: 12px; background: var(--surface-2); }
.notif-menu-ft a { padding: 9px 8px; background: var(--surface); font-weight: 600; }

@media (max-width: 479.98px) {
  .notif-menu { width: calc(100vw - 16px); }
  .notif-item { padding: 12px; }
  .notif-menu-hd { padding: 12px; }
}


.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);
}

/* Notification center */
.notification-panel { overflow: hidden; }
.notification-unread-count {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px;
  border-radius: 999px; color: var(--af-primary); background: rgba(61, 90, 254, .08);
  font-size: var(--fs-sm); font-weight: 600; white-space: nowrap;
}
.notification-list { display: flex; flex-direction: column; }
.notification-row {
  position: relative; display: grid; grid-template-columns: 36px minmax(0, 1fr) 40px;
  align-items: center; gap: 12px; padding: 12px 16px;
  border-top: .5px solid var(--border); background: var(--surface);
  transition: background var(--transition-fast), box-shadow var(--transition-fast);
}
.notification-row:first-child { border-top: 0; }
.notification-row:hover { background: var(--surface-hover); }
.notification-row.is-unread {
  background: linear-gradient(90deg, rgba(61, 90, 254, .065), rgba(61, 90, 254, .018));
  box-shadow: inset 3px 0 0 var(--af-primary);
}
.notification-row-icon {
  width: 36px; height: 36px; border-radius: 10px; display: inline-flex;
  align-items: center; justify-content: center; color: var(--text-3);
  background: var(--surface-2); font-size: 17px;
}
.notification-row.is-unread .notification-row-icon {
  color: var(--af-primary); background: rgba(61, 90, 254, .1);
}
.notification-row-content { min-width: 0; }
.notification-row-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px; min-width: 0;
}
.notification-row-title {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  color: var(--text-1); font-size: var(--fs-base); font-weight: 600; line-height: 1.35;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.notification-row.is-read .notification-row-title { font-weight: 500; }
.notification-new {
  display: inline-flex; flex: 0 0 auto; padding: 2px 7px; border-radius: 999px;
  color: var(--af-primary); background: rgba(61, 90, 254, .1);
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
}
.notification-row-body {
  margin-top: 2px; color: var(--text-2); font-size: var(--fs-sm); line-height: 1.4;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.notification-row-time {
  display: inline-flex; align-items: center; gap: 4px; flex: 0 0 auto;
  color: var(--text-3); font-size: 11px; line-height: 1.2; white-space: nowrap;
}
.notification-row-action { align-self: center; justify-self: end; margin: 0; }
.notification-row-action .btn,
.notification-row-action .td-action-btn { display: inline-flex; align-items: center; justify-content: center; }

@media (max-width: 767.98px) {
  .notification-row { grid-template-columns: 32px minmax(0, 1fr) 36px; gap: 10px; padding: 12px; }
  .notification-row-icon { width: 32px; height: 32px; border-radius: 9px; font-size: 15px; }
  .notification-row-head { flex-direction: column; align-items: flex-start; gap: 2px; }
  .notification-row-title { white-space: normal; }
  .notification-row-body { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .notification-unread-count { font-size: 11px; padding: 5px 8px; }
}

/* Read-only warehouse product preview */
.product-view-modal { overflow: hidden; }
.modal-kicker { margin-bottom: 3px; color: var(--af-primary); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.product-view-loading { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 220px; color: var(--text-2); }
.product-view-content { display: flex; flex-direction: column; gap: 18px; }
.product-view-hero { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 18px; align-items: stretch; }
.product-view-image { display: flex; align-items: center; justify-content: center; min-height: 112px; overflow: hidden; border: .5px solid var(--border); border-radius: 14px; background: var(--surface-2); color: var(--text-3); font-size: 38px; }
.product-view-image img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.product-view-codes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: .5px solid var(--border); border-radius: 14px; overflow: hidden; }
.product-view-codes > div { min-width: 0; padding: 16px; border-left: .5px solid var(--border); background: var(--surface); }
.product-view-codes > div:first-child { border-left: 0; }
.product-view-codes span, .product-view-grid span { display: block; margin-bottom: 6px; color: var(--text-3); font-size: 11px; }
.product-view-codes strong { display: block; overflow-wrap: anywhere; color: var(--text-1); font-size: var(--fs-base); }
.product-view-section { padding-top: 16px; border-top: .5px solid var(--border); }
.product-view-section h6 { margin: 0 0 12px; color: var(--text-1); font-size: var(--fs-base); font-weight: 650; }
.product-view-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.product-view-grid > div { min-width: 0; padding: 12px; border-radius: 10px; background: var(--surface-2); }
.product-view-grid strong { display: block; overflow-wrap: anywhere; color: var(--text-1); font-size: var(--fs-sm); font-weight: 600; }
.product-tracking-badges, .product-view-options { display: flex; flex-wrap: wrap; gap: 8px; }
.product-tracking-badges span, .product-view-options span { display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; border: .5px solid var(--border); border-radius: 999px; color: var(--text-3); background: var(--surface-2); font-size: var(--fs-sm); }
.product-tracking-badges span.is-active { border-color: rgba(61, 90, 254, .25); color: var(--af-primary); background: rgba(61, 90, 254, .08); font-weight: 600; }
.product-view-options span { color: var(--text-1); background: var(--surface); }

@media (max-width: 767.98px) {
  .notification-row { grid-template-columns: 36px minmax(0, 1fr); gap: 10px; padding: 14px; }
  .notification-row-icon { width: 36px; height: 36px; border-radius: 10px; }
  .notification-row-action { grid-column: 2; width: 100%; }
  .notification-row-action .btn { width: 100%; justify-content: center; }
  .notification-unread-count { font-size: 11px; padding: 5px 8px; }
  .product-view-hero { grid-template-columns: 82px minmax(0, 1fr); gap: 12px; }
  .product-view-image { min-height: 82px; }
  .product-view-codes { grid-template-columns: 1fr; }
  .product-view-codes > div { padding: 10px 12px; border-left: 0; border-top: .5px solid var(--border); }
  .product-view-codes > div:first-child { border-top: 0; }
  .product-view-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 479.98px) {
  .product-view-hero { grid-template-columns: 1fr; }
  .product-view-image { width: 96px; min-height: 96px; }
  .product-view-grid { grid-template-columns: 1fr; }
}


.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;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.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;
}

/* --- OneG app.css L2108-2522 --- */
/* ---------------------------------------------------------------------------
   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: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.stat-icon .ti {
  font-size: 20px;
  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;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.panel-title .ti {
  font-size: 18px;
  color: var(--text-2);
}

.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);
}

/* Icon trong nút/link CTA không bị empty-state ghi đè màu. */
.empty-state .btn i.ti,
.empty-state a.btn i.ti {
  font-size: 1em;
  margin: 0;
  display: inline;
  color: inherit;
  vertical-align: -0.125em;
}

.btn i.ti {
  color: inherit;
}

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

/* --- OneG app.css L2525-2563 --- */
.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;
}

.receipt-create-layout{display:grid;grid-template-columns:minmax(0,1fr) 340px;gap:16px;align-items:start}.receipt-lines-panel{min-width:0}.receipt-create-aside{min-width:0}.receipt-lines-panel .panel-header>div{flex-wrap:wrap;justify-content:flex-end}.receipt-lines-panel #asn-line-search{width:240px}.receipt-total-chip{display:inline-flex;gap:6px;align-items:center;padding:6px 10px;border-radius:8px;background:#f1f5f9;color:#475569;font-size:12px;white-space:nowrap}.receipt-total-chip strong{color:#0f172a;font-size:13px}.receipt-total-chip-received{background:#ecfdf5;color:#047857}.serial-list{display:grid;gap:8px}.serial-list-item{display:flex;align-items:center;gap:10px;padding:9px 12px;border:1px solid #e2e8f0;border-radius:8px;background:#f8fafc}.serial-list-item code{color:#0f172a;font-size:13px}
/* Sidebar nhận hàng: label / value tách dòng, khoảng cách rõ */
.detail-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px 24px}
.detail-grid>div{display:flex;flex-direction:column;gap:4px;min-width:0}
.detail-grid>div>span{color:var(--text-3);font-size:var(--fs-sm);line-height:1.35}
.detail-grid>div>strong{color:var(--text-1);font-size:var(--fs-sm);font-weight:650;line-height:1.45;overflow-wrap:anywhere}
.receipt-create-aside .detail-grid,
.receipt-info-fields .detail-grid{grid-template-columns:1fr;gap:14px}
@media (max-width:767.98px){.detail-grid{grid-template-columns:1fr}}

.asn-info-card{overflow:hidden}.asn-info-hero{display:grid;grid-template-columns:44px minmax(0,1fr) auto;gap:11px;align-items:center;padding:17px 18px;background:linear-gradient(135deg,color-mix(in srgb,var(--af-primary) 9%,var(--surface)),var(--surface));border-bottom:1px solid var(--border)}.asn-info-icon{width:44px;height:44px;display:grid;place-items:center;color:var(--af-primary);background:var(--surface);border:1px solid color-mix(in srgb,var(--af-primary) 20%,var(--border));border-radius:12px;box-shadow:var(--shadow-sm);font-size:21px}.asn-info-hero>div:nth-child(2){min-width:0}.asn-info-hero>div:nth-child(2)>span{display:block;color:var(--text-2);font-size:var(--fs-xs)}.asn-info-hero>div:nth-child(2)>strong{display:block;margin-top:2px;overflow:hidden;color:var(--text-1);font-size:var(--fs-base);text-overflow:ellipsis;white-space:nowrap}.asn-receive-progress{padding:14px 18px 15px;border-bottom:1px solid var(--border)}.asn-receive-progress>div:first-child{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:8px;color:var(--text-2);font-size:var(--fs-xs)}.asn-receive-progress strong{color:var(--text-1);font-size:var(--fs-sm)}.asn-receive-progress .progress{height:7px;background:var(--surface-2);border-radius:999px}.asn-receive-progress .progress-bar{background:linear-gradient(90deg,var(--af-primary),#22c55e);border-radius:999px}.asn-info-list{padding:6px 18px}.asn-info-row{display:grid;grid-template-columns:34px minmax(0,1fr);gap:10px;align-items:start;padding:11px 0;border-bottom:1px solid color-mix(in srgb,var(--border) 72%,transparent)}.asn-info-row:last-child{border-bottom:0}.asn-info-row-icon{width:32px;height:32px;display:grid;place-items:center;color:var(--text-2);background:var(--surface-muted);border-radius:9px;font-size:16px}.asn-info-row>div{min-width:0}.asn-info-row small{display:block;margin-bottom:3px;color:var(--text-3);font-size:11px}.asn-info-row strong,.asn-info-row>div>span{display:block;color:var(--text-1);font-size:var(--fs-sm);font-weight:650;line-height:1.4;overflow-wrap:anywhere}.asn-info-row>div>span{margin-top:2px;color:var(--text-2);font-weight:400}.asn-info-row .client-tag{max-width:100%}.asn-info-note{margin:4px 14px 14px;padding:12px 13px;background:var(--surface-muted);border:1px solid var(--border);border-radius:10px}.asn-info-note>span{display:flex;align-items:center;gap:6px;color:var(--text-2);font-size:var(--fs-xs);font-weight:650}.asn-info-note p{margin:6px 0 0;color:var(--text-1);font-size:var(--fs-sm);line-height:1.5;white-space:pre-wrap;overflow-wrap:anywhere}
@media (max-width:1100px){.receipt-create-layout{grid-template-columns:1fr}.receipt-create-aside{order:2}}

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

/* --- OneG app.css L2900-3611 --- */
/* ---------------------------------------------------------------------------
   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: nowrap;
}

/* Keep the cell in the table grid — flex on <td> breaks row borders. */
td.td-actions,
td.table-actions,
th.th-actions {
  display: table-cell;
  width: 1%;
  white-space: nowrap;
  text-align: right;
  vertical-align: middle;
}

td.td-actions > *,
td.table-actions > * {
  display: inline-flex;
  vertical-align: middle;
  margin-left: 6px;
}

td.td-actions > :first-child,
td.table-actions > :first-child {
  margin-left: 0;
}

.td-actions form,
.table-actions form,
td.td-actions form.d-inline,
td.table-actions form.d-inline {
  display: inline-flex !important;
  margin: 0;
  vertical-align: middle;
}

/* Nút thao tác trong danh sách: icon + tooltip (title), không gắn text để tránh tràn. */
td.td-actions .btn,
td.table-actions .btn,
.td-actions .td-action-btn,
.table-actions .td-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  flex: 0 0 32px;
  overflow: hidden;
  white-space: nowrap;
  line-height: 1;
}

.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;
}

.td-action-btn.is-danger,
.td-action-btn:has(.ti-trash),
.td-action-btn:has(.ti-ban),
.td-action-btn:has(.ti-player-pause),
.td-action-btn:has(.ti-player-stop),
.td-action-btn:has(.ti-circle-x),
.td-action-btn:has(.ti-x),
.td-action-btn.line-remove {
  color: var(--af-danger);
  border-color: color-mix(in srgb, var(--af-danger) 40%, var(--border));
}

.td-action-btn.is-danger:hover,
.td-action-btn:has(.ti-trash):hover,
.td-action-btn:has(.ti-ban):hover,
.td-action-btn:has(.ti-player-pause):hover,
.td-action-btn:has(.ti-player-stop):hover,
.td-action-btn:has(.ti-circle-x):hover,
.td-action-btn:has(.ti-x):hover,
.td-action-btn.line-remove:hover {
  color: var(--red-800);
  background: var(--red-50);
  border-color: var(--af-danger);
}

/* 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: 0;
  white-space: nowrap;
}

.client-tag {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--primary, #0d6efd);
  background: color-mix(in srgb, var(--primary, #0d6efd) 12%, transparent);
  border: 0.5px solid color-mix(in srgb, var(--primary, #0d6efd) 35%, transparent);
  border-radius: var(--radius-sm, 4px);
  padding: 1px 7px;
  white-space: nowrap;
  max-width: 16rem;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.data-table .badge {
  padding: 3px 7px;
  font-size: 11px;
  line-height: 1.25;
  font-weight: 600;
  white-space: nowrap;
}

.data-table .client-tag {
  max-width: 120px;
  padding: 2px 6px;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
}

.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.b-muted,
.badge.b-info,
.badge.b-warning,
.badge.b-success,
.badge.b-danger,
.badge.b-sameday,
.badge.b-express,
.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-active,
.badge.seg-loyal,
.badge.b-success {
  background: var(--green-50);
  color: var(--green-800);
}

.badge.b-muted {
  background: var(--gray-50);
  color: var(--gray-800);
}

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

.badge.b-warning,
.badge.b-pending,
.badge.b-draft,
.badge.b-low,
.badge.seg-vip {
  background: var(--amber-50);
  color: var(--amber-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-danger,
.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.seg-inactive {
  background: var(--gray-50);
  color: var(--gray-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
   --------------------------------------------------------------------------- */
.panel-toolbar {
  padding: 12px var(--space-5);
  border-bottom: 0.5px solid var(--border);
}

.panel > .panel-toolbar:last-child {
  border-bottom: 0;
}

.panel-toolbar .filter-bar,
.panel-body > .filter-bar {
  margin-bottom: 0;
}

.panel-toolbar .filter-bar .search-wrap {
  max-width: none;
}

.filter-bar {
  --filter-h: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

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

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

.filter-bar .search-wrap {
  position: relative;
  flex: 1 1 220px;
  min-width: 180px;
  max-width: 420px;
}

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

.filter-bar .search-wrap input {
  width: 100%;
  height: var(--filter-h);
  padding: 0 var(--space-3) 0 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);
  line-height: 1.2;
}

.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-bar .form-select,
.filter-bar .form-control,
.filter-bar .filter-sel {
  width: auto;
  flex: 0 0 180px;
  min-width: 160px;
  max-width: 220px;
  height: var(--filter-h);
  padding-top: 0;
  padding-bottom: 0;
  font-size: var(--fs-base);
}

.filter-bar .form-select-sm,
.filter-bar .filter-sel-sm {
  flex: 0 0 160px;
  min-width: 140px;
  max-width: 200px;
}

.filter-bar .filter-sel-lg {
  flex: 0 0 220px;
  min-width: 180px;
  max-width: 280px;
}

.filter-bar .btn {
  height: var(--filter-h);
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  padding-left: 14px;
  padding-right: 14px;
}

.filter-bar .filter-reset {
  width: var(--filter-h);
  padding: 0;
  color: var(--text-2);
}

.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;
}

.carrier-filter-panel {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
}

.carrier-filter-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 112px;
  padding-top: 7px;
  color: var(--text-2);
  font-weight: 500;
}

.carrier-filter-chips { flex: 1; }
.carrier-filter-chips .f-chip span { color: var(--text-3); }
.carrier-filter-chips .f-chip.active span { color: inherit; }

.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);
}

/* --- OneG app.css L3614-3750 --- */
/* ---------------------------------------------------------------------------
   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: flex-start;
  gap: 4px;
  flex-wrap: wrap;
}

.form-label > .text-danger {
  margin-left: 0;
}

.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;
}


/* --- OneG app.css L4756-4807 --- */
.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;
}


/* --- OneG app.css L5471-6082 --- */
/* ---------------------------------------------------------------------------
   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,
  .filter-bar .form-select,
  .filter-bar .form-control,
  .filter-bar .filter-sel,
  .filter-bar .form-select-sm,
  .filter-bar .filter-sel-sm,
  .filter-bar .filter-sel-lg {
    min-width: 0;
    max-width: none;
    width: 100%;
    flex: 1 1 100%;
  }

  .filter-bar .btn,
  .filter-bar .filter-reset {
    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-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

.chart-wrap-lg {
  height: 300px;
}

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

.dash-panel-hint {
  margin-left: auto;
  font-size: var(--fs-md);
  color: var(--text-2);
  font-weight: 500;
  white-space: nowrap;
}

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


.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;
  }
}

@media(max-width:767.98px){
  html,body{max-width:100%;overflow-x:hidden}
  .main-wrap,.page-content,.panel,.panel-body{min-width:0;max-width:100%}
  .table-responsive,.panel-body.p-0:has(>table.data-table){display:block;width:100%;max-width:100%;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch;overscroll-behavior-inline:contain;scrollbar-width:thin}
  .data-table:has(th:nth-child(4)):not(.putaway-table){min-width:720px}
  .data-table th,.data-table td{white-space:nowrap}
  .data-table th:first-child,.data-table td:first-child{min-width:140px}
  .data-table th:nth-child(2),.data-table td:nth-child(2){min-width:190px}
  .data-table td .td-main,.data-table td.td-main{white-space:normal;overflow-wrap:normal;word-break:normal}
  .data-table td.td-actions,.data-table th.th-actions{min-width:92px;position:static;background:var(--surface)}
  .putaway-table{min-width:0!important}
  .putaway-table th,.putaway-table td{white-space:normal!important;min-width:0!important}
}


/* --- brand.css --- */
/* =============================================================================
   Brand + Bootstrap theme bridge (after bootstrap.min.css + app.css tokens)
   Per-app remaps live here; shared chrome stays in app.css.
   ============================================================================= */
:root {
  --brand-accent: var(--af-primary);
  --brand-accent-dark: var(--af-primary-dark);
}

/* --- sister-app utilities --- */
.topbar-spacer { flex: 1; }

/* ---------------------------------------------------------------------------
   Confirm / flash modal (OneG pattern)
   --------------------------------------------------------------------------- */
.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;
}


/* ---------------------------------------------------------------------------
   Admin SaaS polish — CRUD forms, metrics, connect cards
   --------------------------------------------------------------------------- */
:root {
  --surface-2: var(--surface-soft, #f1f4f9);
  --primary: var(--af-primary);
  --muted: var(--text-2);
}

.page-content code:not([class]),
.data-table code:not([class]) {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text);
  background: var(--surface-soft);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px 7px;
}

.product-sku-code {
  background: none;
  border: 0;
  border-radius: 0;
}

.table.data-table {
  margin-bottom: 0;
  border-collapse: collapse;
  border-spacing: 0;
}

.table.data-table > :not(caption) > * > * {
  background: transparent;
  box-shadow: none;
  border-bottom-width: 0.5px;
  border-bottom-color: var(--border);
}

.panel-count {
  margin-left: 0;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.75rem;
  min-height: 1.5rem;
  padding: 0 10px;
  font-size: var(--fs-base);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: 0.01em;
  color: #fff;
  background: var(--af-primary);
  border: 0;
  border-radius: var(--radius-pill);
  box-shadow: 0 1px 2px color-mix(in srgb, var(--af-primary) 35%, transparent);
}

/* Nested in title → sit beside the label (never centered by space-between) */
.panel-title > .panel-count {
  margin-left: 0;
}

/* Alone after the title → keep count on the right */
.panel-header > .panel-count:last-child {
  margin-left: auto;
}

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

.crud-form .field {
  margin-bottom: 0;
}

.crud-form .field-span-2 {
  grid-column: span 2;
}

.crud-form .field-span-3 {
  grid-column: span 3;
}

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

.return-form .field-span-3 {
  grid-column: 1 / -1;
}

.crud-form .field-checks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 20px;
  min-height: 38px;
  padding-top: 26px;
}

.crud-form .field-checks .form-check {
  margin: 0;
  min-height: auto;
  padding-left: 1.6em;
}

.crud-form .form-actions {
  margin-top: 4px;
  padding-top: var(--space-2);
  border-top: 0.5px solid var(--border);
  align-items: center;
}

.crud-form .form-mode {
  font-size: var(--fs-sm);
  color: var(--text-3);
  margin-right: auto;
}

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

.metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface-soft);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
}

.metric-row-lbl {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-2);
  font-size: var(--fs-md);
  font-weight: 500;
}

.metric-row-lbl .ti {
  font-size: 16px;
  color: var(--text-3);
}

.metric-row-val {
  font-size: var(--fs-2xl);
  font-weight: 600;
  line-height: 1;
  color: var(--text);
}

.connect-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.connect-hint {
  font-size: var(--fs-md);
  color: var(--text-2);
  margin: 0 0 var(--space-4);
  line-height: 1.45;
}

.connect-fields {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.connect-fields > input[type="hidden"] {
  display: none;
}

.connect-fields > .field,
.connect-fields > div {
  margin-bottom: 0;
}

.connect-fields .form-label {
  margin-bottom: 8px;
}

.connect-fields .form-check {
  margin: 4px 0 0;
  min-height: auto;
}

.connect-fields .form-actions {
  margin-top: 4px;
}

.connect-card .connect-fields {
  margin-bottom: var(--space-4);
}

.connect-card .connect-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: var(--space-3);
  border-top: 0.5px solid var(--border);
}

.connect-card .connect-meta {
  margin-top: var(--space-3);
  font-size: var(--fs-sm);
  color: var(--text-3);
}

.user-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 240px;
}

.user-actions .action-row {
  display: flex;
  gap: 6px;
  align-items: stretch;
}

.user-actions .action-row .form-control,
.user-actions .action-row .form-select {
  min-width: 0;
  flex: 1;
}

.td-main {
  font-weight: 600;
  color: var(--text);
}

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

@media (max-width: 1024px) {
  .crud-form .grid-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

  .crud-form .field-span-2,
  .crud-form .field-span-3 {
    grid-column: auto;
  }

  .crud-form .field-checks {
    padding-top: 4px;
  }
}


/* ---------------------------------------------------------------------------
   Merchant marketplace channel cards
   --------------------------------------------------------------------------- */
.channel-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.channel-card .channel-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: var(--space-3);
}

.channel-logo {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: var(--fs-lg);
  flex-shrink: 0;
}

.channel-logo-shopee { background: #fff1e8; color: #ee4d2d; }
.channel-logo-lazada { background: #eef2ff; color: #0f1a8a; }
.channel-logo-tiktok { background: #f1f5f9; color: #111827; }

.channel-card .channel-name {
  font-weight: 600;
  font-size: var(--fs-xl);
  line-height: 1.2;
}

.channel-card .channel-hint {
  font-size: var(--fs-md);
  color: var(--text-2);
  line-height: 1.45;
  margin: 0 0 var(--space-4);
  min-height: 2.6em;
}

.money-cell {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
}

.entity-form-modal-dialog {
  max-width: 640px;
}

.entity-form-sheet {
  border: 0.5px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 22px 56px rgba(18, 23, 43, 0.18);
  overflow: hidden;
  max-height: calc(100vh - 2rem);
  max-height: calc(100dvh - 2rem);
  display: flex;
  flex-direction: column;
}

.entity-form-modal-dialog.modal-lg {
  max-width: 760px;
}

.entity-form-modal {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.entity-form-modal .modal-header {
  flex: 0 0 auto;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 20px 12px;
  border-bottom: 0.5px solid var(--border);
}

.entity-form-modal .modal-title {
  font-size: var(--fs-lg);
  font-weight: 650;
  letter-spacing: -0.01em;
}

.entity-form-modal .modal-sub,
.modal-header .modal-sub {
  margin: 4px 0 0;
  font-size: var(--fs-md);
  color: var(--text-3);
}

.entity-form-modal .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 16px 20px;
}

.entity-form-modal .modal-footer {
  flex: 0 0 auto;
  background: var(--surface);
  gap: 8px;
  padding: 12px 20px 16px;
  border-top: 0.5px solid var(--border);
}

.entity-form-modal .form-actions,
.entity-form-modal [data-form-mode] {
  display: none;
}

.entity-form-modal .field-checks {
  padding-top: 8px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--surface-soft);
  border: 0.5px solid var(--border);
  font-size: var(--fs-sm);
  color: var(--text-2);
  line-height: 1.4;
  text-decoration: none;
}

a.chip:hover {
  color: var(--text-1);
  background: var(--surface);
}

.chip-active {
  background: var(--brand-soft, var(--surface));
  border-color: var(--brand, var(--border));
  color: var(--text-1);
  font-weight: 600;
}

.chip-count {
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.chip-muted {
  color: var(--text-3);
}

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

.sla-clocks {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.sla-clock-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 16px 18px 10px;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sla-clock-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sla-clock-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-soft);
  color: var(--text-2);
  flex-shrink: 0;
}

.sla-clock-icon .ti {
  font-size: 18px;
}

.sla-clock-title {
  display: block;
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text-1);
  line-height: 1.3;
}

.sla-clock-total {
  margin-top: 2px;
  font-size: var(--fs-sm);
  color: var(--text-3);
}

.sla-clock-bar {
  display: flex;
  height: 8px;
  border-radius: 99px;
  overflow: hidden;
  background: var(--surface-soft);
  gap: 2px;
}

.sla-clock-seg {
  display: block;
  height: 100%;
  border-radius: 99px;
  flex: var(--seg, 1) 1 4px;
}

.sla-clock-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sla-clock-list li {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-top: 0.5px solid var(--border);
}

.sla-clock-list li:first-child {
  border-top: 0;
}

.sla-clock-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.sla-clock-label {
  font-size: var(--fs-sm);
  color: var(--text-2);
}

.sla-clock-count {
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  font-size: var(--fs-md);
  line-height: 1;
}

.sla-clock-empty {
  font-size: var(--fs-sm);
  color: var(--text-3);
  padding: 4px 0 8px;
}

.sla-clock-seg.sla-tone-danger,
.sla-clock-dot.sla-tone-danger { background: var(--af-danger); }
.sla-clock-seg.sla-tone-warn,
.sla-clock-dot.sla-tone-warn { background: var(--af-amber); }
.sla-clock-seg.sla-tone-ok,
.sla-clock-dot.sla-tone-ok { background: var(--af-teal); }
.sla-clock-seg.sla-tone-late,
.sla-clock-dot.sla-tone-late { background: #fb923c; }
.sla-clock-seg.sla-tone-muted,
.sla-clock-dot.sla-tone-muted { background: #cbd5e1; }

.sla-clock-count.sla-tone-danger { color: var(--af-danger); }
.sla-clock-count.sla-tone-warn { color: var(--amber-800); }
.sla-clock-count.sla-tone-ok { color: var(--af-teal); }
.sla-clock-count.sla-tone-late { color: #c2410c; }
.sla-clock-count.sla-tone-muted { color: var(--text-3); }

@media (max-width: 1024px) {
  .sla-clocks {
    grid-template-columns: 1fr;
  }
}

.stock-route {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.stock-route .ti {
  color: var(--text-3);
  font-size: 14px;
}

.scan-dock .filter-bar {
  margin: 0;
  flex-wrap: nowrap;
}

.scan-dock .filter-bar .search-wrap {
  flex: 1 1 auto;
  min-width: 0;
  max-width: none;
}

.scan-dock .filter-bar .search-wrap .form-control,
.scan-dock .filter-bar .search-wrap input {
  width: 100%;
  max-width: none;
  flex: none;
}

.scan-dock .form-control {
  border: 0;
  background: transparent;
  box-shadow: none;
  height: 38px;
}

.dispatch-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 6px;
}

.dispatch-inline .form-select {
  width: auto;
  min-width: 92px;
}

.kv-doc {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.kv-doc-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  position: sticky;
  bottom: 0;
  z-index: 3;
  background: color-mix(in srgb, var(--bg) 92%, #fff 8%);
  padding: 12px 0 4px;
}

.kv-lines-search {
  position: relative;
  padding: 12px 16px;
  border-bottom: 0.5px solid var(--border);
}

.kv-lines-search input[type="search"] {
  width: 100%;
  height: 38px;
  padding: 0 12px 0 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);
}

.kv-lines-search input[type="search"]:focus {
  border-color: var(--af-primary);
  box-shadow: var(--focus-ring);
}

.kv-suggest {
  position: absolute;
  left: 16px;
  right: 16px;
  top: calc(100% - 4px);
  z-index: 30;
  background: var(--surface);
  border: 0.5px solid var(--border-md);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  max-height: 280px;
  overflow: auto;
  padding: 4px;
}

.kv-suggest-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: var(--fs-base);
  cursor: pointer;
}

.kv-suggest-item.is-active,
.kv-suggest-item:hover {
  background: var(--blue-50);
}

.kv-suggest-item .td-sub {
  margin-left: auto;
  font-size: var(--fs-sm);
}

.kv-suggest-empty {
  padding: 12px;
  color: var(--text-3);
  font-size: var(--fs-sm);
  text-align: center;
}

.sort-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: inherit;
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}

.sort-link:hover {
  color: var(--af-primary);
}

.sort-link .ti {
  font-size: 14px;
  opacity: 0.4;
}

.sort-link.is-active .ti {
  opacity: 1;
  color: var(--af-primary);
}

.scan-mark {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  margin-top: 4px;
}

.scan-mark-lg {
  margin-top: 8px;
  gap: 10px;
}

.scan-mark-bc {
  display: block;
  height: 28px;
  width: auto;
  max-width: 160px;
  background: transparent;
  border-radius: 0;
}

.scan-mark-lg .scan-mark-bc {
  height: 48px;
  max-width: 220px;
}

.scan-mark-qr {
  width: 56px;
  height: 56px;
  background: #fff;
  border-radius: 4px;
}

.scan-mark-print {
  color: var(--text-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
}

.scan-mark-print:hover {
  color: var(--af-primary);
  background: var(--af-primary-soft, rgba(37, 99, 235, .08));
}

/* Warehouse reports: grouped cells and responsive day grids avoid horizontal scrolling. */
.report-table-wrap { width:100%; overflow:visible; }
.report-table { width:100%; table-layout:fixed; }
.report-table th,.report-table td { min-width:0!important; white-space:normal!important; vertical-align:top; overflow-wrap:anywhere; }
.report-orders-table th:nth-child(1){width:16%}
.report-orders-table th:nth-child(2){width:24%}
.report-orders-table th:nth-child(3){width:20%}
.report-orders-table th:nth-child(4){width:16%}
.report-orders-table th:nth-child(5){width:24%}
.report-order-details-table th:nth-child(1){width:14%}
.report-order-details-table th:nth-child(2){width:20%}
.report-order-details-table th:nth-child(3){width:18%}
.report-order-details-table th:nth-child(4){width:14%}
.report-order-details-table th:nth-child(5){width:24%}
.report-order-details-table th:nth-child(6){width:10%}
.report-badge-row{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}
.report-badge-row .badge{margin:0}

/* Professional dense lists: consistent rows, wrapping and restrained scrollbars. */
.compact-list-table{table-layout:auto}.compact-list-table th,.compact-list-table td{padding:12px 14px;vertical-align:top}.compact-list-table td{white-space:normal;line-height:1.4}.compact-list-table .td-main{font-weight:600;line-height:1.35}.compact-list-table .td-sub{margin-top:3px;line-height:1.35}
/* Action cells must stay nowrap — compact-list-table's white-space:normal otherwise stacks icon buttons and clips them. */
.compact-list-table td.td-actions,.compact-list-table th.th-actions{white-space:nowrap;vertical-align:middle}
.status-stack{display:grid;gap:6px;min-width:180px}.status-stack>span{display:grid;grid-template-columns:68px minmax(0,1fr);align-items:center;gap:7px}.status-stack small{color:var(--text-3);font-size:11px}.status-stack .badge{justify-self:start;max-width:100%;overflow:hidden;text-overflow:ellipsis}
.table-responsive{scrollbar-width:thin;scrollbar-color:color-mix(in srgb,var(--text-3) 45%,transparent) transparent}.table-responsive::-webkit-scrollbar{height:8px}.table-responsive::-webkit-scrollbar-track{background:transparent}.table-responsive::-webkit-scrollbar-thumb{background:color-mix(in srgb,var(--text-3) 38%,transparent);border-radius:999px}
@media(min-width:1200px){.compact-list-table{width:100%;min-width:0!important}.compact-list-table th:first-child,.compact-list-table td:first-child{min-width:170px}.compact-list-table .th-actions,.compact-list-table td.td-actions{width:112px;min-width:112px}}
@media(min-width:1200px){
  .work-orders-table{table-layout:fixed}
  .work-orders-table th:nth-child(1),.work-orders-table td:nth-child(1){width:40px}
  .work-orders-table th:nth-child(2),.work-orders-table td:nth-child(2){width:22%}
  .work-orders-table th:nth-child(3),.work-orders-table td:nth-child(3){width:12%}
  .work-orders-table th:nth-child(4),.work-orders-table td:nth-child(4){width:11%}
  .work-orders-table th:nth-child(5),.work-orders-table td:nth-child(5){width:10%}
  .work-orders-table th:nth-child(6),.work-orders-table td:nth-child(6){width:11%}
  .work-orders-table th:nth-child(7),.work-orders-table td:nth-child(7){width:12%}
  /* TT Sàn: cố định bề rộng — trước thiếu width nên badge tràn đè nút actions. */
  .work-orders-table th:nth-child(8),.work-orders-table td:nth-child(8){width:128px;min-width:128px}
  .work-orders-table .th-actions,.work-orders-table td.td-actions{width:112px;min-width:112px}
}
.work-orders-table td:nth-child(8){overflow:hidden;vertical-align:middle}
.work-orders-table td:nth-child(8) .badge{
  display:inline-block;max-width:100%;overflow:hidden;text-overflow:ellipsis;vertical-align:middle
}
.work-orders-table td.td-actions{white-space:nowrap;vertical-align:middle;background:var(--surface)}

/* Work order badges — nền đậm hơn để phân biệt trạng thái / dịch vụ. */
.work-orders-table .badge{
  border:0;font-weight:600;letter-spacing:.01em
}
.work-orders-table .badge.b-info{
  background:#dbeafe;color:#1e40af
}
.work-orders-table .badge.b-processing{
  background:#e0e7ff;color:#3730a3
}
.work-orders-table .badge.b-pending,
.work-orders-table .badge.b-warning{
  background:#fef3c7;color:#92400e
}
.work-orders-table .badge.b-success{
  background:#dcfce7;color:#166534
}
.work-orders-table .badge.b-shipped{
  background:#ede9fe;color:#5b21b6
}
.work-orders-table .badge.b-delivered{
  background:#ccfbf1;color:#0f766e
}
.work-orders-table .badge.b-danger,
.work-orders-table .badge.b-cancelled{
  background:#fee2e2;color:#b91c1c
}
.work-orders-table .badge.b-refund{
  background:#fce7f3;color:#9d174d
}
.work-orders-table .badge.b-express{
  background:#ffedd5;color:#c2410c
}
.work-orders-table .badge.b-sameday{
  background:#dc2626;color:#fff
}
.work-orders-table .badge.b-muted{
  background:#f1f5f9;color:#475569
}

/* Relocation: route badge — nền trung tính, chữ rõ (không dùng panel-count xanh). */
.relocation-route{
  margin-left:auto;flex-shrink:0;display:inline-flex;align-items:center;
  min-height:1.5rem;padding:0.2rem 0.75rem;font-size:var(--fs-sm);font-weight:600;
  line-height:1.3;letter-spacing:0.01em;color:var(--text-1);
  background:var(--surface-2, color-mix(in srgb, var(--text-1) 6%, var(--surface)));
  border:1px solid var(--border);border-radius:var(--radius-md);
  font-variant-numeric:tabular-nums
}
.panel-header > .relocation-route:last-child{margin-left:auto}

/* Return inspect Create: label / control / note align across columns. */
.ri-field-row{align-items:stretch}
.ri-field{display:flex;flex-direction:column;min-width:0}
.ri-field > .form-label{margin-bottom:0.35rem;min-height:1.35em;line-height:1.35}
.ri-field-control{min-height:calc(1.5em + 0.75rem + 2px);display:flex;align-items:center}
.ri-field-control > .form-select,
.ri-field-control > .input-group,
.ri-field-control > .ri-field-readonly{width:100%}
.ri-field-readonly{
  display:flex;align-items:center;min-height:calc(1.5em + 0.75rem + 2px);
  padding:0.375rem 0;font-weight:600;color:var(--text-2);line-height:1.4
}
#ri-active-order.is-filled{
  flex-direction:column;align-items:flex-start;justify-content:center;gap:4px;
  font-weight:500;color:var(--text-1);
}
.ri-order-primary{
  display:flex;flex-wrap:wrap;align-items:baseline;gap:6px;min-width:0;
  color:var(--text-1);font-weight:700;line-height:1.35;
}
.ri-order-code{font-variant-numeric:tabular-nums}
.ri-order-sep{color:var(--text-3);font-weight:500}
.ri-order-partner{font-weight:600;color:var(--text-2)}
.ri-order-system{
  display:flex;flex-wrap:wrap;align-items:center;gap:6px;min-width:0;
  color:var(--text-3);font-size:var(--fs-sm);font-weight:500;line-height:1.35;
}
.ri-order-system-label{
  flex:0 0 auto;padding:1px 6px;border:1px solid var(--border);
  border-radius:999px;background:var(--surface-soft, #f8fafc);
  color:var(--text-3);font-size:10px;font-weight:700;letter-spacing:.03em;
  text-transform:uppercase;
}
.ri-field-note{margin-top:0.35rem;min-height:1.35em;line-height:1.35}

/* ASN list: fixed columns so codes wrap cleanly and two action icons stay on one row. */
@media(min-width:1200px){
  .asn-list-table{table-layout:fixed}
  .asn-list-table th:nth-child(1),.asn-list-table td:nth-child(1){width:22%}
  .asn-list-table th:nth-child(2),.asn-list-table td:nth-child(2){width:20%}
  .asn-list-table th:nth-child(3),.asn-list-table td:nth-child(3){width:14%}
  .asn-list-table th:nth-child(4),.asn-list-table td:nth-child(4){width:16%}
  .asn-list-table th:nth-child(5),.asn-list-table td:nth-child(5){width:12%}
  .asn-list-table .th-actions,.asn-list-table td.td-actions{width:112px;min-width:112px}
}
.asn-list-table td.td-actions{white-space:nowrap;vertical-align:middle}
.asn-list-table .product-sku-code{display:inline-block;max-width:100%;overflow:hidden;text-overflow:ellipsis;vertical-align:bottom}
.report-receiving-table th:nth-child(1){width:22%}
.report-receiving-table th:nth-child(2){width:34%}
.report-receiving-table th:nth-child(3){width:24%}
.report-receiving-table th:nth-child(4){width:20%}
.report-primary { color:var(--text-1); font-weight:650; line-height:1.35; }
.report-meta { margin-top:3px; color:var(--text-2); font-size:var(--fs-sm); line-height:1.35; }
.report-clamp { display:-webkit-box; margin-top:6px; overflow:hidden; color:var(--text-2); font-size:var(--fs-sm); line-height:1.45; -webkit-box-orient:vertical; -webkit-line-clamp:2; }
.report-status,.report-chip { display:inline-flex; width:max-content; margin-top:7px; padding:3px 8px; color:#1d4ed8; background:#eff6ff; border:1px solid #bfdbfe; border-radius:999px; font-size:var(--fs-xs); font-weight:650; line-height:1.25; }
.report-chip { color:#6d28d9; background:#f5f3ff; border-color:#ddd6fe; }
.report-qty { color:var(--text-1); font-size:1.05rem; font-weight:700; }
.report-timeline { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:7px 12px; min-width:0; }
.report-timeline span { display:flex; flex-direction:column; min-width:0; color:var(--text-2); font-size:var(--fs-xs); line-height:1.35; overflow-wrap:anywhere; }
.report-timeline b { margin-bottom:1px; color:var(--text-3); font-size:10px; font-weight:700; letter-spacing:.035em; text-transform:uppercase; }
.report-timeline .is-danger,.report-timeline .is-danger b { color:var(--af-danger); }
.report-quantity-pair { display:inline-grid; grid-template-columns:repeat(2,minmax(72px,1fr)); gap:8px; justify-items:stretch; min-width:156px; }
.report-quantity-pair > span { display:flex; flex-direction:column; align-items:flex-end; padding:8px 10px; text-align:right; background:var(--surface-muted); border:1px solid var(--border); border-radius:10px; }
.report-quantity-pair small { display:block; color:var(--text-3); font-size:10px; font-weight:700; letter-spacing:.04em; text-transform:uppercase; line-height:1.2; }
.report-quantity-pair b { display:block; margin-top:4px; color:var(--text-1); font-size:var(--fs-base); font-weight:700; font-variant-numeric:tabular-nums; line-height:1.2; }
.report-quantity-pair .is-complete { background:#ecfdf5; border-color:#a7f3d0; }
.report-quantity-pair .is-complete b { color:#047857; }
.monthly-stock-list { width:100%; }
.monthly-stock-legend { display:flex; flex-wrap:wrap; gap:10px 16px; padding:10px 20px; border-bottom:1px solid var(--border); background:var(--surface-muted); color:var(--text-2); font-size:var(--fs-xs); }
.monthly-stock-legend > span { display:inline-flex; align-items:center; gap:6px; white-space:nowrap; }
.monthly-legend-swatch { display:inline-block; width:14px; height:14px; border-radius:4px; border:1px solid var(--border); background:var(--surface); vertical-align:middle; }
.monthly-legend-swatch.is-pos { background:#ecfdf5; border-color:#a7f3d0; }
.monthly-legend-swatch.is-zero { background:#f8fafc; border-color:#e2e8f0; }
.monthly-legend-swatch.is-neg { background:#fef2f2; border-color:#fecaca; }
.monthly-legend-swatch.is-up { box-shadow:inset 0 -3px 0 #34d399; }
.monthly-legend-swatch.is-down { box-shadow:inset 0 -3px 0 #f59e0b; }
.monthly-stock-head,.monthly-stock-row { display:grid; grid-template-columns:minmax(230px,280px) minmax(0,1fr); }
.monthly-stock-head { padding:12px 20px; color:var(--text-3); border-bottom:1px solid var(--border); font-size:var(--fs-xs); font-weight:700; letter-spacing:.035em; text-transform:uppercase; }
.monthly-stock-row { padding:16px 20px; border-bottom:1px solid var(--border); transition:background-color .15s ease; }
.monthly-stock-row:last-child { border-bottom:0; }.monthly-stock-row:hover{background:var(--surface-muted)}
.monthly-product { min-width:0; padding:4px 20px 4px 0; }
.monthly-tags { display:flex; flex-wrap:wrap; gap:5px; align-items:center; margin:8px 0 7px; }
.monthly-tag-partner,.monthly-tag-unit { padding:3px 7px; color:var(--text-2); background:var(--surface-2); border-radius:6px; font-size:var(--fs-xs); }
.monthly-tag-unit { color:#475569; background:#f1f5f9; }
.monthly-tags .badge { font-size:11px; }
.monthly-days { display:grid; grid-template-columns:repeat(auto-fit,minmax(64px,1fr)); gap:6px; min-width:0; }
.monthly-day { min-width:0; padding:7px 2px; text-align:center; background:var(--surface-muted); border:1px solid transparent; border-radius:8px; overflow:hidden; }
.monthly-day span,.monthly-day strong { display:block; }.monthly-day span{color:var(--text-3);font-size:10px;font-weight:650}.monthly-day strong{margin-top:2px;color:var(--text-3);font-size:12px;font-variant-numeric:tabular-nums;font-feature-settings:"tnum";line-height:1.15;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%}
.monthly-day.is-lg strong { font-size:10px; letter-spacing:-0.03em; }
.monthly-day.is-xl strong { font-size:9px; letter-spacing:-0.045em; }
.monthly-day.has-value { background:var(--surface); border-color:var(--border); }
.monthly-day.is-pos { background:#ecfdf5; border-color:#a7f3d0; }.monthly-day.is-pos strong{color:#047857}
.monthly-day.is-zero { background:#f8fafc; border-color:#e2e8f0; }.monthly-day.is-zero strong{color:#64748b}
.monthly-day.is-neg { background:#fef2f2; border-color:#fecaca; }.monthly-day.is-neg strong{color:#b91c1c}
.monthly-day.is-up { box-shadow:inset 0 -3px 0 #34d399; }
.monthly-day.is-down { box-shadow:inset 0 -3px 0 #f59e0b; }
@media(max-width:991.98px){
  .monthly-stock-head{display:none}.monthly-stock-row{grid-template-columns:1fr}.monthly-product{padding:0 0 12px}.monthly-days{grid-template-columns:repeat(8,minmax(0,1fr))}
}
@media(max-width:767.98px){
  .report-table thead{display:none}.report-table,.report-table tbody,.report-table tr,.report-table td{display:block;width:100%}.report-table tr{padding:13px 16px;border-bottom:1px solid var(--border)}.report-table tbody tr:hover{background:var(--surface-muted)}
  .report-table td{display:grid!important;grid-template-columns:105px minmax(0,1fr);padding:7px 0!important;border:0!important;text-align:left!important}.report-table td::before{content:attr(data-label);padding-right:10px;color:var(--text-3);font-size:var(--fs-xs);font-weight:700;text-transform:uppercase}.report-table td>*{grid-column:2}.report-table .empty-state{grid-column:1/-1}
  .report-quantity-pair{justify-self:start}.report-timeline{grid-template-columns:repeat(2,minmax(0,1fr))}.monthly-stock-row{padding:15px 16px}.monthly-days{grid-template-columns:repeat(7,minmax(0,1fr));gap:5px}.monthly-day{padding:6px 2px}
}
@media(max-width:479.98px){.monthly-days{grid-template-columns:repeat(5,minmax(0,1fr))}.report-table td{grid-template-columns:88px minmax(0,1fr)}}

@media print {
  .scan-mark-print { display: none; }
}

.search-select { position:relative; width:100%; min-width:0; }
.filter-bar > .search-select { width:auto; flex:0 0 180px; min-width:160px; max-width:240px; }
.filter-bar .search-select.filter-sel { width:160px; flex:0 0 160px; max-width:200px; }
.filter-bar .search-select.filter-sel-sm { width:130px; flex:0 0 130px; max-width:180px; }
.filter-bar .search-select.filter-sel-lg { width:220px; flex:0 0 220px; max-width:280px; }
.search-select-native { position:absolute !important; width:1px !important; height:1px !important; opacity:0 !important; pointer-events:none !important; }
.search-select-trigger { width:100%; min-height:38px; display:flex; align-items:center; justify-content:space-between; gap:8px; padding:7px 10px; color:var(--text-1); background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-sm); text-align:left; }
.search-select-trigger:hover { border-color:var(--text-3); }
.search-select-trigger:focus-visible, .search-select.is-open .search-select-trigger { outline:0; border-color:var(--af-primary); box-shadow:0 0 0 3px var(--af-primary-soft); }
.search-select-trigger > i { flex:0 0 auto; color:var(--text-3); transition:transform .15s; }
.search-select.is-open .search-select-trigger > i { transform:rotate(180deg); }
.search-select-menu { position:absolute; z-index:1080; top:calc(100% + 5px); left:0; display:none; width:max(100%, 260px); padding:8px; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-md); box-shadow:0 12px 30px rgba(15,23,42,.16); }
.search-select-wide .search-select-menu { width:max(100%, 380px); }
.search-select.is-open .search-select-menu,
.search-select-menu.is-portal { display:block; }
.search-select-menu.is-portal {
  position: fixed;
  z-index: 3000;
  margin: 0;
}
.search-select-search { position:relative; margin-bottom:6px; }
.search-select-search > i { position:absolute; left:10px; top:50%; transform:translateY(-50%); color:var(--text-3); pointer-events:none; }
.search-select-search input { width:100%; min-height:36px; padding:6px 10px 6px 32px; border:1px solid var(--border); border-radius:var(--radius-sm); background:var(--surface); color:var(--text-1); }
.search-select-options { max-height:280px; overflow:auto; }
.search-select-option { width:100%; display:flex; align-items:center; gap:8px; padding:8px 10px; color:var(--text-1); background:transparent; border:0; border-radius:var(--radius-sm); text-align:left; }
.search-select-option:hover, .search-select-option:focus-visible { background:var(--surface-soft); outline:0; }
.search-select-option.is-selected { color:var(--af-primary); background:var(--af-primary-soft); }
.search-select-option-check { width:16px; opacity:0; }
.search-select-option.is-selected .search-select-option-check { opacity:1; }
.search-select-no-result { padding:14px 10px; color:var(--text-2); text-align:center; }

.search-suggest-host {
  position: relative;
}

.search-suggest {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 80;
  background: var(--surface);
  border: 0.5px solid var(--border-md);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  max-height: 320px;
  overflow: auto;
  padding: 4px;
}

.topbar-search .search-suggest {
  min-width: min(420px, 72vw);
}

.search-suggest-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: var(--fs-base);
  cursor: pointer;
}

.search-suggest-item.is-active,
.search-suggest-item:hover {
  background: var(--blue-50);
}

.search-suggest-item .ss-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.search-suggest-item .ss-title {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-suggest-item .ss-sub {
  font-size: var(--fs-sm);
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-suggest-item .ss-kind {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--text-3);
  background: var(--surface-soft);
  border-radius: 999px;
  padding: 2px 8px;
  margin-top: 2px;
}

.search-suggest-empty {
  padding: 12px;
  color: var(--text-3);
  font-size: var(--fs-sm);
  text-align: center;
}

.putaway-table {
  table-layout: fixed;
  width: 100%;
  min-width: 0 !important;
}

.putaway-table th,
.putaway-table td {
  white-space: normal !important;
  vertical-align: top;
  min-width: 0 !important;
}

.putaway-table th:nth-child(1),
.putaway-table td:nth-child(1) { width: 14%; }
.putaway-table th:nth-child(2),
.putaway-table td:nth-child(2) { width: 18%; }
.putaway-table th:nth-child(3),
.putaway-table td:nth-child(3) { width: 16%; }
.putaway-table th:nth-child(4),
.putaway-table td:nth-child(4) { width: 12%; }
.putaway-table th:nth-child(5),
.putaway-table td:nth-child(5) { width: 40%; }

.putaway-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.putaway-action-cell {
  min-width: 0;
  vertical-align: middle !important;
}

.putaway-actions {
  --putaway-control-h: 34px;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
  width: 100%;
}

.putaway-assign {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
  margin: 0;
}

.putaway-assign .putaway-bin-select,
.putaway-assign .search-select {
  flex: 1 1 9rem;
  width: auto;
  min-width: 7.5rem;
  max-width: 100%;
}

.putaway-assign .form-select,
.putaway-assign .search-select-trigger {
  height: var(--putaway-control-h);
  min-height: var(--putaway-control-h);
  padding-top: 0;
  padding-bottom: 0;
  box-sizing: border-box;
}

.putaway-assign .search-select-trigger {
  width: 100%;
  min-width: 0;
  padding-left: 8px;
  padding-right: 8px;
  font-size: var(--fs-sm);
}

.putaway-assign .putaway-qty-input,
.putaway-assign .form-control.putaway-qty-input {
  flex: 0 0 4.5rem;
  width: 4.5rem;
  min-width: 4.5rem;
  max-width: 4.5rem;
  height: var(--putaway-control-h);
  min-height: var(--putaway-control-h);
  padding-top: 0;
  padding-bottom: 0;
  box-sizing: border-box;
}

.putaway-assign .btn,
.putaway-cancel .btn {
  flex: 0 0 auto;
  height: var(--putaway-control-h);
  min-height: var(--putaway-control-h);
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
  box-sizing: border-box;
}

.putaway-assign .putaway-scan-serial-btn {
  flex: 0 0 var(--putaway-control-h);
  width: var(--putaway-control-h);
  padding-left: 0;
  padding-right: 0;
}

.putaway-cancel {
  flex: 0 0 auto;
  margin: 0;
}

.putaway-serials-count {
  margin-top: 4px;
}

@media (max-width: 1199.98px) {
  .putaway-actions {
    flex-wrap: wrap;
  }

  .putaway-assign {
    flex: 1 1 100%;
    flex-wrap: wrap;
  }

  .putaway-assign .putaway-bin-select,
  .putaway-assign .search-select {
    flex: 1 1 100%;
    min-width: 0;
  }
}

@media (max-width: 991.98px) {
  .putaway-table {
    table-layout: auto;
  }

  .putaway-table th:nth-child(n),
  .putaway-table td:nth-child(n) {
    width: auto;
  }

  .putaway-actions {
    flex-wrap: wrap;
  }

  .putaway-assign {
    flex-wrap: wrap;
    width: 100%;
  }

  .putaway-assign .putaway-bin-select,
  .putaway-assign .search-select {
    flex: 1 1 calc(100% - 5.5rem);
    min-width: 8rem;
  }
}

.dr-field {
  flex: 0 0 auto;
}

.filter-bar .dr-trigger {
  height: var(--filter-h);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 0.5px solid var(--border-md);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-base);
  font-family: var(--font);
  white-space: nowrap;
  max-width: 260px;
  cursor: pointer;
}

.filter-bar .dr-trigger .ti-calendar {
  color: var(--text-3);
  font-size: 16px;
}

.filter-bar .dr-trigger .dr-caret {
  color: var(--text-3);
  font-size: 14px;
  margin-left: 2px;
}

.filter-bar .dr-trigger .dr-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.filter-bar .dr-trigger:hover,
.filter-bar .dr-trigger.is-open {
  border-color: var(--af-primary);
}

.filter-bar .dr-trigger.is-active {
  border-color: var(--af-primary);
  color: var(--af-primary-dark);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--af-primary) 16%, transparent);
}

.filter-bar .dr-trigger.is-active .ti-calendar {
  color: var(--af-primary);
}

.dr-popover {
  position: fixed;
  z-index: 240;
  width: min(760px, calc(100vw - 16px));
  background: var(--surface);
  border: 0.5px solid var(--border-md);
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.16);
  overflow: hidden;
}

.dr-body {
  display: flex;
  min-height: 360px;
}

.dr-presets {
  width: 168px;
  flex-shrink: 0;
  padding: 12px 8px;
  background: var(--gray-50);
  border-right: 0.5px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dr-presets-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 6px 10px 8px;
}

.dr-preset {
  border: 0;
  background: transparent;
  text-align: left;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--text);
  font-size: var(--fs-sm);
  font-family: var(--font);
  cursor: pointer;
}

.dr-preset:hover {
  background: var(--surface);
}

.dr-preset.is-active {
  background: var(--blue-50);
  color: var(--af-primary-dark);
  font-weight: 600;
}

.dr-main {
  position: relative;
  flex: 1;
  padding: 16px 18px 8px;
  min-width: 0;
}

.dr-inputs {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.dr-input {
  flex: 1;
  height: 36px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border: 0.5px solid var(--border-md);
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  color: var(--text);
  background: var(--surface);
}

.dr-arrow {
  color: var(--text-3);
}

.dr-cal-nav {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 62px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.dr-nav {
  pointer-events: auto;
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  border-radius: 8px;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.dr-nav:hover {
  background: var(--gray-50);
  color: var(--text);
}

.dr-months {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.dr-month-title {
  text-align: center;
  font-weight: 600;
  font-size: var(--fs-base);
  margin-bottom: 10px;
}

.dr-weekdays,
.dr-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.dr-weekdays span {
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
  padding: 4px 0 8px;
}

.dr-day {
  height: 34px;
  border: 0;
  background: transparent;
  border-radius: 999px;
  font-size: var(--fs-sm);
  color: var(--text);
  font-family: var(--font);
  cursor: pointer;
}

.dr-day.is-empty {
  pointer-events: none;
}

.dr-day:hover:not(.is-start):not(.is-end):not(.is-single) {
  background: var(--gray-50);
}

.dr-day.is-in {
  background: var(--blue-50);
  border-radius: 0;
}

.dr-day.is-start,
.dr-day.is-end,
.dr-day.is-single {
  background: var(--af-primary);
  color: #fff;
  font-weight: 600;
}

.dr-day.is-start.is-in:not(.is-single) {
  border-radius: 999px 0 0 999px;
}

.dr-day.is-end.is-in:not(.is-single) {
  border-radius: 0 999px 999px 0;
}

.dr-day.is-today:not(.is-start):not(.is-end):not(.is-single) {
  font-weight: 700;
  color: var(--af-primary);
}

.dr-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 16px 14px;
  border-top: 0.5px solid var(--border);
}

@media (max-width: 767px) {
  .filter-bar .dr-field,
  .filter-bar .dr-trigger {
    width: 100%;
    max-width: none;
    flex: 1 1 100%;
    justify-content: flex-start;
  }

  .dr-body {
    flex-direction: column;
    min-height: 0;
  }

  .dr-presets {
    width: auto;
    flex-direction: row;
    flex-wrap: wrap;
    border-right: 0;
    border-bottom: 0.5px solid var(--border);
  }

  .dr-months {
    grid-template-columns: 1fr;
  }
}

/* Compact flash/realtime toast: bottom-left, no page-blocking backdrop. */
.app-flash-toast {
  position: fixed;
  left: 24px;
  bottom: 24px;
  z-index: 1090;
  width: min(430px, calc(100vw - 32px));
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 32px;
  gap: 12px;
  align-items: center;
  padding: 14px 14px 14px 16px;
  color: #172033;
  background: rgba(255, 255, 255, .98);
  border: 1px solid #dce6f2;
  border-radius: 22px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, .18);
  opacity: 0;
  transform: translateY(18px) scale(.98);
  transition: opacity .22s ease, transform .22s ease;
  pointer-events: none;
}

.app-flash-toast[hidden] { display: none !important; }
.app-flash-toast.is-visible { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.app-flash-toast.is-leaving { opacity: 0; transform: translateY(10px) scale(.985); }

.app-flash-toast-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  align-self: start;
  color: #1672b8;
  background: #eef8ff;
  border: 1px solid #b9e3ff;
  border-radius: 50%;
  font-size: 23px;
}

.app-flash-toast.is-danger { border-color: #fecaca; }
.app-flash-toast.is-danger .app-flash-toast-icon {
  color: #dc2626;
  background: #fff1f2;
  border-color: #fecdd3;
}

.app-flash-toast-content { min-width: 0; }
.app-flash-toast-title {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  padding: 3px 10px;
  color: #0869a6;
  background: #eaf7ff;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-flash-toast.is-danger .app-flash-toast-title { color: #b91c1c; background: #fff1f2; }

.app-flash-toast-message,
.app-flash-toast-hint {
  margin: 5px 0 0;
  color: #334155;
  font-size: 14px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.app-flash-toast-hint { color: #64748b; font-size: 12px; }
.app-flash-toast-message[hidden],
.app-flash-toast-hint[hidden],
.app-flash-toast-link[hidden] { display: none !important; }

.app-flash-toast-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 7px;
  color: #126bb0;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}
.app-flash-toast-link:hover { color: #084d82; text-decoration: underline; }

.app-flash-toast-close {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  align-self: start;
  padding: 0;
  color: #7c8799;
  background: transparent;
  border: 0;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
}
.app-flash-toast-close:hover { color: #172033; background: #f1f5f9; }
.app-flash-toast-close:focus-visible { outline: 3px solid rgba(37, 99, 235, .25); }

@media (max-width: 575.98px) {
  .app-flash-toast {
    left: 16px;
    bottom: 16px;
    grid-template-columns: 42px minmax(0, 1fr) 28px;
    gap: 10px;
    border-radius: 18px;
  }
  .app-flash-toast-icon { width: 42px; height: 42px; font-size: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .app-flash-toast { transition: none; }
}

.link-order {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.link-order:hover {
  color: var(--af-primary);
  text-decoration: underline;
}

.kv {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 8px 12px;
  margin: 0;
}

.kv dt {
  color: var(--text-3);
  font-size: var(--fs-sm);
  font-weight: 500;
}

.kv dd {
  margin: 0;
  word-break: break-word;
}

.packing-video-player {
  display: block;
  width: 100%;
  max-height: 220px;
  margin-top: 0.25rem;
  background: #111;
  border-radius: 6px;
}

.packing-video-player-lg {
  display: block;
  width: 100%;
  max-height: 70vh;
  background: #111;
  border-radius: 8px;
}

.od-totals {
  padding: 12px var(--space-5) 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: 0.5px solid var(--border);
  background: var(--surface-soft);
}

.od-totals > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: var(--fs-sm);
  color: var(--text-2);
}

.od-totals .od-total {
  font-size: var(--fs-base);
  color: var(--text);
  padding-top: 6px;
  border-top: 0.5px dashed var(--border);
}

.od-ship + .od-ship {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 0.5px solid var(--border);
}

.od-ship-hd {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.od-timeline {
  list-style: none;
  margin: 16px 0 0;
  padding: 0 0 0 4px;
  border-left: 2px solid var(--border);
}

.od-timeline li {
  position: relative;
  padding: 0 0 14px 16px;
}

.od-timeline li:last-child {
  padding-bottom: 0;
}

.od-timeline li::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-md);
}

.od-timeline li.is-current::before {
  background: var(--af-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--af-primary) 20%, transparent);
}

.od-tl-label {
  font-weight: 600;
  font-size: var(--fs-sm);
}

.od-tl-time {
  color: var(--text-3);
  font-size: var(--fs-sm);
}

tr.is-stock-short td {
  background: color-mix(in srgb, var(--af-danger) 6%, transparent);
}

.combo-toggle {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  padding: 0;
  margin-top: 1px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-md, var(--border));
  border-radius: 8px;
  background: var(--surface);
  color: var(--af-primary);
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  box-shadow: none;
}
.combo-toggle:hover {
  background: var(--blue-50);
  color: var(--af-primary-dark);
  border-color: var(--af-primary);
}
.combo-toggle[aria-expanded="true"] {
  background: var(--blue-50);
  color: var(--af-primary-dark);
  border-color: var(--af-primary);
}
.combo-child-row td {
  background: var(--surface-soft, #f8fafc);
}

.ri-combo-parent td {
  background: var(--blue-50, #eef1ff);
  vertical-align: middle;
}
.ri-combo-child td {
  background: var(--surface-soft, #f8fafc);
}
.ri-combo-child-icon {
  font-size: 14px;
  opacity: 0.55;
  margin-top: 2px;
  color: var(--text-2);
}
.ri-combo-tag {
  margin-top: 2px;
}

.product-thumb {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--text-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}

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

/* Sortable list tables without server-side sort links. */
.data-table th.client-sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.data-table th.client-sortable:hover,
.data-table th.client-sortable:focus-visible {
  color: var(--af-primary);
  background: color-mix(in srgb, var(--af-primary) 7%, transparent);
  outline: none;
}

.client-sort-icon {
  display: inline-block;
  min-width: 1rem;
  margin-left: 0.35rem;
  color: var(--text-3);
  font-size: 0.68rem;
  text-align: center;
}

.data-table th.client-sortable[aria-sort="ascending"] .client-sort-icon,
.data-table th.client-sortable[aria-sort="descending"] .client-sort-icon {
  color: var(--af-primary);
}

/* =============================================================================
   OneFul — layout utilities (extracted from view inline styles)
   ============================================================================= */

.panel-constrain-sm { max-width: 420px; }
.panel-constrain-md { max-width: 520px; }
.form-constrain-md { max-width: 640px; }

.control-mw-name { max-width: 8rem; }
.control-mw-saved { max-width: 11rem; }
.control-mw-filter { max-width: 220px; }
.control-mw-wh { max-width: 280px; }

.th-check { width: 36px; }
.th-qty { width: 140px; }

.text-pre-wrap { white-space: pre-wrap; }
.chip-row-flush { margin-top: 0; }

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

.sig-pad {
  border: 1px solid var(--border-md, #ccc);
  border-radius: 8px;
  touch-action: none;
  background: #fff;
  width: 100%;
  max-width: 100%;
}

.dispatch-manifest-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px 10px;
}

.dispatch-manifest-grid > .field {
  margin-bottom: 0;
}

.dispatch-manifest-grid > .field .form-label {
  margin-bottom: 4px;
}

.dispatch-manifest-grid > .field-span-full {
  grid-column: 1 / -1;
}

.dispatch-signature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.dispatch-signature-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}

.dispatch-manifest-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
}

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

@media (max-width: 767.98px) {
  .dispatch-manifest-grid,
  .dispatch-signature-grid { grid-template-columns: 1fr; }
  .dispatch-manifest-actions { align-items: stretch; flex-direction: column; }
}

.asn-qc-grade { width: auto; min-width: 4.5rem; }
.asn-qc-notes { width: 9rem; }
.asn-qc-photos { width: 10rem; }

.filter-w-auto { width: auto; }

.manifest-toolbar { margin-bottom: 12px; }
.manifest-signer {
  margin-top: 12px;
  font-weight: 600;
}

.qc-sheet { max-width: 720px; margin: 0 auto; }
.qc-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.qc-photos img {
  max-width: 160px;
  max-height: 160px;
  object-fit: cover;
  border: 1px solid var(--border, #ddd);
  border-radius: 6px;
}

/* Roles & permissions */
.roles-page-header { margin-bottom: 18px; }
.roles-summary-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; margin-bottom:16px; }
.roles-summary-card { display:flex; align-items:center; gap:13px; padding:16px 18px; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-lg); box-shadow:var(--shadow-sm); }
.roles-summary-card strong { display:block; color:var(--text-1); font-size:1.35rem; line-height:1.15; }
.roles-summary-card span:not(.roles-summary-icon) { display:block; margin-top:3px; color:var(--text-2); font-size:var(--fs-sm); }
.roles-summary-icon { width:42px; height:42px; display:grid; place-items:center; border-radius:12px; font-size:20px; }
.roles-summary-icon.is-blue { color:#2563eb; background:#eff6ff; }.roles-summary-icon.is-violet { color:#7c3aed; background:#f5f3ff; }.roles-summary-icon.is-green { color:#059669; background:#ecfdf5; }
.panel-subtitle { margin-top:3px; color:var(--text-2); font-size:var(--fs-sm); font-weight:400; }
.roles-table td { vertical-align:middle; }
.role-identity { display:flex; align-items:center; gap:11px; }
.role-avatar { width:36px; height:36px; display:grid; place-items:center; flex:0 0 36px; color:#2563eb; background:#eff6ff; border-radius:10px; font-size:17px; }
.role-avatar.is-custom { color:#7c3aed; background:#f5f3ff; }
.role-type-badge { display:inline-flex; align-items:center; gap:5px; padding:4px 9px; border-radius:999px; font-size:var(--fs-sm); font-weight:500; }
.role-type-badge.is-system { color:#475569; background:#f1f5f9; }.role-type-badge.is-custom { color:#6d28d9; background:#f3e8ff; }
.role-permission-progress { width:min(280px,100%); color:var(--text-2); font-size:var(--fs-xs); }
.role-permission-progress strong { color:var(--text-1); }.role-permission-progress .progress { height:5px; margin-top:7px; background:#eef2f7; }.role-permission-progress .progress-bar { background:var(--af-primary); border-radius:99px; }
.roles-protected { width:32px; height:32px; display:inline-grid; place-items:center; color:var(--text-3); background:var(--surface-muted); border:1px solid var(--border); border-radius:var(--radius-md); }
.roles-matrix-body { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; background:var(--surface-muted); }
.permission-group-card { min-width:0; overflow:hidden; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-lg); }
.permission-group-heading { display:flex; align-items:center; gap:11px; padding:15px 16px; border-bottom:1px solid var(--border); }
.permission-group-icon { width:36px; height:36px; display:grid; place-items:center; flex:0 0 36px; color:var(--af-primary); background:color-mix(in srgb,var(--af-primary) 10%,white); border-radius:10px; font-size:17px; }
.permission-group-heading h3 { margin:0; font-size:var(--fs-base); font-weight:650; }.permission-group-heading p { margin:3px 0 0; color:var(--text-2); font-size:var(--fs-xs); }
.permission-feature-list { padding:4px 14px 10px; }.permission-feature-row { padding:10px 2px; border-bottom:1px solid color-mix(in srgb,var(--border) 70%,transparent); }.permission-feature-row:last-child { border-bottom:0; }
.permission-feature-name { margin-bottom:7px; color:var(--text-1); font-size:var(--fs-sm); font-weight:600; }.permission-action-list { display:flex; flex-wrap:wrap; gap:5px; }
.permission-action-chip { padding:3px 7px; color:#475569; background:#f1f5f9; border-radius:5px; font-size:11px; line-height:1.3; }
.role-modal .modal-body { background:#f8fafc; }.role-modal-basics { display:grid; grid-template-columns:1fr 1.35fr .85fr; gap:14px; align-items:start; padding:16px; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-lg); }
.role-active-switch { min-height:65px; display:flex; align-items:center; gap:10px; margin-top:25px; padding:10px 12px; background:#f8fafc; border:1px solid var(--border); border-radius:var(--radius-md); cursor:pointer; }
.role-active-switch strong,.role-active-switch small { display:block; }.role-active-switch small { margin-top:2px; color:var(--text-2); font-size:var(--fs-xs); }
.role-permission-toolbar { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-top:16px; padding:12px 2px; }.role-permission-toolbar strong,.role-permission-toolbar span { display:block; }.role-permission-toolbar span { margin-top:2px; color:var(--text-2); font-size:var(--fs-sm); }.role-permission-toolbar>div:last-child { display:flex; gap:7px; }
.role-permission-picker { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; }.role-picker-group { overflow:hidden; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-lg); }
.role-picker-group-title { display:flex; align-items:center; justify-content:space-between; padding:12px 14px; background:#f8fafc; border-bottom:1px solid var(--border); }.role-picker-group-title span { color:var(--text-2); font-size:var(--fs-xs); }
.role-picker-feature { padding:11px 14px; border-bottom:1px solid var(--border); }.role-picker-feature:last-child { border-bottom:0; }.role-picker-feature-name { margin-bottom:8px; font-size:var(--fs-sm); font-weight:600; }
.role-picker-actions { display:flex; flex-wrap:wrap; gap:6px; }.role-permission-option { display:inline-flex; align-items:center; gap:6px; margin:0; padding:5px 8px; color:var(--text-2); background:#f8fafc; border:1px solid var(--border); border-radius:6px; font-size:var(--fs-xs); cursor:pointer; }.role-permission-option:has(input:checked) { color:#1d4ed8; background:#eff6ff; border-color:#93c5fd; }.role-permission-option .form-check-input { margin:0; }
@media(max-width:991.98px){.roles-matrix-body,.role-permission-picker{grid-template-columns:1fr 1fr}.role-modal-basics{grid-template-columns:1fr 1fr}.role-active-switch{margin-top:0}}
@media(max-width:767.98px){.roles-summary-grid,.roles-matrix-body,.role-permission-picker,.role-modal-basics{grid-template-columns:1fr}.roles-table .role-permission-progress{min-width:160px}.role-permission-toolbar{align-items:flex-start;flex-direction:column}}

/* Warehouse mobile: compact headers and filters without flex-basis height gaps. */
@media (max-width: 767.98px) {
  .page-header {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 18px;
  }

  .page-header > div:first-child {
    width: 100%;
    flex: 0 0 auto;
  }

  .page-title {
    margin-bottom: 5px;
    font-size: clamp(24px, 7vw, 30px);
    line-height: 1.2;
  }

  .page-sub {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
  }

  .page-header-actions {
    width: 100%;
    margin: 0;
    display: grid;
    grid-template-columns: 1fr;
  }

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

  .panel-toolbar {
    padding: 14px;
  }

  .panel-toolbar .filter-bar,
  .panel-toolbar .filter-bar-fill {
    width: 100%;
    height: auto;
    min-height: 0;
    flex: 0 0 auto;
    align-items: stretch;
    gap: 10px;
  }

  .filter-bar > *,
  .filter-bar .search-wrap,
  .filter-bar .form-select,
  .filter-bar .form-control,
  .filter-bar .filter-sel,
  .filter-bar .form-select-sm,
  .filter-bar .filter-sel-sm,
  .filter-bar .filter-sel-lg,
  .filter-bar .search-select,
  .filter-bar .search-select.filter-sel,
  .filter-bar .search-select.filter-sel-sm,
  .filter-bar .search-select.filter-sel-lg,
  .filter-bar .dr-field,
  .filter-bar .dr-trigger,
  .filter-bar .sort-sel {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: auto;
    flex: 0 0 auto !important;
  }

  .filter-bar .search-wrap input,
  .filter-bar .form-select,
  .filter-bar .form-control,
  .filter-bar .sort-sel,
  .filter-bar .search-select-trigger,
  .filter-bar .dr-trigger,
  .filter-bar .btn {
    min-height: 44px;
    height: 44px;
    border-radius: 10px;
    font-size: 15px;
  }

  .filter-bar .btn:not(.filter-reset) {
    width: 100% !important;
    flex: 0 0 auto !important;
  }

  .filter-bar .filter-reset {
    width: 44px !important;
    min-width: 44px !important;
    flex: 0 0 44px !important;
  }

  .filter-bar .search-select-native {
    position: absolute !important;
    flex: none !important;
  }

  .search-select-menu.is-portal {
    max-width: calc(100vw - 24px);
  }

  .data-table .client-tag {
    max-width: 92px;
    padding: 0;
    color: var(--af-primary);
    background: transparent;
    border: 0;
    border-radius: 0;
    font-size: 10px;
  }

  .data-table .badge {
    padding: 2px 6px;
    font-size: 10px;
  }
}

@media print {
  .no-print,
  .page-header-actions,
  .app-sidebar,
  .app-topbar {
    display: none !important;
  }
}

/* Inventory alerts — warehouse filter in header + KPI cards as tabs */
.alerts-header-actions {
  align-items: center;
}
.alerts-wh-filter {
  display: flex;
  align-items: center;
  margin: 0;
}
.alerts-wh-select,
.alerts-wh-filter .search-select {
  min-width: 180px;
  max-width: 240px;
}
.alerts-stat-tabs {
  gap: 12px;
}
.alerts-stat-card {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface, #fff);
  text-align: left;
  cursor: pointer;
  width: 100%;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.alerts-stat-card:hover {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
}
.alerts-stat-card.is-active {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--primary) 35%, transparent);
}
.alerts-stat-card:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.alerts-tab-content > .tab-pane {
  outline: none;
}
@media (max-width: 767.98px) {
  .alerts-header-actions {
    width: 100%;
  }
  .alerts-wh-filter,
  .alerts-wh-select,
  .alerts-wh-filter .search-select {
    width: 100%;
    max-width: none;
  }
}

/* Pack manifest page — spacing giữa các box, padding trong panel */
.pack-manifest-page {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}
.pack-manifest-page > .pack-manifest-header {
  margin-bottom: 0;
}
.pack-manifest-page > .panel {
  margin-bottom: 0;
}
.pack-manifest-header {
  align-items: flex-start;
  gap: 20px 28px;
  min-width: 0;
  padding-bottom: 4px;
}
.pack-manifest-title {
  min-width: 0;
  flex: 1 1 240px;
  overflow: hidden;
}
.pack-manifest-title .page-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pack-manifest-title .page-sub {
  margin-top: 4px;
}
.pack-scan-progress {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 14px;
  line-height: 1;
  color: var(--text, #111);
}
.pack-scan-progress-num {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.pack-scan-progress-sep {
  font-size: 28px;
  font-weight: 600;
  color: var(--muted, #6b7280);
}
.pack-manifest-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 14px;
  flex: 1 1 340px;
  max-width: min(100%, 580px);
  min-width: 0;
}
.pack-manifest-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 20px;
  width: 100%;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface, #fff);
  box-sizing: border-box;
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(15, 23, 42, .04));
}
.pack-meta-item {
  min-width: 0;
}
.pack-meta-lbl {
  display: block;
  margin-bottom: 3px;
  font-size: 11px;
  color: var(--muted, #6b7280);
  letter-spacing: .02em;
}
.pack-meta-val {
  display: block;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pack-manifest-btns {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.pack-manifest-btns form {
  display: inline-flex;
  margin: 0;
}
.pack-manifest-btns .btn {
  --pack-btn-h: 38px;
  height: var(--pack-btn-h);
  min-height: var(--pack-btn-h);
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

/* Scan + lines panels */
.pack-scan-panel .panel-header,
.pack-lines-panel .panel-header {
  padding: 16px 20px;
}
.pack-scan-panel .panel-body {
  padding: 18px 20px 20px;
}
.pack-scan-hint {
  margin: 0 0 14px;
  color: var(--text-2);
  font-size: var(--fs-base);
  line-height: 1.45;
}
.pack-scan-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: var(--fs-sm);
  line-height: 1.4;
}
.pack-scan-note .ti {
  margin-top: 1px;
  flex: 0 0 auto;
}
.pack-last-scan-panel {
  border-color: var(--af-primary, #2563eb);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.12);
}
.pack-last-scan-body {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
.pack-last-scan-thumb {
  flex: 0 0 auto;
  width: 72px;
  height: 72px;
}
.pack-last-scan-kv {
  flex: 1 1 auto;
  min-width: 0;
}
.attachments-panel .panel-footer.attachments-upload-bar {
  padding: 12px 16px 14px;
  border-top: 1px solid var(--border);
  background: #fafbfc;
}
.attachments-upload-bar .filter-bar {
  margin: 0;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.attachments-file-field {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 34px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}
.attachments-file-btn {
  flex: 0 0 auto;
  margin: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.attachments-file-btn input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
.attachments-file-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted, #6b7280);
  font-size: 0.875rem;
}
.attachments-file-name.has-file {
  color: var(--text, #111827);
  font-weight: 500;
}
.attachments-table td,
.attachments-table th {
  padding: 10px 14px;
  vertical-align: middle;
}
.pack-lines-panel .panel-toolbar {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: #fafbfc;
}
.pack-lines-panel .panel-toolbar .filter-bar {
  margin: 0;
}
.pack-lines-panel .panel-toolbar .search-wrap {
  max-width: 420px;
}
.pack-lines-panel .data-table th,
.pack-lines-panel .data-table td {
  padding: 12px 16px;
  vertical-align: middle;
}
.pack-lines-panel .data-table th:first-child,
.pack-lines-panel .data-table td:first-child {
  padding-left: 20px;
}
.pack-lines-panel .data-table th:last-child,
.pack-lines-panel .data-table td:last-child {
  padding-right: 20px;
}
.pack-lines-panel .empty-state-pad {
  padding: 28px 20px;
}

/* Pack verify scan row — input / checkbox / button cùng hàng, không bị ép */
.pack-verify-bar {
  --pack-control-h: 42px;
  margin: 0;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 12px;
  min-width: 0;
}
.pack-verify-bar .pack-verify-search {
  flex: 1 1 auto;
  min-width: 0;
  max-width: none;
  height: var(--pack-control-h);
  padding-right: 4px;
  border: 1px solid var(--border-md, var(--border));
  border-radius: var(--radius-md);
  background: var(--surface);
  display: flex;
  align-items: center;
}
.pack-verify-bar .pack-verify-search:focus-within {
  border-color: var(--af-primary);
  box-shadow: var(--focus-ring);
}
.pack-verify-bar .pack-verify-search .form-control,
.pack-verify-bar .pack-verify-search input {
  height: 100%;
  min-height: 0;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
.pack-verify-bar .pack-enter-qty {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0 10px;
  height: var(--pack-control-h);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #f8fafc;
  white-space: nowrap;
  font-size: var(--fs-base);
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
  box-sizing: border-box;
}
.pack-verify-bar .pack-enter-qty .form-check-input {
  width: 1.1em;
  height: 1.1em;
  margin: 0;
  flex: 0 0 auto;
  cursor: pointer;
}
.pack-verify-bar .pack-verify-btn,
.pack-verify-bar > .btn {
  flex: 0 0 auto;
  height: var(--pack-control-h);
  min-height: var(--pack-control-h);
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  box-sizing: border-box;
}
@media (max-width: 767.98px) {
  .pack-verify-bar {
    flex-wrap: wrap;
  }
  .pack-verify-bar .pack-verify-search {
    flex: 1 1 100%;
  }
  .pack-verify-bar .pack-enter-qty {
    flex: 1 1 auto;
  }
  .pack-verify-bar .pack-verify-btn,
  .pack-verify-bar > .btn {
    flex: 1 1 auto;
  }
}
@media (max-width: 991.98px) {
  .pack-manifest-actions {
    align-items: stretch;
    max-width: none;
    width: 100%;
    flex: 1 1 100%;
  }
  .pack-manifest-btns {
    justify-content: flex-start;
  }
}
@media (max-width: 575.98px) {
  .pack-manifest-page {
    gap: 16px;
  }
  .pack-manifest-meta {
    grid-template-columns: 1fr;
    padding: 14px 16px;
  }
  .pack-manifest-title .page-title {
    white-space: normal;
  }
  .pack-scan-panel .panel-header,
  .pack-lines-panel .panel-header,
  .pack-scan-panel .panel-body,
  .pack-lines-panel .panel-toolbar {
    padding-left: 16px;
    padding-right: 16px;
  }
}

.badge.b-sameday {
  background: #dc2626;
  color: #fff;
}
.badge.b-express {
  background: #fee2e2;
  color: #b91c1c;
}

/* Warehouse location map */
.location-map-filters {
  padding: 0;
  overflow: hidden;
}
.location-map-filters > .location-map-filter-form,
.location-map-filter-form {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}
.location-map-filter-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  min-width: 0;
}
.location-map-selects {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex: 1 1 520px;
  min-width: 0;
}
.location-map-selects > .form-select,
.location-map-selects > .search-select {
  flex: 1 1 140px;
  width: auto;
  min-width: 132px;
  max-width: 220px;
  height: var(--filter-h, 38px);
}
.location-map-selects > .search-select {
  display: inline-flex;
}
.location-map-search-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 320px;
  min-width: 0;
}
.location-map-search {
  flex: 1 1 auto;
  min-width: 0;
  position: relative;
}
.location-map-search .si {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
  font-size: 16px;
}
.location-map-search input {
  width: 100%;
  height: var(--filter-h, 38px);
  padding: 0 12px 0 34px;
  border: 0.5px solid var(--border-md, var(--border));
  border-radius: var(--radius-md, 8px);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-base);
  font-family: var(--font);
}
.location-map-search input:focus {
  outline: 0;
  border-color: var(--af-primary);
  box-shadow: 0 0 0 3px var(--af-primary-soft, rgba(37, 99, 235, .12));
}
.location-map-search-group .btn {
  flex-shrink: 0;
  height: var(--filter-h, 38px);
  padding-inline: 14px;
}
.location-map-reset {
  width: var(--filter-h, 38px);
  padding-inline: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.location-map-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface-muted, #f8fafc);
  color: var(--text-2, #64748b);
  font-size: 12px;
  line-height: 1.3;
}
.location-map-legend-label {
  margin-right: 2px;
  color: var(--text-3, #94a3b8);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.location-map-legend > span:not(.location-map-legend-label) {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px 3px 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-2, #64748b);
  white-space: nowrap;
}
.location-map-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: #dcfce7;
  border: 1px solid #86efac;
  flex-shrink: 0;
}
.location-map-dot.is-pick {
  background: #dbeafe;
  border-color: #93c5fd;
}
.location-map-dot.is-inactive {
  background: #f3f4f6;
  border-color: #d1d5db;
}
.location-map-zone {
  margin-bottom: 16px;
}
.location-map-body {
  display: grid;
  gap: 18px;
}
.location-map-rack {
  min-width: 0;
}
.location-map-rack-title {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 9px;
  color: var(--text, #111827);
  font-size: 13px;
  font-weight: 700;
}
.location-map-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 10px;
}
.location-map-cell {
  position: relative;
  display: flex;
  min-height: 108px;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  padding: 13px;
  overflow: hidden;
  border: 1px solid #86efac;
  border-left: 4px solid #22c55e;
  border-radius: 10px;
  background: #f0fdf4;
  color: #14532d;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  font: inherit;
  width: 100%;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.location-map-cell:hover {
  color: inherit;
  transform: translateY(-2px);
  box-shadow: 0 7px 18px rgba(15, 23, 42, .10);
}
.location-map-cell.is-pick {
  border-color: #93c5fd;
  border-left-color: #3b82f6;
  background: #eff6ff;
  color: #1e3a8a;
}
.location-map-cell.is-inactive {
  border-color: #d1d5db;
  border-left-color: #9ca3af;
  background: #f9fafb;
  color: #6b7280;
  filter: grayscale(.25);
}
.location-map-cell.is-hit {
  border-color: #f59e0b;
  border-left-color: #d97706;
  background: #fffbeb;
  color: #92400e;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, .35);
  z-index: 1;
}
.location-map-dot.is-hit {
  background: #fef3c7;
  border-color: #f59e0b;
}
.location-map-code {
  font-size: 15px;
  font-weight: 800;
  overflow-wrap: anywhere;
}
.location-map-name {
  flex: 1;
  color: currentColor;
  font-size: 12px;
  line-height: 1.35;
  opacity: .82;
}
.location-map-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 10px;
  padding-top: 7px;
  border-top: 1px solid currentColor;
  font-size: 11px;
  opacity: .68;
}
@media (max-width: 991.98px) {
  .location-map-selects > .form-select,
  .location-map-selects > .search-select {
    flex: 1 1 calc(50% - 8px);
    max-width: none;
  }
}
@media (max-width: 575.98px) {
  .location-map-filter-main {
    padding: 12px;
    gap: 10px;
  }
  .location-map-selects,
  .location-map-search-group {
    flex: 1 1 100%;
  }
  .location-map-selects > .form-select,
  .location-map-selects > .search-select {
    flex: 1 1 100%;
  }
  .location-map-search-group .btn-primary {
    flex: 1 1 auto;
  }
  .location-map-legend {
    padding: 8px 12px;
  }
  .location-map-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .location-map-cell {
    min-height: 96px;
  }
}

/* ===== Mobile responsive: header actions, filters, report meters (2026-10-29) ===== */
@media (max-width: 767.98px) {
  .page-header {
    display: flex;
    flex-direction: column;
    align-items: stretch !important;
    gap: 12px;
  }

  .page-header > div:first-child {
    width: 100%;
    flex: 0 0 auto;
    min-width: 0;
  }

  .page-header-actions {
    width: 100% !important;
    max-width: 100%;
    margin: 0 !important;
    flex: 0 0 auto !important;
    display: flex !important;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    justify-content: flex-start !important;
    gap: 10px;
  }

  .page-header-actions > form,
  .page-header-actions > .filter-bar,
  .page-header-actions > .filter-bar-fill,
  .page-header-actions > .btn,
  .page-header-actions > a.btn,
  .page-header-actions > .btn-primary,
  .page-header-actions > .btn-secondary,
  .page-header-actions > .btn-outline-success,
  .page-header-actions > .btn-outline-secondary,
  .page-header-actions > .btn-outline-primary {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    flex: 0 0 auto !important;
    justify-content: center;
  }

  .page-header-actions .filter-bar,
  .page-header-actions .filter-bar-fill {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin: 0;
  }

  .panel-toolbar {
    overflow: visible;
  }

  .panel-toolbar .filter-bar,
  .panel-toolbar .filter-bar-fill,
  .panel-body > .filter-bar {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    flex-wrap: nowrap;
    gap: 10px;
  }

  .filter-bar > *,
  .filter-bar .search-wrap,
  .filter-bar .form-select,
  .filter-bar .form-control,
  .filter-bar .filter-sel,
  .filter-bar .form-select-sm,
  .filter-bar .filter-sel-sm,
  .filter-bar .filter-sel-lg,
  .filter-bar .search-select,
  .filter-bar .search-select.filter-sel,
  .filter-bar .search-select.filter-sel-sm,
  .filter-bar .search-select.filter-sel-lg,
  .filter-bar .dr-field,
  .filter-bar .dr-trigger,
  .filter-bar .sort-sel,
  .filter-bar .btn:not(.filter-reset) {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    flex: 0 0 auto !important;
  }

  .filter-bar .filter-reset {
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    flex: 0 0 44px !important;
    align-self: flex-start;
  }

  .filter-bar-stacked .filter-row,
  .filter-bar-stacked .filter-row-dims,
  .filter-bar-stacked .filter-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    margin-left: 0;
  }

  .filter-bar-stacked .filter-actions .btn {
    width: 100%;
  }

  .filter-bar .dr-trigger {
    max-width: none !important;
    justify-content: flex-start;
  }

  .stats-grid,
  .stats-grid-6 {
    grid-template-columns: 1fr !important;
  }

  .status-chips {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 8px;
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  .status-chips::-webkit-scrollbar { display: none; }
  .status-chip {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  /* Report meter rows: label + bar on one line, no empty ghost column */
  .report-table td[data-label] {
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .report-table td:not([data-label]) {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    grid-template-columns: none;
  }
  .report-table td:not([data-label])::before {
    content: none !important;
    display: none !important;
  }
  .report-table td:not([data-label]) > * {
    grid-column: auto;
  }

  .report-table td .report-meter {
    width: 100%;
    min-width: 0;
  }

  .report-meter {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    justify-content: flex-start;
    gap: 8px;
  }
  .report-meter-track {
    flex: 1 1 auto;
    max-width: none !important;
    min-width: 48px;
  }
  .report-meter .money-cell {
    flex: 0 0 auto;
    min-width: 1.5ch;
    text-align: right;
  }

  .alerts-header-actions,
  .alerts-wh-filter,
  .alerts-wh-select {
    width: 100%;
    max-width: none;
  }
}

