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

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

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

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

html {
  scroll-behavior: smooth;
  font-family: var(--font);
}

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

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

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

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: 0;
  padding-left: 12px;
}

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

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

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

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

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

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

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

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

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

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


/* --- 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: 200px;
  padding: 6px;
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md, 0 8px 24px rgba(0, 0, 0, .08));
}

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

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

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

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

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

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

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

.auth-brand {
  display: flex;
  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);
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

.user-av {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #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;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

.settings-menu {
  position: relative;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/* --- 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.stat-card {
  text-decoration: none;
  color: inherit;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

a.stat-card:hover {
  border-color: color-mix(in srgb, var(--af-primary) 35%, var(--border));
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

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

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

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

.panel-count {
  margin-left: auto;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-3);
  background: var(--surface-soft);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 2px 10px;
}

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

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

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

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

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

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

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

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


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

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

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

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

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

/* Không dùng flex trực tiếp trên <td> — sẽ vỡ bề rộng cột / nền hover */
td.td-actions,
td.table-actions {
  display: table-cell;
  width: 1%;
  text-align: right;
  white-space: nowrap;
  vertical-align: middle;
  background: transparent;
}

td.td-actions > :not(:last-child),
td.table-actions > :not(:last-child) {
  margin-right: 6px;
}

td.td-actions > a,
td.td-actions > button,
td.td-actions > form,
td.table-actions > a,
td.table-actions > button,
td.table-actions > form {
  vertical-align: middle;
}

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

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

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

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

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

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

.td-action-btn.text-danger {
  color: var(--red-700, #b91c1c);
  border-color: color-mix(in srgb, var(--red-600, #dc2626) 35%, var(--border));
}

.td-action-btn.text-danger:hover {
  background: var(--red-50, #fef2f2);
  border-color: var(--red-600, #dc2626);
  color: var(--red-800, #991b1b);
}

.td-action-btn.text-success {
  color: var(--green-700, #15803d);
  border-color: color-mix(in srgb, var(--green-600, #16a34a) 35%, var(--border));
}

.td-action-btn.text-success:hover {
  background: var(--green-50, #f0fdf4);
  border-color: var(--green-600, #16a34a);
  color: var(--green-800, #166534);
}

.data-table th.th-actions,
.data-table td.td-actions {
  text-align: right;
  width: 1%;
  white-space: nowrap;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/* ---------------------------------------------------------------------------
   8. Badges
   --------------------------------------------------------------------------- */
/* Status badges — modifiers only; leaves Bootstrap .badge / .text-bg-* intact */
.badge.b-pending,
.badge.b-draft,
.badge.b-low,
.badge.b-processing,
.badge.b-shipped,
.badge.b-delivered,
.badge.b-cancelled,
.badge.b-oos,
.badge.b-refund,
.badge.b-active,
.badge.b-muted,
.badge.b-info,
.badge.b-warning,
.badge.b-success,
.badge.b-danger,
.badge.seg-vip,
.badge.seg-new,
.badge.seg-loyal,
.badge.seg-atrisk,
.badge.seg-inactive,
.badge.seg-pos,
.badge.badge-tag,
.badge.badge-option,
.badge.src-shopee,
.badge.src-lazada,
.badge.src-tiktok,
.badge.src-facebook,
.badge.src-zalo {
  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);
}

.badge.src-shopee {
  background: #fff1e8;
  color: #c2410c;
}

.badge.src-lazada {
  background: #f3e8ff;
  color: #6b21a8;
}

.badge.src-tiktok {
  background: #f1f5f9;
  color: #0f172a;
}

.badge.src-facebook {
  background: #eff6ff;
  color: #1d4ed8;
}

.badge.src-zalo {
  background: #ecfeff;
  color: #0e7490;
}

.order-facets .facet-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.order-facets .facet-label {
  flex: 0 0 78px;
  padding-top: 8px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.order-facets .filter-chips {
  flex: 1;
  min-width: 0;
}

.f-chip .chip-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  background: var(--surface-soft, var(--surface-muted));
  border-radius: var(--radius-pill);
  padding: 1px 7px;
  min-width: 1.5rem;
  text-align: center;
}

.f-chip.active .chip-count {
  background: color-mix(in srgb, var(--af-primary) 12%, var(--surface));
  color: var(--af-primary-dark);
}

.f-chip .badge {
  pointer-events: none;
}

.order-code-link {
  text-decoration: none;
}

.order-code-link code {
  color: var(--af-primary, #3d5afe);
  font-weight: 600;
}

.order-code-link:hover code {
  text-decoration: underline;
}

@media (max-width: 720px) {
  .order-facets .facet-row {
    flex-direction: column;
    gap: 6px;
  }

  .order-facets .facet-label {
    flex-basis: auto;
    padding-top: 0;
  }
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

.list-pager {
  margin-top: var(--space-3);
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  border-top: 0.5px solid var(--border);
}

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

.list-toolbar .panel-body {
  padding: 14px var(--space-5);
}

.list-toolbar .filter-bar {
  margin-bottom: 0;
}

.list-toolbar .filter-bar .form-select.sort-sel,
.list-toolbar .filter-bar select.form-select {
  min-width: 140px;
  max-width: 200px;
  height: 38px;
  flex: 0 1 auto;
}

.list-toolbar .filter-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-wrap: wrap;
}

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

.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: space-between;
}

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

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

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

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

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

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

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

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

.form-inline {
  display: inline;
}

.inp-prefix {
  position: relative;
}

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

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

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

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

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

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

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


/* --- 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 {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .page-header-actions {
    width: 100%;
    flex: none;
    margin-left: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: stretch;
  }

  .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,
  .page-header-actions > .badge {
    flex: 1 1 calc(50% - 4px);
    justify-content: center;
    min-width: 0;
  }

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

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

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

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

  .filter-bar .sort-sel,
  .filter-bar .form-select,
  .filter-bar select.form-select,
  .list-toolbar .filter-bar .form-select.sort-sel,
  .list-toolbar .filter-bar select.form-select,
  .sort-sel {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    flex: none;
  }

  .filter-bar .drp,
  .list-toolbar .drp {
    display: block;
    width: 100%;
    flex: none;
  }

  .filter-bar .drp-trigger,
  .list-toolbar .drp-trigger {
    width: 100%;
    justify-content: flex-start;
  }

  .filter-bar .drp-trigger [data-drp-label],
  .list-toolbar .drp-trigger [data-drp-label] {
    flex: 1;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .list-toolbar .filter-actions,
  .filter-bar .filter-actions {
    width: 100%;
    margin-left: 0;
    display: flex;
  }

  .list-toolbar .filter-actions .btn,
  .filter-bar .filter-actions .btn,
  .list-toolbar .filter-actions a.btn,
  .filter-bar .filter-actions a.btn {
    flex: 1 1 0;
    justify-content: center;
  }

  .list-toolbar .panel-body {
    padding: 12px 14px;
  }

  .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-lg {
  height: 280px;
}

.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: 1 1 100%;
  }

  .page-header-actions .btn .ti,
  .page-header-actions a.btn .ti {
    flex-shrink: 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;
  }
}


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

.aff-settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  background: var(--gray-50);
  border-radius: var(--radius-md);
}

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

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

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

/* ---------------------------------------------------------------------------
   Entity create/edit modal (OneG pattern)
   --------------------------------------------------------------------------- */
.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;
}

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

.entity-form-modal .modal-header {
  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 {
  padding: 16px 20px;
}

.entity-form-modal .modal-footer {
  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-section {
  margin-bottom: 18px;
}

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

.entity-form-sec-title {
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 0.5px solid var(--border);
}

/* Order create autocomplete + lines */
.ac-wrap {
  position: relative;
}

.ac-wrap .ac-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
  z-index: 1;
}

.ac-wrap .ac-input {
  padding-left: 36px;
}

.ac-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 30;
  max-height: 260px;
  overflow: auto;
  background: var(--surface, #fff);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}

.ac-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.ac-item:hover,
.ac-item:focus {
  background: var(--surface-muted, #f8fafc);
}

.ac-item-title {
  font-size: var(--fs-base);
  font-weight: 560;
  color: var(--text);
}

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

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

.oc-customer-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
  border: 0.5px solid color-mix(in srgb, var(--af-primary) 28%, var(--border));
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--af-primary) 6%, var(--surface));
}

.oc-customer-chip-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.oc-lines {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}

.oc-lines-empty {
  padding: 18px 12px;
  text-align: center;
  border: 0.5px dashed var(--border);
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
}

.oc-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px 110px 96px 36px;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-muted, #fafafa);
}

.oc-line-title {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.oc-line-sku {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.oc-line-meta {
  margin-top: 4px;
}

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

.oc-line-total {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  padding-bottom: 6px;
}

.oc-manual-add {
  margin-top: 4px;
}

.oc-footer {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.oc-total {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.oc-total strong {
  font-size: var(--fs-xl);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 768px) {
  .oc-line {
    grid-template-columns: 1fr 1fr;
  }

  .oc-line-main {
    grid-column: 1 / -1;
  }

  .oc-line-remove {
    justify-self: end;
  }
}

/* ---------------------------------------------------------------------------
   Integrations — compact provider cards
   --------------------------------------------------------------------------- */
.integ-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

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

.integ-card.is-connected {
  border-color: color-mix(in srgb, var(--af-success) 35%, var(--border));
}

.integ-card-hd {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.integ-brand {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--border);
  padding: 4px;
}

.integ-brand img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.integ-tone-orange { background: #fff4e8; color: #ee4d2d; }
.integ-tone-blue { background: var(--blue-50); color: #0f4c81; }
.integ-tone-dark { background: #f3f4f6; color: #111827; }
.integ-tone-green { background: var(--green-50); color: #96bf48; }
.integ-tone-teal { background: var(--teal-50); color: var(--af-teal); }

.integ-hd-main { min-width: 0; flex: 1; }

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

.integ-name {
  margin: 0;
  font-size: var(--fs-lg);
  font-weight: 650;
  line-height: 1.2;
}

.integ-status {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.01em;
}

.integ-status.is-on { background: var(--green-50); color: var(--af-success); }
.integ-status.is-off { background: #f3f4f6; color: var(--text-3); }
.integ-status.is-idle { background: var(--amber-50); color: #b45309; }

.integ-caps {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.integ-chip {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 6px;
  background: #f3f4f6;
  color: var(--text-2);
  border: 0.5px solid var(--border);
}

.integ-chip.is-ok {
  background: color-mix(in srgb, var(--af-success) 10%, #fff);
  border-color: color-mix(in srgb, var(--af-success) 25%, var(--border));
  color: var(--af-success);
}

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

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

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

.integ-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  font-size: 11px;
  font-weight: 550;
  color: var(--text-3);
}

.integ-field .form-control {
  font-weight: 400;
  color: var(--text-1);
}

.integ-field-toggle {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  background: #fafafa;
}

.integ-form-actions {
  display: flex;
  justify-content: flex-end;
}

.integ-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  font-size: 12px;
  color: var(--text-3);
}

.integ-meta .ti { margin-right: 3px; }

.integ-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 4px;
  border-top: 0.5px solid var(--border);
}

.integ-actions form { display: inline; margin: 0; }

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

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

/* ---------------------------------------------------------------------------
   Users & roles
   --------------------------------------------------------------------------- */
.stats-grid-users {
  margin-bottom: var(--space-4);
}

.role-badge {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: #f3f4f6;
  color: var(--text-2);
  white-space: nowrap;
}

.role-badge.is-platform,
.role-badge.role-platformadmin { background: #ede9fe; color: #6d28d9; }
.role-badge.is-owner,
.role-badge.role-owner { background: #fff7ed; color: #c2410c; }
.role-badge.is-admin,
.role-badge.role-admin { background: var(--blue-50); color: var(--af-primary); }
.role-badge.is-manager,
.role-badge.role-manager { background: var(--teal-50); color: var(--af-teal); }
.role-badge.is-staff,
.role-badge.role-staff { background: #ecfdf5; color: #047857; }
.role-badge.is-viewer,
.role-badge.role-viewer { background: #f8fafc; color: #64748b; border: 0.5px solid var(--border); }

.row-muted td { opacity: 0.62; }

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

.role-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}

.role-card-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.role-count {
  font-size: 12px;
  color: var(--text-3);
  font-weight: 500;
}

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

.role-flags { display: flex; flex-wrap: wrap; gap: 4px; }

.perm-matrix th,
.perm-matrix td {
  vertical-align: middle;
}

.perm-col-label { min-width: 220px; }
.perm-col-role { min-width: 88px; font-size: 12px; }

.perm-group-row td {
  background: #f8fafc;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-3);
  padding-top: 10px;
  padding-bottom: 8px;
}

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

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

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

.secret-field > .form-control {
  padding-right: 64px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  letter-spacing: 0.01em;
}

.secret-field.is-secret > .form-control {
  padding-right: 64px;
}

.secret-field:not(.is-secret) > .form-control {
  padding-right: 36px;
}

.secret-field-actions {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  gap: 1px;
  z-index: 2;
}

.secret-field-btn {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s ease, color 0.15s ease;
}

.secret-field-btn:hover {
  background: #f3f4f6;
  color: var(--text-1);
}

.secret-field-btn.is-copied {
  color: var(--af-success);
  background: color-mix(in srgb, var(--af-success) 12%, #fff);
}

.secret-field-btn .ti {
  font-size: 15px;
  line-height: 1;
}

.integ-webhook {
  display: grid;
  gap: 4px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  border: 0.5px dashed var(--border);
  background: #fafafa;
}

.integ-webhook-lbl {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.integ-chip .ti {
  font-size: 12px;
  margin-right: 2px;
}

/* ---------------------------------------------------------------------------
   Dashboard — recent orders list
   --------------------------------------------------------------------------- */
.recent-order-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.recent-order-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 0.5px solid var(--border);
}
.recent-order-item:last-child { border-bottom: 0; }
.recent-order-main { min-width: 0; flex: 1; }
.recent-order-code {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--af-primary, #3d5afe);
  text-decoration: none;
}
.recent-order-code:hover { text-decoration: underline; }
.recent-order-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-2);
}
.recent-order-amount {
  font-weight: 600;
  white-space: nowrap;
  color: var(--text);
}
.recent-order-empty {
  padding: 20px 16px;
  text-align: center;
}

/* ---------------------------------------------------------------------------
   Settings form (Loyalty / Affiliate / Channels)
   --------------------------------------------------------------------------- */
.settings-form {
  max-width: 920px;
}

.settings-summary .settings-metric-lbl {
  font-size: var(--fs-sm);
  color: var(--text-3);
  margin-bottom: 4px;
}

.settings-summary .settings-metric-val {
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--text);
}

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

.settings-toggle-row-compact {
  background: transparent;
  border-style: dashed;
}

.settings-toggle-title {
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--text);
}

.settings-toggle-hint {
  font-size: var(--fs-sm);
  color: var(--text-3);
  margin-top: 2px;
}

.settings-toggle-row .form-check-input {
  width: 2.5em;
  height: 1.35em;
  cursor: pointer;
}

.form-section .sec-hd .ti {
  font-size: 18px;
  color: var(--af-primary);
}

.settings-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 4px 0 24px;
  position: sticky;
  bottom: 12px;
  z-index: 2;
}

.settings-form-actions .btn {
  box-shadow: var(--shadow-md, 0 8px 24px rgba(15, 23, 42, 0.12));
}

@media (max-width: 640px) {
  .settings-toggle-row {
    align-items: flex-start;
  }

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

.channel-card.is-on {
  border-color: color-mix(in srgb, var(--af-primary) 28%, var(--border));
}

.channel-card-hd {
  justify-content: space-between !important;
}

.channel-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.channel-brand img {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 8px;
}

.channel-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}

.channel-icon-mini {
  background: color-mix(in srgb, #0068ff 12%, var(--surface));
  color: #0068ff;
}

.channel-icon-zns {
  background: color-mix(in srgb, #14b8a6 14%, var(--surface));
  color: #0f766e;
}

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

.channel-desc {
  font-size: var(--fs-sm);
  font-weight: 400;
  color: var(--text-3);
  margin-top: 2px;
}

.channel-card .form-check-input {
  width: 2.5em;
  height: 1.35em;
  cursor: pointer;
}

/* ---------------------------------------------------------------------------
   Date range picker
   --------------------------------------------------------------------------- */
.drp {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

.drp-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  border: 0.5px solid var(--border-md);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-md);
  font-family: var(--font);
  cursor: pointer;
  white-space: nowrap;
}

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

.drp-trigger .ti-calendar {
  color: var(--af-primary);
  font-size: 16px;
}

.drp-chevron {
  font-size: 14px;
  color: var(--text-3);
  transition: transform 0.15s;
}

.drp.is-open .drp-chevron {
  transform: rotate(180deg);
}

.drp-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 40;
  display: flex;
  min-width: 640px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.14);
  overflow: hidden;
}

.drp-presets-wrap {
  width: 148px;
  border-right: 0.5px solid var(--border);
  padding: 12px 8px;
  background: var(--surface-muted, var(--surface-soft));
  max-height: 360px;
  overflow-y: auto;
}

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

.drp-preset {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 7px 10px;
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
}

.drp-preset:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.drp-preset.is-active {
  background: color-mix(in srgb, var(--af-primary) 12%, var(--surface));
  color: var(--af-primary-dark);
  font-weight: 600;
}

.drp-main {
  flex: 1;
  padding: 14px 16px 12px;
  min-width: 0;
}

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

.drp-inputs .form-control {
  max-width: 120px;
}

.drp-input-end {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.drp-input-end .ti-calendar {
  position: absolute;
  right: 8px;
  color: var(--text-3);
  font-size: 14px;
  pointer-events: none;
}

.drp-input-end .form-control {
  padding-right: 28px;
}

.drp-nav {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.drp-nav-btn {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
}

.drp-nav-btn:hover {
  background: var(--surface-hover);
}

.drp-months {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.drp-month-title {
  text-align: center;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 8px;
  text-transform: capitalize;
}

.drp-weekdays,
.drp-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.drp-weekdays span {
  text-align: center;
  font-size: 11px;
  color: var(--text-3);
  padding: 4px 0;
  font-weight: 500;
}

.drp-day {
  aspect-ratio: 1;
  border: 0;
  background: transparent;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  position: relative;
}

.drp-day.is-outside {
  color: var(--text-3);
  opacity: 0.45;
}

.drp-day:hover:not(.is-start):not(.is-end) {
  background: var(--surface-hover);
}

.drp-day.is-in-range {
  background: color-mix(in srgb, var(--af-primary) 12%, transparent);
  border-radius: 0;
}

.drp-day.is-start,
.drp-day.is-end {
  background: var(--af-primary);
  color: #fff;
  font-weight: 600;
  z-index: 1;
}

.drp-day.is-today:not(.is-start):not(.is-end) {
  box-shadow: inset 0 0 0 1px var(--af-primary);
}

.drp-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 0.5px solid var(--border);
}

@media (max-width: 720px) {
  .drp-panel {
    position: fixed;
    left: 12px;
    right: 12px;
    top: 12vh;
    min-width: 0;
    flex-direction: column;
    max-height: 80vh;
    z-index: 1080;
  }

  .drp-presets-wrap {
    width: 100%;
    max-height: 120px;
    border-right: 0;
    border-bottom: 0.5px solid var(--border);
  }

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

  .drp {
    width: 100%;
  }

  .drp-trigger {
    width: 100%;
  }
}

.settings-form-loyalty {
  max-width: 860px;
}

.settings-form-affiliate {
  max-width: 860px;
}

.settings-hero.is-on {
  border-color: color-mix(in srgb, var(--af-success, #16a34a) 35%, var(--border));
}

.settings-hero-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.settings-hero-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--af-primary) 12%, var(--surface));
  color: var(--af-primary);
  font-size: 22px;
  flex-shrink: 0;
}

.settings-hero-title {
  font-size: var(--fs-xl);
  font-weight: 600;
  line-height: 1.25;
}

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

.settings-hero-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.settings-hero-switch .form-check-input {
  width: 2.6em;
  height: 1.4em;
  cursor: pointer;
}

.settings-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding-top: 16px;
  border-top: 0.5px solid var(--border);
}

.settings-metric {
  min-width: 0;
}

.settings-metric-lbl {
  font-size: var(--fs-sm);
  color: var(--text-3);
  margin-bottom: 4px;
}

.settings-metric-val {
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.settings-metric .settings-metric-val span {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-3);
}

.form-section .sec-hd-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.form-section .sec-hd {
  align-items: flex-start;
}

.form-section .sec-hd > div > div:first-child {
  font-weight: 600;
}

.sec-hd-sub {
  font-size: var(--fs-sm);
  font-weight: 400;
  color: var(--text-3);
  margin-top: 2px;
}

.settings-form .input-group-text {
  font-size: var(--fs-sm);
  color: var(--text-2);
  background: var(--surface-muted, var(--surface-soft));
}

@media (max-width: 768px) {
  .settings-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .settings-hero-top {
    flex-wrap: wrap;
  }
}
