/* =============================================================
   TR Frontend Manager — Dashboard CSS
   Appledill Framework v1.0 | Mobile-first, no Bootstrap
   ============================================================= */

/* ── Custom Properties ─────────────────────────────────────── */
:root {
  --tr-fm-sidebar-width:    260px;
  --tr-fm-sidebar-bg:       #1a202c;
  --tr-fm-sidebar-text:     #e2e8f0;
  --tr-fm-sidebar-muted:    #a0aec0;
  --tr-fm-sidebar-active:   #e76f51;
  --tr-fm-sidebar-hover-bg: rgba(255,255,255,.06);
  --tr-fm-surface:          #ffffff;
  --tr-fm-surface-alt:      #f7f8fc;
  --tr-fm-border:           #e2e8f0;
  --tr-fm-text:             #2d3748;
  --tr-fm-text-muted:       #718096;
  --tr-fm-primary:          #e76f51;
  --tr-fm-primary-dark:     #c9562f;
  --tr-fm-success:          #27ae60;
  --tr-fm-warning:          #f39c12;
  --tr-fm-error:            #e74c3c;
  --tr-fm-info:             #3498db;
  --tr-fm-accent:           #2a9d8f;
  --tr-fm-radius:           8px;
  --tr-fm-radius-sm:        4px;
  --tr-fm-radius-lg:        14px;
  --tr-fm-shadow:           0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --tr-fm-shadow-md:        0 4px 16px rgba(0,0,0,.10);
  --tr-fm-transition:       0.2s ease;
  --tr-fm-mobile-bar-height: 56px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --tr-fm-surface:     #1e2433;
    --tr-fm-surface-alt: #252c3b;
    --tr-fm-border:      #2d3748;
    --tr-fm-text:        #e2e8f0;
    --tr-fm-text-muted:  #a0aec0;
  }
}

/* ── Wrapper (sidebar + main) ──────────────────────────────── */
.tr-fm-wrap {
  display: flex;
  min-height: 100vh;
  background: var(--tr-fm-surface-alt);
  position: relative;
}

/* ── Sidebar ───────────────────────────────────────────────── */
.tr-fm-sidebar {
  width: var(--tr-fm-sidebar-width);
  background: var(--tr-fm-sidebar-bg);
  color: var(--tr-fm-sidebar-text);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 200;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform var(--tr-fm-transition);
}

.tr-fm-sidebar.is-open {
  transform: translateX(0);
}

@media (min-width: 1024px) {
  .tr-fm-sidebar {
    position: sticky;
    transform: none;
    top: 0;
    height: 100vh;
  }
}

.tr-fm-sidebar__header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.tr-fm-sidebar__avatar {
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.tr-fm-sidebar__store-name {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.3;
}

.tr-fm-sidebar__profile-link {
  font-size: 0.78rem;
  color: var(--tr-fm-sidebar-muted);
  text-decoration: none;
  transition: color var(--tr-fm-transition);
}
.tr-fm-sidebar__profile-link:hover {
  color: var(--tr-fm-sidebar-active);
}

/* ── Sidebar Nav ───────────────────────────────────────────── */
.tr-fm-sidebar__nav {
  flex: 1;
  padding: 0.75rem 0;
}

.tr-fm-nav__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tr-fm-nav__item {
  margin: 0;
}

.tr-fm-nav__link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  color: var(--tr-fm-sidebar-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: color var(--tr-fm-transition), background var(--tr-fm-transition), border-color var(--tr-fm-transition);
  position: relative;
}

.tr-fm-nav__link:hover {
  color: #fff;
  background: var(--tr-fm-sidebar-hover-bg);
}

.tr-fm-nav__item.is-active .tr-fm-nav__link {
  color: #fff;
  border-left-color: var(--tr-fm-sidebar-active);
  background: var(--tr-fm-sidebar-hover-bg);
}

.tr-fm-nav__icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  opacity: .8;
}

.tr-fm-nav__label {
  flex: 1;
}

.tr-fm-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  background: var(--tr-fm-primary);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 999px;
}

/* ── Sidebar Footer ────────────────────────────────────────── */
.tr-fm-sidebar__footer {
  padding: 1rem;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex;
  gap: 1rem;
}

.tr-fm-sidebar__link {
  font-size: 0.8rem;
  color: var(--tr-fm-sidebar-muted);
  text-decoration: none;
  transition: color var(--tr-fm-transition);
}
.tr-fm-sidebar__link:hover { color: #fff; }
.tr-fm-sidebar__link--logout:hover { color: var(--tr-fm-error); }

/* ── Mobile Top Bar ────────────────────────────────────────── */
.tr-fm-mobile-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1rem;
  height: var(--tr-fm-mobile-bar-height);
  background: var(--tr-fm-sidebar-bg);
  color: #fff;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 150;
}

@media (min-width: 1024px) {
  .tr-fm-mobile-bar {
    display: none;
  }
}

.tr-fm-mobile-bar__toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  padding: 4px;
  display: flex;
  align-items: center;
}

.tr-fm-hamburger {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 22px;
}
.tr-fm-hamburger span {
  display: block;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform var(--tr-fm-transition), opacity var(--tr-fm-transition);
}

.tr-fm-mobile-bar__title {
  font-size: 0.95rem;
  font-weight: 600;
}

/* ── Main Content ──────────────────────────────────────────── */
.tr-fm-main {
  flex: 1;
  min-width: 0;
  padding-top: var(--tr-fm-mobile-bar-height);
}

@media (min-width: 1024px) {
  .tr-fm-main {
    padding-top: 0;
  }
}

.tr-fm-content {
  padding: 1.5rem 1rem;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}

@media (min-width: 768px) {
  .tr-fm-content {
    padding: 2rem 1.5rem;
  }
}

/* ── Overlay (mobile) ──────────────────────────────────────── */
.tr-fm-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 190;
}
.tr-fm-overlay.is-active {
  display: block;
}

/* ── Section ───────────────────────────────────────────────── */
.tr-fm-section {
  background: var(--tr-fm-surface);
  border-radius: var(--tr-fm-radius-lg);
  border: 1px solid var(--tr-fm-border);
  box-shadow: var(--tr-fm-shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.tr-fm-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.tr-fm-section__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--tr-fm-text);
  margin: 0;
}

.tr-fm-section__action,
.tr-fm-section__actions a {
  font-size: 0.85rem;
  color: var(--tr-fm-primary);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--tr-fm-transition);
}
.tr-fm-section__action:hover { color: var(--tr-fm-primary-dark); }

.tr-fm-section__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ── Stats Grid ────────────────────────────────────────────── */
.tr-fm-stats-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

@media (min-width: 480px) {
  .tr-fm-stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 900px) {
  .tr-fm-stats-grid { grid-template-columns: repeat(4, 1fr); }
}

.tr-fm-stat-card {
  background: var(--tr-fm-surface);
  border: 1px solid var(--tr-fm-border);
  border-radius: var(--tr-fm-radius-lg);
  box-shadow: var(--tr-fm-shadow);
  padding: 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  position: relative;
  overflow: hidden;
  transition: box-shadow var(--tr-fm-transition), transform var(--tr-fm-transition);
}
.tr-fm-stat-card:hover {
  box-shadow: var(--tr-fm-shadow-md);
  transform: translateY(-2px);
}

.tr-fm-stat-card__link {
  position: absolute;
  inset: 0;
}

.tr-fm-stat-card__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--tr-fm-radius);
  flex-shrink: 0;
}
.tr-fm-stat-card__icon--primary { background: #fde8e0; color: var(--tr-fm-primary); }
.tr-fm-stat-card__icon--success { background: #d5f0e3; color: var(--tr-fm-success); }
.tr-fm-stat-card__icon--accent  { background: #d1f0ec; color: var(--tr-fm-accent);  }
.tr-fm-stat-card__icon--warning { background: #fef3cd; color: var(--tr-fm-warning); }

.tr-fm-stat-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.tr-fm-stat-card__label {
  font-size: 0.78rem;
  color: var(--tr-fm-text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.tr-fm-stat-card__value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--tr-fm-text);
  line-height: 1.2;
}

/* ── Tables ────────────────────────────────────────────────── */
.tr-fm-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -1.5rem;
  padding: 0 1.5rem;
}

.tr-fm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.tr-fm-table th {
  text-align: left;
  padding: 0.625rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--tr-fm-text-muted);
  border-bottom: 2px solid var(--tr-fm-border);
  white-space: nowrap;
}

.tr-fm-table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--tr-fm-border);
  color: var(--tr-fm-text);
  vertical-align: middle;
}

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

.tr-fm-table tbody tr:hover td {
  background: var(--tr-fm-surface-alt);
}

.tr-fm-table a {
  color: var(--tr-fm-primary);
  text-decoration: none;
  font-weight: 500;
}
.tr-fm-table a:hover { text-decoration: underline; }

/* ── Status Badges ─────────────────────────────────────────── */
.tr-fm-status {
  display: inline-flex;
  align-items: center;
  padding: 0.2em 0.65em;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.tr-fm-status--processing,
.tr-fm-status--active      { background: #d1f0ec; color: #157a6e; }
.tr-fm-status--completed   { background: #d5f0e3; color: #1a7a3f; }
.tr-fm-status--pending,
.tr-fm-status--pending-payment { background: #fef3cd; color: #926c06; }
.tr-fm-status--on-hold     { background: #e8eaed; color: #4a5568; }
.tr-fm-status--cancelled,
.tr-fm-status--failed      { background: #fde8e0; color: #9b2c14; }
.tr-fm-status--refunded    { background: #e8d5f5; color: #6b3a99; }
.tr-fm-status--publish     { background: #d5f0e3; color: #1a7a3f; }
.tr-fm-status--draft       { background: #e8eaed; color: #4a5568; }

/* ── Buttons ───────────────────────────────────────────────── */
.tr-fm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  border-radius: var(--tr-fm-radius);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  border: 2px solid transparent;
  transition: background var(--tr-fm-transition), color var(--tr-fm-transition), border-color var(--tr-fm-transition), box-shadow var(--tr-fm-transition);
  white-space: nowrap;
}

.tr-fm-btn--primary {
  background: var(--tr-fm-primary);
  color: #fff !important;
  border-color: var(--tr-fm-primary);
}
.tr-fm-btn--primary:hover {
  background: var(--tr-fm-primary-dark);
  border-color: var(--tr-fm-primary-dark);
  color: #fff !important;
}

.tr-fm-btn--outline {
  background: transparent;
  color: var(--tr-fm-primary);
  border-color: var(--tr-fm-primary);
}
.tr-fm-btn--outline:hover {
  background: var(--tr-fm-primary);
  color: #fff;
}

.tr-fm-btn--ghost {
  background: transparent;
  color: var(--tr-fm-text-muted);
  border-color: var(--tr-fm-border);
}
.tr-fm-btn--ghost:hover {
  background: var(--tr-fm-surface-alt);
  color: var(--tr-fm-text);
}

.tr-fm-btn--danger {
  background: var(--tr-fm-error);
  color: #fff !important;
  border-color: var(--tr-fm-error);
}
.tr-fm-btn--danger:hover {
  background: #c0392b;
  border-color: #c0392b;
  color: #fff !important;
}

.tr-fm-btn--sm {
  padding: 0.3rem 0.65rem;
  font-size: 0.8rem;
}

.tr-fm-btn--lg {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
}

/* ── Forms ─────────────────────────────────────────────────── */
.tr-fm-form-row {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (min-width: 600px) {
  .tr-fm-form-row--2col { grid-template-columns: repeat(2, 1fr); }
  .tr-fm-form-row--3col { grid-template-columns: repeat(3, 1fr); }
}

.tr-fm-form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.tr-fm-form-group label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--tr-fm-text);
}

.tr-fm-form-group input,
.tr-fm-form-group textarea,
.tr-fm-form-group select {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1.5px solid var(--tr-fm-border);
  border-radius: var(--tr-fm-radius);
  font-size: 0.9rem;
  color: var(--tr-fm-text);
  background: var(--tr-fm-surface);
  transition: border-color var(--tr-fm-transition), box-shadow var(--tr-fm-transition);
  -webkit-appearance: none;
}

.tr-fm-form-group input:focus,
.tr-fm-form-group textarea:focus,
.tr-fm-form-group select:focus {
  outline: none;
  border-color: var(--tr-fm-primary);
  box-shadow: 0 0 0 3px rgba(231,111,81,.15);
}

.tr-fm-form-group textarea {
  resize: vertical;
  min-height: 120px;
}

.tr-fm-form-hint {
  font-size: 0.78rem;
  color: var(--tr-fm-text-muted);
}

.tr-fm-form-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding-top: 1rem;
  border-top: 1px solid var(--tr-fm-border);
  margin-top: 1.5rem;
}

/* ── Notices ───────────────────────────────────────────────── */
.tr-fm-notice {
  padding: 0.875rem 1rem;
  border-radius: var(--tr-fm-radius);
  border-left: 4px solid;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.tr-fm-notice--success { background: #d5f0e3; border-color: var(--tr-fm-success); color: #1a7a3f; }
.tr-fm-notice--error   { background: #fde8e0; border-color: var(--tr-fm-error);   color: #9b2c14; }
.tr-fm-notice--warning { background: #fef3cd; border-color: var(--tr-fm-warning); color: #926c06; }
.tr-fm-notice--info    { background: #d6eaf8; border-color: var(--tr-fm-info);    color: #1a5276; }

/* ── Product Grid (dashboard widget) ──────────────────────── */
.tr-fm-product-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

@media (min-width: 480px) {
  .tr-fm-product-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 768px) {
  .tr-fm-product-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1100px) {
  .tr-fm-product-grid { grid-template-columns: repeat(5, 1fr); }
}

.tr-fm-product-card {
  background: var(--tr-fm-surface);
  border: 1px solid var(--tr-fm-border);
  border-radius: var(--tr-fm-radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--tr-fm-transition);
}
.tr-fm-product-card:hover { box-shadow: var(--tr-fm-shadow-md); }

.tr-fm-product-card__image {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  position: relative;
  background: var(--tr-fm-surface-alt);
}
.tr-fm-product-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.tr-fm-product-card__placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--tr-fm-border);
}
.tr-fm-product-card__status {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 0.7rem;
}

.tr-fm-product-card__body {
  padding: 0.75rem;
  flex: 1;
}
.tr-fm-product-card__title {
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0 0 0.25rem;
  line-height: 1.3;
}
.tr-fm-product-card__title a {
  color: var(--tr-fm-text);
  text-decoration: none;
}
.tr-fm-product-card__title a:hover { color: var(--tr-fm-primary); }
.tr-fm-product-card__price {
  font-size: 0.85rem;
  color: var(--tr-fm-primary);
  margin: 0;
  font-weight: 600;
}

.tr-fm-product-card__actions {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem 0.75rem;
}

/* ── Empty state ───────────────────────────────────────────── */
.tr-fm-empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--tr-fm-text-muted);
}
.tr-fm-empty-state svg {
  margin-bottom: 1rem;
  opacity: .4;
}
.tr-fm-empty-state p {
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
}

.tr-fm-empty {
  color: var(--tr-fm-text-muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 2rem 0;
}

/* ── Loading spinner ───────────────────────────────────────── */
.tr-fm-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--tr-fm-border);
  border-top-color: var(--tr-fm-primary);
  border-radius: 50%;
  animation: tr-fm-spin 0.6s linear infinite;
}
@keyframes tr-fm-spin { to { transform: rotate(360deg); } }

/* ── Tabs ──────────────────────────────────────────────────── */
.tr-fm-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border-bottom: 2px solid var(--tr-fm-border);
  margin-bottom: 1.25rem;
}

.tr-fm-tab {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--tr-fm-text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  border-radius: var(--tr-fm-radius-sm) var(--tr-fm-radius-sm) 0 0;
  transition: color var(--tr-fm-transition), border-color var(--tr-fm-transition), background var(--tr-fm-transition);
  white-space: nowrap;
}

.tr-fm-tab:hover {
  color: var(--tr-fm-text);
  background: var(--tr-fm-surface-alt);
}

.tr-fm-tab--active {
  color: var(--tr-fm-primary);
  border-bottom-color: var(--tr-fm-primary);
  background: transparent;
}

/* ── Search bar ────────────────────────────────────────────── */
.tr-fm-search-bar {
  margin-bottom: 1.25rem;
}

.tr-fm-search-bar__inner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  background: var(--tr-fm-surface);
  border: 1.5px solid var(--tr-fm-border);
  border-radius: var(--tr-fm-radius);
  transition: border-color var(--tr-fm-transition), box-shadow var(--tr-fm-transition);
}

.tr-fm-search-bar__inner:focus-within {
  border-color: var(--tr-fm-primary);
  box-shadow: 0 0 0 3px rgba(231,111,81,.12);
}

.tr-fm-search-bar__inner > svg {
  flex-shrink: 0;
  color: var(--tr-fm-text-muted);
}

.tr-fm-search-bar__input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 0.875rem;
  color: var(--tr-fm-text);
  min-width: 0;
  padding: 0.25rem 0;
}

.tr-fm-search-bar__input::placeholder {
  color: var(--tr-fm-text-muted);
}

/* ── Product cell (table row) ──────────────────────────────── */
.tr-fm-product-cell picture {
  display: flex;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: var(--tr-fm-radius-sm);
  overflow: hidden;
}

.tr-fm-product-cell__img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  display: block;
  border-radius: var(--tr-fm-radius-sm);
  flex-shrink: 0;
}

.tr-fm-product-cell__no-img {
  width: 40px;
  height: 40px;
  border-radius: var(--tr-fm-radius-sm);
  background: var(--tr-fm-surface-alt);
  border: 1px solid var(--tr-fm-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--tr-fm-border);
  flex-shrink: 0;
}

.tr-fm-product-cell__info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
  flex: 1;
}

.tr-fm-product-cell__name {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--tr-fm-text);
  text-decoration: none;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 240px;
  transition: color var(--tr-fm-transition);
}

.tr-fm-product-cell__name:hover {
  color: var(--tr-fm-primary);
}

.tr-fm-product-cell__cats {
  font-size: 0.75rem;
  color: var(--tr-fm-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 240px;
}

/* ── Link utility ──────────────────────────────────────────── */
.tr-fm-link {
  color: var(--tr-fm-primary);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--tr-fm-transition);
}

.tr-fm-link:hover {
  color: var(--tr-fm-primary-dark);
  text-decoration: underline;
}

/* ── Table column helpers ──────────────────────────────────── */
.tr-fm-table__check {
  width: 44px;
  padding-left: 0.5rem !important;
  padding-right: 0.25rem !important;
}

.tr-fm-table__actions-col {
  text-align: right;
  white-space: nowrap;
}

.tr-fm-table__actions {
  text-align: right;
  white-space: nowrap;
}

.tr-fm-table__actions .tr-fm-btn + .tr-fm-btn {
  margin-left: 0.25rem;
}

/* ── Bulk action bar ───────────────────────────────────────── */
.tr-fm-bulk-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.75rem 1rem;
  background: var(--tr-fm-surface-alt);
  border: 1px solid var(--tr-fm-border);
  border-radius: var(--tr-fm-radius);
  margin-top: 0.75rem;
}

.tr-fm-bulk-bar__count {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--tr-fm-text);
  flex: 1;
}

/* ── Stock display ─────────────────────────────────────────── */
.tr-fm-stock-qty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 22px;
  padding: 0 6px;
  background: var(--tr-fm-surface-alt);
  border: 1px solid var(--tr-fm-border);
  border-radius: var(--tr-fm-radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--tr-fm-text);
}

/* ── Text color utilities ──────────────────────────────────── */
.tr-fm-text--success { color: var(--tr-fm-success); font-weight: 600; font-size: 0.8125rem; }
.tr-fm-text--danger  { color: var(--tr-fm-error);   font-weight: 600; font-size: 0.8125rem; }
.tr-fm-text--muted   { color: var(--tr-fm-text-muted); }

/* ── Badge variants (product status + count) ───────────────── */
.tr-fm-badge--neutral {
  background: var(--tr-fm-surface-alt);
  color: var(--tr-fm-text-muted);
  border: 1px solid var(--tr-fm-border);
}

.tr-fm-badge--publish  { background: #d5f0e3; color: #1a7a3f; }
.tr-fm-badge--draft    { background: #e8eaed; color: #4a5568; }
.tr-fm-badge--pending  { background: #fef3cd; color: #926c06; }
.tr-fm-badge--private  { background: #e8d5f5; color: #6b3a99; }
.tr-fm-badge--trash    { background: #fde8e0; color: #9b2c14; }

/* ── Pagination ────────────────────────────────────────────── */
.tr-fm-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding-top: 1.25rem;
}
.tr-fm-pagination a,
.tr-fm-pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 0.5rem;
  border-radius: var(--tr-fm-radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--tr-fm-text);
  background: var(--tr-fm-surface);
  border: 1px solid var(--tr-fm-border);
  text-decoration: none;
  transition: background var(--tr-fm-transition), color var(--tr-fm-transition);
}
.tr-fm-pagination a:hover { background: var(--tr-fm-primary); color: #fff; border-color: var(--tr-fm-primary); }
.tr-fm-pagination .current { background: var(--tr-fm-primary); color: #fff; border-color: var(--tr-fm-primary); }

/* ── Dashboard Full Width Override ────────────────────────── */
.tr-dashboard-full-width .tr-container {
  max-width: 1600px !important;
  width: 96% !important;
}

/* ── Product Data Tabs (Woo-style) ────────────────────────── */
.tr-fm-data-tabs {
  display: flex;
  background: var(--tr-fm-surface);
  border: 1px solid var(--tr-fm-border);
  border-radius: var(--tr-fm-radius);
  margin-top: 1.5rem;
  overflow: hidden;
  min-height: 400px;
}

.tr-fm-data-tabs__nav {
  width: 200px;
  background: var(--tr-fm-surface-alt);
  border-right: 1px solid var(--tr-fm-border);
  flex-shrink: 0;
}

.tr-fm-data-tabs__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tr-fm-data-tab-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  color: var(--tr-fm-text);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  border-bottom: 1px solid var(--tr-fm-border);
  transition: all var(--tr-fm-transition);
}

.tr-fm-data-tab-link svg {
  width: 18px;
  height: 18px;
  opacity: 0.7;
}

.tr-fm-data-tab-link:hover {
  background: rgba(0,0,0,0.02);
  color: var(--tr-fm-primary);
}

.tr-fm-data-tab-link.is-active {
  background: var(--tr-fm-surface);
  color: var(--tr-fm-primary);
  border-right: 3px solid var(--tr-fm-primary);
  margin-right: -1px;
  position: relative;
  z-index: 2;
}

.tr-fm-data-tabs__content {
  flex: 1;
  padding: 2rem;
  min-width: 0;
}

.tr-fm-data-panel {
  display: none;
}

.tr-fm-data-panel.is-active {
  display: block;
}

/* ── Product Editor Layout ────────────────────────────────── */
.tr-fm-editor-title,
.tr-fm-field-title .tr-fm-label {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 1rem;
  color: var(--tr-fm-accent);
  display: block;
}

/* Base input/select/textarea style (used across product form) */
.tr-fm-input,
.tr-fm-select,
.tr-fm-textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1.5px solid var(--tr-fm-border);
  border-radius: var(--tr-fm-radius);
  font-size: 0.9rem;
  color: var(--tr-fm-text);
  background: var(--tr-fm-surface);
  transition: border-color var(--tr-fm-transition), box-shadow var(--tr-fm-transition);
  -webkit-appearance: none;
  box-sizing: border-box;
}

.tr-fm-input:focus,
.tr-fm-select:focus,
.tr-fm-textarea:focus {
  outline: none;
  border-color: var(--tr-fm-primary);
  box-shadow: 0 0 0 3px rgba(231,111,81,.15);
}

/* Product title field — full-width card matching editor sections */
.tr-fm-field-title {
  background: var(--tr-fm-surface);
  border: 1px solid var(--tr-fm-border);
  border-radius: var(--tr-fm-radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
}

.tr-fm-field-title input,
.tr-fm-field-title .tr-fm-input {
  width: 100% !important;
  font-size: 1.5rem !important;
  font-weight: 600 !important;
  padding: 0.75rem 1rem !important;
  border-radius: var(--tr-fm-radius-sm) !important;
  box-sizing: border-box !important;
  margin: 0 !important;
}

.tr-fm-field-row--3col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

/* ── Video Link Fields ────────────────────────────────────── */
.tr-fm-video-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
}

.tr-fm-video-row {
  background: var(--tr-fm-surface);
  padding: 1rem 1.5rem;
  border-radius: var(--tr-fm-radius);
  border: 1px solid var(--tr-fm-border);
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.tr-fm-video-row__label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 0.95rem;
  width: 140px;
  flex-shrink: 0;
}

.tr-fm-video-row__label svg {
  width: 24px;
  height: 24px;
}

.tr-fm-video-row--youtube .tr-fm-video-row__label { color: #ff0000; }
.tr-fm-video-row--instagram .tr-fm-video-row__label { color: #e1306c; }
.tr-fm-video-row--tiktok .tr-fm-video-row__label { color: var(--tr-fm-text); }

.tr-fm-video-row .tr-fm-input {
  flex: 1;
}

/* ── WP Editor integration ────────────────────────────────── */
.tr-fm-editor-container {
  background: var(--tr-fm-surface);
  border: 1px solid var(--tr-fm-border);
  border-radius: var(--tr-fm-radius);
  margin-bottom: 2rem;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 991px) {
  .tr-fm-data-tabs {
    flex-direction: column;
  }
  .tr-fm-data-tabs__nav {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--tr-fm-border);
    height: auto;
  }
  .tr-fm-data-tabs__list {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .tr-fm-data-tab-link {
    border-bottom: none;
    border-right: 1px solid var(--tr-fm-border);
    white-space: nowrap;
    padding: 0.75rem 1rem;
    flex: 1;
    justify-content: center;
  }
  .tr-fm-data-tab-link.is-active {
    border-right: none;
    border-bottom: 3px solid var(--tr-fm-primary);
  }
}

  
/* Product Type Bar */  
.tr-fm-product-type-bar {  
  display: flex;  
  align-items: center;  
  gap: 0.75rem;  
  margin-top: 1.5rem;  
  padding: 0.75rem 1rem;  
  background: var(--tr-fm-surface);  
  border: 1px solid var(--tr-fm-border);  
  border-bottom: none;  
  border-radius: var(--tr-fm-radius) var(--tr-fm-radius) 0 0;  
  font-weight: 600;  
  font-size: 0.875rem;  
  color: var(--tr-fm-text);  
}  
.tr-fm-product-type-bar + .tr-fm-data-tabs {  
  margin-top: 0;  
  border-radius: 0 0 var(--tr-fm-radius) var(--tr-fm-radius);  
}  
.tr-fm-product-type-select {  
  min-width: 220px;  
  font-weight: 600;  
}  
/* Sale Price Schedule */  
.tr-fm-sale-schedule {  
  margin-top: 0.75rem;  
  padding-top: 0.75rem;  
  border-top: 1px dashed var(--tr-fm-border);  
}  
.tr-fm-sale-schedule__label {  
  font-size: 0.8125rem;  
  color: var(--tr-fm-text-muted);  
}  
.tr-fm-sale-dates { margin-top: 0.5rem; }  
.tr-fm-external-fields {  
  margin-top: 1rem;  
  padding-top: 1rem;  
  border-top: 1px solid var(--tr-fm-border);  
} 
/* Linked Products */  
.tr-fm-linked-search {  
  border: 1px solid var(--tr-fm-border);  
  border-radius: var(--tr-fm-radius);  
  overflow: hidden;  
}  
.tr-fm-linked-search__input-row {  
  padding: 0.5rem;  
  background: var(--tr-fm-surface-alt);  
  border-bottom: 1px solid var(--tr-fm-border);  
}  
.tr-fm-linked-search__input-row .tr-fm-input { margin: 0; }  
.tr-fm-linked-list { list-style: none; margin: 0; padding: 0; }  
.tr-fm-linked-item {  
  display: flex; align-items: center; gap: 0.5rem;  
  padding: 0.5rem 0.75rem;  
  border-bottom: 1px solid var(--tr-fm-border);  
  font-size: 0.875rem;  
}  
.tr-fm-linked-item:last-child { border-bottom: none; }  
.tr-fm-linked-item__name { flex: 1; }  
.tr-fm-linked-item__remove {  
  background: none; border: none; cursor: pointer;  
  color: var(--tr-fm-error); font-size: 1.25rem; line-height: 1;  
  padding: 0 0.25rem; border-radius: var(--tr-fm-radius-sm);  
  transition: background var(--tr-fm-transition);  
} 
.tr-fm-linked-item__remove:hover { background: rgba(231,76,60,0.1); }  
.tr-fm-linked-results {  
  position: relative; background: var(--tr-fm-surface);  
  border: 1px solid var(--tr-fm-border);  
  border-radius: var(--tr-fm-radius);  
  box-shadow: var(--tr-fm-shadow-md);  
  margin-top: 0.25rem; z-index: 100;  
  max-height: 260px; overflow-y: auto;  
}  
.tr-fm-linked-results__list { list-style: none; margin: 0; padding: 0; }  
.tr-fm-linked-result-item {  
  padding: 0.625rem 1rem; cursor: pointer;  
  font-size: 0.875rem;  
  border-bottom: 1px solid var(--tr-fm-border);  
  transition: background var(--tr-fm-transition);  
  display: flex; align-items: center; justify-content: space-between;  
}  
.tr-fm-linked-result-item:last-child { border-bottom: none; }  
.tr-fm-linked-result-item:hover { background: var(--tr-fm-surface-alt); }  
.tr-fm-linked-result-item span { color: var(--tr-fm-text-muted); font-size: 0.8rem; }  
.tr-fm-linked-results__empty { padding: 1rem; font-size: 0.875rem; color: var(--tr-fm-text-muted); text-align: center; } 
/* Attributes */  
.tr-fm-attributes-header {  
  display: flex; align-items: flex-start;  
  justify-content: space-between;  
  gap: 1rem; margin-bottom: 1.25rem;  
}  
.tr-fm-attributes-list { display: flex; flex-direction: column; gap: 1rem; }  
.tr-fm-attribute-row {  
  background: var(--tr-fm-surface-alt);  
  border: 1px solid var(--tr-fm-border);  
  border-radius: var(--tr-fm-radius);  
  overflow: hidden;  
}  
.tr-fm-attribute-row__header {  
  display: flex; align-items: center; gap: 0.75rem;  
  padding: 0.625rem 0.75rem;  
  background: var(--tr-fm-surface);  
  border-bottom: 1px solid var(--tr-fm-border);  
}  
.tr-fm-attribute-row__header .tr-fm-input { flex: 1; margin: 0; }  
.tr-fm-attribute-row__body { padding: 0.875rem 0.75rem 0.75rem; }  
.tr-fm-field-desc { font-size: 0.8125rem; color: var(--tr-fm-text-muted); margin: 0 0 0.75rem; line-height: 1.5; }  
.tr-fm-link--sm { font-size: 0.8125rem; }  
.tr-fm-attribute-name { font-weight: 600; }

.tr-fm-form-footer {
  margin-top: 2rem;
  padding: 1.5rem;
  background: var(--tr-fm-surface);
  border: 1px solid var(--tr-fm-border);
  border-radius: var(--tr-fm-radius);
  display: flex;
  justify-content: flex-end;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.tr-fm-gallery-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid var(--tr-fm-border);
  background: var(--tr-fm-surface-alt);
  transition: all 0.2s ease;
}

.tr-fm-gallery-item.is-main {
  border-color: var(--tr-fm-primary);
  box-shadow: 0 0 0 2px rgba(var(--tr-fm-primary-rgb), 0.2);
}

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

.tr-fm-gallery-item__overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.tr-fm-gallery-item:hover .tr-fm-gallery-item__overlay {
  opacity: 1;
}

.tr-fm-gallery-item__set-main,
.tr-fm-gallery-item__remove {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: transform 0.2s ease;
  color: #fff;
}

.tr-fm-gallery-item__set-main { background: #2d3748; color: #ecc94b; }
.tr-fm-gallery-item__remove { background: #2d3748; color: #e53e3e; }

.tr-fm-gallery-item__set-main:hover,
.tr-fm-gallery-item__remove:hover {
  transform: scale(1.1);
  background: #1a202c;
}

.tr-fm-gallery-item__badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: var(--tr-fm-primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tr-fm-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 0.75rem;
}

.tr-fm-gallery-add-btn {
  aspect-ratio: 1;
  border: 2px dashed var(--tr-fm-border);
  border-radius: 8px;
  background: transparent;
  color: var(--tr-fm-text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tr-fm-gallery-add-btn:hover {
  border-color: var(--tr-fm-primary);
  color: var(--tr-fm-primary);
  background: rgba(var(--tr-fm-primary-rgb), 0.05);
}

.tr-fm-gallery-add-btn span {
  font-size: 11px;
  font-weight: 600;
}  

/* ── Tooltip & Help Icon ────────────────────────────────── */
.tr-fm-product-type-select {
  width: 260px;
  flex: 0 0 260px;
}
.tr-fm-product-type-bar {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 1rem;
  background: var(--tr-fm-surface);
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--tr-fm-border);
}
.tr-fm-type-checkboxes {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-left: 2rem;
}
@media (max-width: 900px) {
  .tr-fm-product-type-bar { flex-wrap: wrap; }
  .tr-fm-type-checkboxes { margin-left: 0; width: 100%; border-top: 1px solid var(--tr-fm-border); padding-top: 0.75rem; }
}

/* ── Tooltip & Help Icon ────────────────────────────────── */
.tr-fm-help-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: #718096;
  color: #fff;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  cursor: help;
  position: relative;
  vertical-align: middle;
}
.tr-fm-help-tip::after {
  content: attr(data-tip);
  position: absolute;
  top: 160%;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 16px;
  background: #2d3748;
  color: #fff;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
  border-radius: 4px;
  width: 280px;
  visibility: hidden;
  opacity: 0;
  transition: all 0.2s ease;
  z-index: 10001;
  text-align: center;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}
.tr-fm-help-tip::before {
  content: "";
  position: absolute;
  top: 130%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: transparent transparent #2d3748 transparent;
  visibility: hidden;
  opacity: 0;
  transition: all 0.2s ease;
  z-index: 10002;
}
.tr-fm-help-tip:hover::after,
.tr-fm-help-tip:hover::before {
  visibility: visible;
  opacity: 1;
  top: 150%;
}
.tr-fm-help-tip:hover::before {
  top: 120%;
}
.tr-fm-type-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
}
.tr-fm-type-checkbox-label input {
  width: 16px;
  height: 16px;
}
