@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Inter:wght@400;500;600&display=swap');
/* TurnGoods — Global Layout & Sidebar v5 TurnGoods Brand */
* { margin:0; padding:0; box-sizing:border-box; }

:root {
  --sb-w:        220px;
  --sb-bg:       #0F172A;
  --sb-border:   rgba(255,255,255,0.07);
  --accent:      #059669;
  --sb-text:     #94a3b8;
  --sb-active:   #f8fafc;
  --sb-hover:    rgba(255,255,255,0.05);
  --sb-activebg: rgba(5,150,105,0.12);
  --page-bg:     #0f0f0f;

  /* ── White-label branding overrides ── */
  --brand-primary:   var(--accent);
  --brand-secondary: var(--sb-bg);
  --brand-accent:    var(--accent);
}

body {
  font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--page-bg);
  color: #f0f0f0;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sb-w);
  background: var(--sb-bg);
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1000;
  border-right: 1px solid var(--sb-border);
  display: flex;
  flex-direction: column;
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }

.sidebar-header {
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--sb-border);
  flex-shrink: 0;
}
.sidebar-logo {
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1.1;
}
.logo-turn    { color: #f8fafc; }
.logo-goods   { color: #059669; }
.sidebar-subtitle {
  font-size: 0.6rem;
  color: var(--sb-text);
  margin-top: 4px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.7;
}

/* ── Sidebar Nav ── */
.sidebar-nav {
  padding: 8px 0;
  flex: 1;
  overflow-y: auto;
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

/* ── Standalone items (no group) ── */
.nav-standalone {
  list-style: none;
  padding: 0;
  margin: 4px 0;
}

/* ── Group styles ── */
.nav-group {
  margin: 4px 0;
}

.nav-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 16px 4px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.nav-group-header:hover {
  background: rgba(255,255,255,0.02);
}
.nav-group-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #475569;
}
.nav-group-chevron {
  font-size: 0.7rem;
  color: #475569;
  transition: transform 0.2s ease;
  line-height: 1;
}

/* ── Group items list ── */
.nav-group-items {
  list-style: none;
  padding: 0;
  overflow: hidden;
  max-height: 500px;
  transition: max-height 0.25s ease, opacity 0.2s ease;
  opacity: 1;
}
.nav-group-items.collapsed {
  max-height: 0;
  opacity: 0;
}

/* ── Nav items ── */
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  color: var(--sb-text);
  text-decoration: none;
  font-size: 0.83rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.nav-item:hover {
  color: var(--sb-active);
  background: var(--sb-hover);
}

/* ── Active item glow ── */
.nav-item.active {
  background: color-mix(in srgb, var(--brand-accent) 15%, transparent);
  border-left: 3px solid var(--brand-accent);
  box-shadow: 0 0 12px color-mix(in srgb, var(--brand-accent) 20%, transparent);
  color: var(--brand-accent);
}

.nav-icon {
  font-size: 0.92rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}
.nav-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-badge {
  margin-left: auto;
  background: rgba(255,255,255,0.07);
  color: #64748b;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  min-width: 22px;
  text-align: center;
  transition: all 0.3s;
  flex-shrink: 0;
}
.nav-badge.loaded {
  background: var(--accent);
  color: #fff;
  opacity: 0.9;
}

/* ── Sidebar footer with user avatar ── */
.nav-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--sb-border);
  padding: 12px 14px;
  background: rgba(0,0,0,0.2);
}
.nav-user {
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, #6366f1 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: -0.02em;
}
.nav-user-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.nav-username {
  font-size: 0.8rem;
  font-weight: 600;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-logout {
  font-size: 0.68rem;
  color: #475569;
  text-decoration: none;
  transition: color 0.15s;
}
.nav-logout:hover {
  color: #ef4444;
}

/* ── Mobile ── */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 10px; left: 10px;
  z-index: 1100;
  background: var(--sb-bg);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  width: 38px; height: 38px;
  cursor: pointer;
  font-size: 1.1rem;
  color: #f8fafc;
  align-items: center;
  justify-content: center;
}
.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 999;
  backdrop-filter: blur(2px);
}

/* ── Main content layout ── */
.main-content, .main-wrapper {
  margin-left: var(--sb-w);
  padding: 28px;
  min-width: 0;
  min-height: 100vh;
}
.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: #f8fafc;
}
.back-link {
  font-size: 0.8rem;
  color: #475569;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 14px;
  transition: color 0.15s;
}
.back-link:hover { color: var(--accent); }

/* ── Cards ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: #111827;
  border: 1px solid var(--sb-border);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
}
.stat-number {
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--brand-accent);
  line-height: 1;
}
.stat-label {
  font-size: 0.72rem;
  color: #64748b;
  margin-top: 6px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.action-card {
  background: #111827;
  border: 1px solid var(--sb-border);
  border-radius: 12px;
  padding: 20px;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: all 0.2s;
}
.action-card:hover {
  transform: translateY(-2px);
  border-color: var(--brand-accent);
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  background: var(--brand-accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.2s;
}
.btn:hover { opacity: 0.85; }
.btn-ghost {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.12);
  color: #94a3b8;
}
.btn-ghost:hover { border-color: var(--brand-accent); color: var(--brand-accent); opacity: 1; }
.btn-sm { padding: 5px 12px; font-size: 0.78rem; }

/* ── Tables ── */
table { width: 100%; border-collapse: collapse; font-size: 0.83rem; }
th {
  background: #1e293b;
  color: #94a3b8;
  padding: 10px 12px;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--sb-border);
}
td {
  padding: 11px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: #e2e8f0;
  vertical-align: middle;
}
tr:hover td { background: rgba(255,255,255,0.015); }

/* ── Search & Filter bar ── */
.search-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.search-wrap input {
  width: 100%;
  padding: 9px 36px 9px 14px;
  background: #1e293b;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: #f0f0f0;
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.search-wrap input:focus { border-color: var(--accent); }
.search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #64748b;
  font-size: 1rem;
  cursor: pointer;
  display: none;
  padding: 0;
  line-height: 1;
}
.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  align-items: center;
}
.filter-bar select {
  padding: 7px 10px;
  background: #1e293b;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 7px;
  color: #94a3b8;
  font-size: 0.8rem;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}
.filter-bar select:focus { border-color: var(--accent); }
.filter-count {
  margin-left: auto;
  font-size: 0.78rem;
  color: #64748b;
}

/* ── Qty badge ── */
.qty-badge {
  display: inline-block;
  padding: 1px 6px;
  background: rgba(59,130,246,0.15);
  border: 1px solid rgba(59,130,246,0.3);
  border-radius: 4px;
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 700;
  margin-left: 4px;
}


/* ── Tablet breakpoint — collapsible sidebar ── */
@media (min-width: 769px) and (max-width: 1024px) {
  .sidebar { width: 60px; overflow: visible; }
  .sidebar-logo span,
  .sidebar-subtitle,
  .nav-group-label,
  .nav-group-arrow,
  .nav-item-label,
  .nav-item-badge,
  .sidebar-section-label { display: none; }
  .nav-item { justify-content: center; padding: 10px 0; font-size: 1.2rem; }
  .sidebar-header { padding: 16px 8px; text-align: center; }
  .sidebar-logo { justify-content: center; }
  .main-content, .main-wrapper { margin-left: 60px; }
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .mobile-menu-btn { display: flex; }
  .sidebar { transform: translateX(-100%); transition: transform 0.25s ease; }
  .sidebar.mobile-open { transform: translateX(0); }
  .mobile-overlay.show { display: block; }
  .main-content, .main-wrapper { margin-left: 0 !important; padding: 16px; padding-top: 58px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Labs Group v11 ── */
.nav-group.lab { margin-top:12px; border-top:1px solid rgba(168,85,247,0.15); padding-top:8px; }
.nav-group.lab .nav-group-label { color:#a855f7; letter-spacing:0.06em; }
.nav-group.lab .nav-group-chevron { color:#a855f7; }
.nav-group.lab .nav-group-header:hover { background:rgba(168,85,247,0.05); }
.nav-group.lab .nav-item:hover { color:#c084fc; background:rgba(168,85,247,0.06); }
.nav-group.lab .nav-item.active { background:rgba(168,85,247,0.15); border-left:3px solid #a855f7; box-shadow:0 0 12px rgba(168,85,247,0.2); color:#c084fc; }
.nav-item.coming-soon { opacity:0.35; cursor:not-allowed; pointer-events:none; display:flex; align-items:center; gap:10px; padding:9px 16px; color:var(--sb-text); font-size:0.83rem; font-weight:500; border-left:3px solid transparent; }
.soon-badge { margin-left:auto; font-size:0.55rem; font-weight:700; text-transform:uppercase; letter-spacing:0.06em; background:rgba(168,85,247,0.15); color:#a855f7; border:1px solid rgba(168,85,247,0.3); border-radius:4px; padding:2px 5px; flex-shrink:0; }

.sidebar-social-link { color: #94a3b8; transition: color 0.15s; }
.sidebar-social-link:hover { color: #fff; }
