:root {
  /* FAMA brand identity */
  --brand-primary: #2CB65D;
  --brand-dark: #0B4D2C;
  --brand-black: #000000;
  --navy-900: #000000;
  --navy-800: #0B4D2C;
  --navy-700: #0B4D2C;
  --navy-600: #157A3E;
  --accent-500: #2CB65D;
  --accent-600: #22994A;
  --bg-app: #F4FBF6;
  --surface: #FFFFFF;
  --border: #D4EDDA;
  --text-900: #0a1a10;
  --text-600: #4a6354;
  --text-400: #7a9484;
  --success: #2CB65D;
  --success-bg: #D4F5DE;
  --danger: #E5604A;
  --danger-bg: #FDECEA;
  --warn-bg: #FFF3E0;
  --sidebar-w: 264px;
  --font-display: 'Google Sans Flex', sans-serif;
  --font-primary: 'Google Sans Flex', sans-serif;
  --control-h: 38px;
  --control-font: .86rem;
  --control-radius: 10px;
  /* legacy aliases used in some views */
  --orange-500: var(--accent-500);
  --orange-600: var(--accent-600);
}

* {
  box-sizing: border-box;
}

.btn {
  border-radius: 10px;
}

body {
  font-family: var(--font-primary);
  background: var(--bg-app);
  color: var(--text-900);
  font-size: 14px;
}

h1,
h2,
h3,
h4,
h5,
h6,
.font-display {
  font-family: var(--font-display);
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--navy-900);
  color: #CFE4D3;
  z-index: 1040;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255, 255, 255, .06);
  transition: transform .25s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: 1rem 1.15rem;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}

.sidebar-brand .brand-logo {
  height: 40px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  display: block;
  /* Nâng chữ xanh đậm (CHUYỂN ĐỔI XANH) trên nền sidebar đen */
  filter:
    brightness(1.85)
    contrast(1.25)
    saturate(1.35)
    drop-shadow(0 0 0.5px rgba(143, 209, 79, 0.55));
}

.sidebar-brand .mark {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.sidebar-brand .title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.1;
}

.sidebar-brand .sub {
  font-size: .7rem;
  color: #7FA08E;
  letter-spacing: .04em;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: .75rem .65rem;
}

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

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

.nav-item-link {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .5rem .75rem .5rem 1.9rem;
  border-radius: 4px;
  color: #B7C9BD;
  text-decoration: none;
  font-size: .84rem;
  font-weight: 500;
  margin-bottom: .1rem;
  white-space: nowrap;
}

.nav-item-link i {
  font-size: .95rem;
  width: 16px;
  text-align: center;
  color: #7C9184;
}

.nav-item-link:hover {
  background: var(--navy-800);
  color: #fff;
}

.nav-item-link:hover i {
  color: var(--accent-500);
}

.nav-item-link.active {
  background: linear-gradient(90deg, rgba(139, 197, 63, .2), rgba(139, 197, 63, .04));
  color: #fff;
  box-shadow: inset 3px 0 0 var(--accent-500);
}

.nav-item-link.active i {
  color: var(--accent-500);
}

.nav-divider {
  height: 1px;
  background: rgba(255, 255, 255, .07);
  margin: .6rem .25rem;
}

.nav-group {
  margin-bottom: .15rem;
}

.nav-group-toggle {
  width: 100%;
  background: transparent;
  border: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .55rem .75rem;
  border-radius: 10px;
  margin-bottom: .1rem;
  color: #7FA08E;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
}

.nav-group-toggle:hover {
  color: #E7F3E9;
  background: rgba(255, 255, 255, .04);
}

.nav-group-toggle i {
  font-size: .72rem;
  transition: transform .2s ease;
}

.nav-group-toggle[aria-expanded="true"] {
  color: #CFE4D3;
}

.nav-group-toggle[aria-expanded="true"] i {
  transform: rotate(180deg);
  color: var(--accent-500);
}

.nav-group-toggle:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(139, 197, 63, .35);
}

.sidebar-footer {
  padding: .75rem .9rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, .06);
}

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: .75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.search-box {
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .5rem .9rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  flex: 1;
  max-width: 380px;
}

.search-box input {
  border: 0;
  background: transparent;
  outline: none;
  font-size: .85rem;
  width: 100%;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 13px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  color: var(--text-600);
}

.icon-btn .dot {
  position: absolute;
  top: 6px;
  right: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-600);
  border: 1.5px solid var(--surface);
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent-500);
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent-500), var(--accent-600));
  color: #fff;
  font-weight: 700;
  font-size: .9rem;
  flex-shrink: 0;
}

.avatar.lg { width: 42px; height: 42px; font-size: 1rem; }

/* ---------- User menu dropdown ---------- */
.user-menu { position: relative; }

.user-menu-toggle {
  display: flex;
  align-items: center;
  gap: .55rem;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: .25rem .65rem .25rem .25rem;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}

.user-menu-toggle:hover,
.user-menu-toggle.show {
  border-color: var(--accent-500);
  box-shadow: 0 0 0 3px rgba(139, 197, 63, .15);
}

.user-menu-toggle .chev {
  font-size: .7rem;
  color: var(--text-400);
  margin-left: .15rem;
}

.user-menu-label .name {
  font-size: .82rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: left;
}

.user-menu-label .role {
  font-size: .72rem;
  color: var(--text-400);
  text-align: left;
}

.user-menu-panel {
  width: min(320px, calc(100vw - 2rem));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(15, 42, 59, .12);
  overflow: hidden;
}

.user-menu-head {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .9rem 1rem;
  background: var(--bg-app);
}

.user-menu-head .name { font-weight: 700; font-size: .9rem; }
.user-menu-head .email { font-size: .75rem; color: var(--text-400); }

.user-menu-section { padding: .5rem .75rem .65rem; }

.user-menu-section .section-title {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-400);
  padding: .25rem .35rem .45rem;
}

.profile-row {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .45rem .4rem;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: background .12s;
}

.profile-row:hover { background: var(--bg-app); }
.profile-row.current { background: rgba(139, 197, 63, .12); }

.profile-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-400), var(--accent-600));
  color: #fff;
  font-weight: 700;
  font-size: .75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.profile-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.profile-name { font-size: .82rem; font-weight: 600; line-height: 1.2; }
.profile-sub { font-size: .7rem; color: var(--text-400); }

.profile-more {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .78rem;
  font-weight: 600;
  color: var(--accent-700);
  padding: .35rem .4rem .15rem;
  text-decoration: none;
}

.profile-more:hover { color: var(--accent-800); }

.user-menu-panel .dropdown-item {
  font-size: .85rem;
  padding: .55rem 1rem;
  display: flex;
  align-items: center;
  gap: .55rem;
}

.user-menu-panel .dropdown-item i { opacity: .75; width: 1.1rem; }

/* ---------- Main ---------- */
.main-wrap {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-body {
  padding: 1.5rem;
}

.page-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--text-900);
}

.breadcrumb-muted {
  font-size: .8rem;
  color: var(--text-400);
}

.btn-brand {
  background: var(--accent-600);
  border-color: var(--accent-600);
  color: #fff;
  font-weight: 600;
}

.btn-brand:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  color: #fff;
}

.btn-accent {
  background: var(--accent-600);
  border-color: var(--accent-600);
  color: #fff;
  font-weight: 600;
}

.btn-accent:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  color: #fff;
}

.btn-outline-brand {
  border-color: var(--navy-700);
  color: var(--navy-700);
  font-weight: 600;
}

.btn-outline-brand:hover {
  background: var(--navy-700);
  color: #fff;
}

.stat-cards {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-bottom: 1.15rem;
}

.stat-cards > .stat-card-wrap {
  flex: 1 1 160px;
  min-width: 0;
}

@media (min-width: 992px) {
  .stat-cards {
    flex-wrap: nowrap;
  }

  .stat-cards > .stat-card-wrap {
    flex: 1 1 0;
  }
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: .9rem 1rem;
  height: 100%;
}

.stat-card-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .75rem;
}

.stat-card .label {
  font-size: .78rem;
  color: var(--text-600);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-card .value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  margin-top: .1rem;
  line-height: 1.15;
}

.stat-card .icon-chip {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.stat-icon-navy { background: rgba(23, 59, 79, .08); color: var(--navy-700); }
.stat-icon-success { background: var(--success-bg); color: var(--success); }
.stat-icon-danger { background: var(--danger-bg); color: var(--danger); }
.stat-icon-warn { background: var(--warn-bg); color: var(--accent-600); }
.stat-icon-accent { background: rgba(111, 168, 46, .12); color: var(--accent-600); }

.stat-card-sm { padding: .85rem 1rem; }
.stat-card-sm .value { font-size: 1.15rem; }

.chart-card {
  padding: 1rem 1.1rem 1.1rem;
  height: 100%;
}

.chart-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .75rem;
  margin-bottom: .85rem;
}

.chart-sub {
  font-size: .75rem;
  color: var(--text-400);
  margin: .15rem 0 0;
}

.chart-wrap {
  position: relative;
  height: 240px;
}

.chart-wrap-md { height: 280px; }
.chart-wrap-lg { height: 320px; }

.chart-empty {
  height: 100%;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-400);
  font-size: .85rem;
  background: var(--bg-app);
  border-radius: 10px;
  border: 1px dashed var(--border);
}

.card-surface {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
}

.table-clean thead th {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-400);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  padding: .85rem 1rem;
  background: #F8FBF4;
}

.table-clean tbody td {
  padding: .85rem 1rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
  font-size: .86rem;
}

.table-clean tbody tr:last-child td {
  border-bottom: 0;
}

.table-clean tbody tr:hover {
  background: #FCFCFE;
}

.prod-thumb {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  background: #E8F3E0;
}

.badge-status {
  font-weight: 600;
  font-size: .72rem;
  padding: .32rem .6rem;
  border-radius: 20px;
}

.badge-active {
  background: var(--success-bg);
  color: var(--success);
}

.badge-draft {
  background: #E8F3E0;
  color: var(--text-600);
}

.badge-out {
  background: var(--danger-bg);
  color: var(--danger);
}

.badge-variant-count {
  background: var(--warn-bg);
  color: #B26A00;
  font-weight: 600;
  font-size: .7rem;
  padding: .25rem .55rem;
  border-radius: 10px;
}

.nav-tabs-brand .nav-link {
  border: 0;
  color: var(--text-600);
  font-weight: 600;
  font-size: .85rem;
  padding: .75rem 1.1rem;
  border-bottom: 2px solid transparent;
}

.nav-tabs-brand .nav-link.active {
  color: var(--navy-700);
  border-bottom-color: var(--accent-600);
  background: transparent;
}

.section-label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: .95rem;
  margin-bottom: .15rem;
}

.section-hint {
  font-size: .78rem;
  color: var(--text-600);
}

.form-label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-900);
}

.form-control,
.form-select {
  font-size: var(--control-font);
  border-radius: var(--control-radius);
  border-color: var(--border);
  min-height: var(--control-h);
}

.form-control:not(textarea) {
  height: var(--control-h);
  padding: .45rem .75rem;
  line-height: 1.25;
}

.form-select {
  height: var(--control-h);
  padding: .45rem 2rem .45rem .75rem;
  line-height: 1.25;
}

textarea.form-control {
  height: auto;
  min-height: calc(var(--control-h) * 2.5);
  padding: .55rem .75rem;
  line-height: 1.45;
}

/* Unified control height in filter bars, inline forms, create/edit */
.filter-bar .form-control,
.filter-bar .form-select,
.card-form-panel .form-control,
.card-form-panel .form-select,
.card-surface form .form-control:not(textarea),
.card-surface form .form-select,
.table .form-control:not(textarea),
.table .form-select {
  height: var(--control-h);
  min-height: var(--control-h);
  font-size: var(--control-font);
  border-radius: var(--control-radius);
}

.filter-bar .form-control-sm,
.filter-bar .form-select-sm,
.card-form-panel form .form-control-sm,
.card-form-panel form .form-select-sm,
.card-surface form .form-control-sm,
.card-surface form .form-select-sm,
.table .form-control-sm,
.table .form-select-sm {
  height: var(--control-h);
  min-height: var(--control-h);
  padding: .45rem .75rem;
  font-size: var(--control-font);
  border-radius: var(--control-radius);
}

.filter-bar .form-select-sm,
.card-form-panel form .form-select-sm,
.card-surface form .form-select-sm,
.table .form-select-sm,
.form-select.form-select-sm {
  padding-right: 2rem;
}

.filter-bar .btn,
.card-form-panel .btn,
.card-form-panel form .btn,
.card-surface form .btn:not(.btn-action):not(.btn-link),
.table .btn:not(.btn-action) {
  height: var(--control-h);
  min-height: var(--control-h);
  padding: 0 .95rem;
  font-size: var(--control-font);
  font-weight: 600;
  border-radius: var(--control-radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
}

.filter-bar .btn-sm,
.card-form-panel .btn-sm,
.card-form-panel form .btn-sm,
.card-surface form .btn-sm,
.table .btn-sm {
  height: var(--control-h);
  min-height: var(--control-h);
  padding: 0 .95rem;
  font-size: var(--control-font);
  border-radius: var(--control-radius);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--brand-dark);
  box-shadow: 0 0 0 .2rem rgba(11, 77, 44, .18);
}

.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: .9rem 1.15rem;
  border-top: 1px solid var(--border);
}

.pager-meta {
  font-size: .8rem;
  color: var(--text-600);
  font-weight: 500;
}

.pagination {
  --bs-pagination-padding-x: .85rem;
  --bs-pagination-padding-y: 0;
  --bs-pagination-font-size: var(--control-font);
  --bs-pagination-color: var(--text-600);
  --bs-pagination-bg: var(--surface);
  --bs-pagination-border-width: 1px;
  --bs-pagination-border-color: var(--border);
  --bs-pagination-border-radius: var(--control-radius);
  --bs-pagination-hover-color: var(--brand-dark);
  --bs-pagination-hover-bg: var(--bg-app);
  --bs-pagination-hover-border-color: var(--border);
  --bs-pagination-focus-color: var(--brand-dark);
  --bs-pagination-focus-bg: var(--bg-app);
  --bs-pagination-focus-box-shadow: none;
  --bs-pagination-active-color: #fff;
  --bs-pagination-active-bg: var(--brand-dark);
  --bs-pagination-active-border-color: var(--brand-dark);
  --bs-pagination-disabled-color: var(--text-400);
  --bs-pagination-disabled-bg: #f3f5f3;
  --bs-pagination-disabled-border-color: var(--border);
}

.pagination .page-item .page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--control-h);
  min-height: var(--control-h);
  min-width: var(--control-h);
  padding: 0 .9rem;
  margin: 0;
  line-height: 1;
  font-family: var(--font-primary);
  font-size: var(--control-font);
  font-weight: 600;
  border-radius: 0;
}

.pagination .page-item + .page-item .page-link {
  margin-left: -1px;
}

.pagination .page-item:first-child .page-link {
  border-top-left-radius: var(--control-radius);
  border-bottom-left-radius: var(--control-radius);
}

.pagination .page-item:last-child .page-link {
  border-top-right-radius: var(--control-radius);
  border-bottom-right-radius: var(--control-radius);
}

.pagination .page-item.active .page-link,
.pagination .page-item.active .page-link:hover,
.pagination .page-item.active .page-link:focus {
  z-index: 2;
  color: #fff;
  background: var(--brand-dark);
  border-color: var(--brand-dark);
}

.pagination .page-item.disabled .page-link {
  pointer-events: none;
}

/* Checkbox / radio / switch — same active color as pagination */
.form-check-input {
  width: 1.15rem;
  height: 1.15rem;
  margin-top: .18em;
  border-color: #ced4da;
  border-radius: 4px;
}

.form-check-input[type="radio"] {
  border-radius: 50%;
}

.form-check-input:checked {
  background-color: var(--brand-dark);
  border-color: var(--brand-dark);
}

.form-check-input:indeterminate {
  background-color: var(--brand-dark);
  border-color: var(--brand-dark);
}

.form-check-input:focus {
  border-color: var(--brand-dark);
  box-shadow: 0 0 0 .2rem rgba(11, 77, 44, .18);
}

.form-check-input:checked:focus,
.form-check-input:indeterminate:focus {
  box-shadow: 0 0 0 .2rem rgba(11, 77, 44, .22);
}

.form-switch .form-check-input {
  width: 2.4em;
  height: 1.2em;
  margin-top: .15em;
  border-radius: 2em;
}

.form-switch .form-check-input:focus {
  --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%230B4D2C'/%3e%3c/svg%3e");
}

.form-switch .form-check-input:checked {
  background-color: var(--brand-dark);
  border-color: var(--brand-dark);
  --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
}

input[type="checkbox"]:not(.form-check-input) {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--brand-dark);
  vertical-align: middle;
}

.media-drop {
  border: 1.5px dashed var(--border);
  border-radius: 12px;
  background: #F8FBF4;
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-600);
}

.media-drop-compact {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .65rem;
  margin: .65rem .9rem 0;
  padding: .55rem .9rem;
  text-align: left;
}

.media-drop-compact > i {
  font-size: 1.25rem;
  color: var(--text-400);
  flex-shrink: 0;
}

.option-row {
  background: #F8FBF4;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .9rem 1rem;
}

.option-value-pill {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: .3rem .7rem .3rem .9rem;
  font-size: .8rem;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  margin: .15rem;
}

.option-value-pill button {
  border: 0;
  background: transparent;
  color: var(--text-400);
  line-height: 1;
}

.variant-table th {
  font-size: .72rem;
  text-transform: uppercase;
  color: var(--text-400);
  font-weight: 600;
}

/* Shopify / Haravan-style variants */
.variants-panel-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: .75rem;
  margin-bottom: .85rem;
}

.variants-options {
  border-bottom: 1px solid var(--border);
}

.variants-options-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .65rem;
  font-size: .78rem;
  font-weight: 700;
  color: var(--text-900);
}

.variants-options-title .btn-link {
  font-size: .78rem;
  font-weight: 600;
  color: var(--navy-700);
  text-decoration: none;
}

.variants-options-title .btn-link:disabled {
  opacity: .45;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: .65rem;
}

.option-row {
  background: #F8FBF4;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .75rem;
}

.option-row-head {
  display: flex;
  gap: .5rem;
  margin-bottom: .55rem;
}

.option-row-head .option-name {
  flex: 1;
  max-width: 280px;
  font-weight: 600;
  background: #fff;
}

.option-values-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem;
  min-height: 42px;
  padding: .4rem .55rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.option-pills {
  display: contents;
}

.option-value-pill {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .2rem .55rem .2rem .7rem;
  border-radius: 999px;
  background: #E8F3E0;
  border: 1px solid #C5DDB8;
  color: var(--navy-700);
  font-size: .75rem;
  font-weight: 600;
}

.option-value-pill button {
  border: 0;
  background: transparent;
  color: var(--text-400);
  line-height: 1;
  padding: 0;
  font-size: .85rem;
}

.option-value-input {
  flex: 1;
  min-width: 140px;
  border: 0;
  outline: none;
  background: transparent;
  font-size: .82rem;
  padding: .25rem .15rem;
}

.variants-table-wrap {
  background: #fff;
}

.variants-table-meta {
  padding-top: .75rem;
  padding-bottom: .35rem;
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-400);
}

.shopify-variant-table {
  margin: 0;
  min-width: 860px;
}

.shopify-variant-table thead th {
  background: #F8FBF4;
  border-bottom: 1px solid var(--border);
  padding: .65rem .75rem;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}

.shopify-variant-table tbody td {
  padding: .7rem .75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.shopify-variant-table tbody tr:hover {
  background: #FBFDF8;
}

.shopify-variant-table .col-img { width: 64px; }
.shopify-variant-table .col-price,
.shopify-variant-table .col-compare { width: 120px; }
.shopify-variant-table .col-sku { width: 130px; }
.shopify-variant-table .col-stock { width: 88px; }
.shopify-variant-table .col-default { width: 72px; }
.shopify-variant-table .col-actions { width: 48px; }

.shopify-variant-table .variant-thumb {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #F8FBF4;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-400);
  overflow: hidden;
  margin: 0 auto;
  padding: 0;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.shopify-variant-table .variant-thumb:hover {
  border-color: var(--navy-500, #2E7D32);
  box-shadow: 0 0 0 2px rgba(46, 125, 50, 0.12);
}

.shopify-variant-table .variant-thumb.is-uploading {
  opacity: .55;
  pointer-events: none;
}

.shopify-variant-table .variant-thumb img.image-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
  pointer-events: none;
}

.variant-title-input {
  border-color: transparent;
  background: transparent;
  padding-left: 0;
  font-size: .86rem;
}

.variant-title-input:focus {
  border-color: var(--border);
  background: #fff;
  padding-left: .5rem;
}

.input-affix {
  display: flex;
  align-items: center;
  gap: .25rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: .5rem;
  padding-right: .45rem;
}

.input-affix .form-control {
  border: 0;
  box-shadow: none;
  background: transparent;
}

.input-affix span {
  font-size: .72rem;
  color: var(--text-400);
  font-weight: 600;
}

.variants-empty {
  text-align: center;
  color: var(--text-400);
  font-size: .85rem;
  padding: 1.5rem 1rem 1.75rem;
}

.admin-dialog {
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: 0 18px 50px rgba(11, 77, 44, 0.14);
}

.admin-dialog .modal-title {
  font-size: 1.05rem;
  color: var(--text-900);
}

.admin-dialog .modal-body {
  font-size: .9rem;
  color: var(--text-600);
  line-height: 1.5;
}

.admin-dialog .modal-footer {
  gap: .5rem;
}

.media-drop.drag-over {
  border-color: var(--navy-700);
  background: #EEF6E8;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: .75rem;
}

.gallery-item {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .5rem;
  min-width: 0;
}

.gallery-item-thumb {
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: #F8FBF4;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-400);
}

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

.gallery-item-thumb img[src=""],
.gallery-item-thumb img:not([src]) {
  display: none;
}

.gallery-item .form-select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.gallery-item-actions {
  display: flex;
  gap: .25rem;
}

.image-preview-wrap img.image-preview,
.variant-thumb img.image-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
}

.product-thumb-preview img,
.product-thumb-preview .variant-thumb {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: 10px;
}

.variant-row-deleted,
.gallery-item-deleted {
  display: none !important;
}

.order-info-card {
  background: #F8FBF4;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  height: 100%;
}

.font-monospace {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

#orderDetailModal .modal-xl {
  max-width: 1100px;
}

#order-detail-body .table-clean th {
  font-size: .72rem;
  text-transform: uppercase;
  color: var(--text-400);
}

.collection-picker-layout {
  min-height: 420px;
}

.collection-picker-pane {
  background: #F8FBF4;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .85rem;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.collection-picker-pane-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
  margin-bottom: .65rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}

.collection-picker-list {
  flex: 1;
  overflow-y: auto;
  max-height: 380px;
  display: flex;
  flex-direction: column;
  gap: .45rem;
}

.collection-picker-empty {
  text-align: center;
  padding: 2rem .5rem;
}

.collection-product-row {
  display: flex;
  align-items: center;
  gap: .55rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .45rem .55rem;
}

.collection-product-row-pick {
  cursor: pointer;
}

.collection-product-row-pick:hover {
  border-color: var(--navy-700);
  background: #fff;
}

.collection-product-thumb {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  background: #E8F3E0;
  flex-shrink: 0;
}

.collection-product-pos {
  width: 1.4rem;
  text-align: center;
  font-size: .72rem;
  font-weight: 700;
  color: var(--text-400);
  flex-shrink: 0;
}

.collection-product-info {
  min-width: 0;
  line-height: 1.35;
}

.collection-product-actions {
  display: flex;
  gap: .2rem;
  flex-shrink: 0;
}

.collection-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.text-navy {
  color: var(--navy-700);
}

#collectionProductsModal .modal-xl {
  max-width: 1050px;
}

.file-manager-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: .65rem .9rem;
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.file-manager-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem;
}

.fm-stat {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 .65rem;
  border-radius: 99px;
  background: var(--success-bg);
  color: var(--brand-dark);
  font-size: .75rem;
  font-weight: 700;
  white-space: nowrap;
}

.file-breadcrumb {
  font-size: .85rem;
  font-weight: 600;
}

.file-breadcrumb a {
  color: var(--navy-700);
  text-decoration: none;
}

.file-breadcrumb a:hover {
  text-decoration: underline;
}

.file-manager-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: .5rem;
  margin-left: auto;
  min-width: 0;
}

.fm-search-wrap {
  width: 180px;
  min-width: 140px;
  flex: 0 1 180px;
}

.file-manager-actions .btn {
  flex-shrink: 0;
  white-space: nowrap;
}

.file-manager-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: .65rem;
  padding: .75rem .9rem 1rem;
}

.file-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .55rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: border-color .15s, box-shadow .15s;
  cursor: default;
  min-height: 0;
}

.file-card:hover {
  border-color: var(--navy-700);
  box-shadow: 0 4px 14px rgba(18, 48, 68, .08);
}

.file-card-folder {
  background: #F8FBF4;
}

.file-card-img {
  width: 100%;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
  background: #E8F3E0;
  margin-bottom: .3rem;
}

.file-card-icon {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.7rem;
  margin-bottom: .2rem;
}

.file-card-name {
  font-size: .78rem;
  font-weight: 600;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-card-meta {
  font-size: .68rem;
  color: var(--text-400);
  margin-top: .15rem;
}

.file-card-actions {
  display: flex;
  gap: .25rem;
  margin-top: .45rem;
  flex-wrap: wrap;
  justify-content: center;
}

.text-warn {
  color: #B26A00;
}

.text-accent {
  color: var(--accent-600);
}

.variant-thumb {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: #E8F3E0;
  border: 1px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-400);
  font-size: .85rem;
  overflow: hidden;
}

@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
  }

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

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


/* Admin extras */
.filter-bar {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  align-items: center;
}

.filter-bar .form-control,
.filter-bar .form-select {
  min-width: 160px;
  max-width: 240px;
  flex: 0 1 auto;
}

.filter-bar .form-control[name="q"],
.filter-bar input[name="q"],
.filter-bar .filter-field-search {
  flex: 1 1 200px;
  max-width: 320px;
}

.filter-bar .filter-field-select {
  min-width: 150px;
  max-width: 200px;
}

.filter-bar .filter-field-extra {
  min-width: 140px;
  max-width: 200px;
}

.page-actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #000000 0%, #0B4D2C 55%, #2CB65D 160%);
}

.login-card {
  width: 100%;
  max-width: 400px;
  border-radius: 16px;
  border: 1px solid var(--border);
}

.login-brand-logo {
  height: 48px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
  display: inline-block;
}

.dropdown-menu {
  font-size: .86rem;
  border-radius: 10px;
  border-color: var(--border);
  box-shadow: 0 8px 24px rgba(15, 42, 59, .1);
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.page-header {
  gap: .75rem;
}

.table-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: .35rem;
  justify-content: flex-end;
  align-items: center;
}

.btn-create {
  height: var(--control-h);
  min-height: var(--control-h);
  padding: 0 1rem;
  font-size: var(--control-font);
  font-weight: 600;
  border-radius: var(--control-radius);
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}

.page-actions .btn-create span,
.btn-create span {
  line-height: 1;
}

.btn-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  height: var(--control-h);
  min-height: var(--control-h);
  padding: 0 .75rem;
  font-size: var(--control-font);
  font-weight: 600;
  white-space: nowrap;
  border-radius: var(--control-radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-900);
  line-height: 1;
}

.btn-action i {
  font-size: .9rem;
  line-height: 1;
}

.btn-action:hover {
  background: #F8FBF4;
  border-color: #cddfc4;
  color: var(--text-900);
}

.btn-action-edit {
  color: var(--navy-700);
  border-color: #d4e3dc;
  background: #F8FBF4;
}

.btn-action-edit:hover {
  background: rgba(23, 59, 79, .08);
  border-color: #b8cfc0;
  color: var(--navy-700);
}

.btn-action-success {
  color: var(--success);
  border-color: #b8e6d4;
  background: var(--success-bg);
}

.btn-action-success:hover {
  background: #d4f3e8;
  border-color: #9fdcc4;
  color: #168a5a;
}

.btn-action-danger {
  color: var(--danger);
  border-color: #f0ccc6;
  background: var(--danger-bg);
}

.btn-action-danger:hover {
  background: #fad8d3;
  border-color: #f5b8ae;
  color: var(--danger);
}

.btn-action-warning {
  color: #9a6b12;
  border-color: #ecd9a8;
  background: var(--warn-bg);
}

.btn-action-warning:hover {
  background: #ffecc2;
  border-color: #dfc678;
  color: #7d5610;
}

.btn-action-brand {
  color: #fff;
  border-color: var(--navy-700);
  background: var(--navy-700);
}

.btn-action-brand:hover {
  background: var(--navy-600);
  border-color: var(--navy-600);
  color: #fff;
}

.btn-action-muted {
  color: var(--text-400);
  border-color: transparent;
  background: transparent;
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
}

.btn-action-muted:hover {
  background: #F8FBF4;
  color: var(--text-900);
}

.modal-content {
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  border-bottom: 1px solid var(--border);
  padding: .85rem 1.1rem;
}

.modal-header .btn-action-muted {
  margin-left: auto;
  flex-shrink: 0;
}

.modal-footer {
  border-top: 1px solid var(--border);
  padding: .75rem 1.1rem;
  gap: .5rem;
}

.modal-footer .btn {
  height: var(--control-h);
  min-height: var(--control-h);
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-weight: 600;
  border-radius: var(--control-radius);
}

.table-empty {
  text-align: center;
  color: var(--text-400);
  padding: 2.5rem 1rem !important;
  font-size: .86rem;
}

.card-form-panel .tox-tinymce,
.card-surface .tox-tinymce {
  border-radius: var(--control-radius);
  border-color: var(--border) !important;
}

.card-form-panel .tox .tox-edit-area__iframe,
.card-surface .tox .tox-edit-area__iframe {
  background: #fff;
}

.card-form-panel textarea.tinymce-editor,
.card-surface textarea.tinymce-editor {
  visibility: hidden;
  min-height: 0;
  height: 0;
  padding: 0;
  border: 0;
}

.card-form-panel .form-label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-600);
  margin-bottom: .35rem;
}

.card-form-panel {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.card-form-panel .panel-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: .92rem;
  margin-bottom: .75rem;
}

.alert-soft {
  border-radius: 10px;
  border: 1px solid var(--border);
}

.role-picker .list-group-item {
  border: none;
  border-radius: 10px;
  margin-bottom: .35rem;
  padding: .75rem 1rem;
}

.role-picker .list-group-item.active {
  background: var(--brand-soft, #f0f4ff);
  color: inherit;
  border: 1px solid var(--brand, #4f46e5);
}

.rbac-matrix .table-group-row td {
  background: var(--surface-50, #f8f9fa);
  border-bottom: none;
}