:root {
  --bg: #f8f8f8;
  --card: #fff;
  --border: #e5e5e5;
  --muted: #6f6f6f;
  --text: #222;
  --sidebar: #fafafa;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', system-ui,-apple-system,BlinkMacSystemFont,sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.app {
  display: flex;
  min-height: 100vh;
}

/* ===== Sidebar ===== */
.app-sidebar {
  width: 260px;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  padding: 16px;
  overflow-y: hidden;
}

.app-sidebar h2 {
  font-size: 18px;
  margin-bottom: 4px;
}

.app-shop-status {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 14px;
}

.app-sidebar input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 16px;
}

.app-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
}

.app-nav-item a {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  transition: background 0.2s ease, transform 0.15s ease;
}

.app-nav-item i.app-left {
  font-size: 18px;
}

.app-nav-item i.app-right {
  margin-left: auto;
  font-size: 18px;
}

/*.app-nav-item:hover,*/
.app-nav-item.app-active {
  background: #ececec;
  font-weight: 600;
}

.app-dropdown {
  margin-left: 34px;
  display: none;
}

.app-dropdown a {
  display: block;
  padding: 8px 10px;
  font-size: 13px;
  color: #333;
  border-radius: 8px;
  text-decoration: none;
}

.app-dropdown a:hover {
  background: #eee;
}

.app-section-title {
  font-size: 12px;
  color: var(--muted);
  margin: 18px 0 8px;
}

/* ===== Main ===== */
.app-main {
  flex: 1;
  padding: 20px;
}

/* Header */
.app-header {
  display: flex;
  gap: 14px;
  align-items: center;
}

.app-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #ddd;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.app-header h1 {
  font-size: 14px;
  margin: 0;
}

.app-header p {
  font-size: 14px;
  color: var(--muted);
  margin-top: 2px;
}

/* ===== Tabs ===== */
.app-tabs {
  display: flex;
  gap: 18px;
  margin: 16px 0 20px;
  border-bottom: 1px solid var(--border);
}

.app-tab {
  padding-bottom: 10px;
  cursor: pointer;
  font-size: 14px;
}

.app-tab.app-active {
  border-bottom: 2px solid #000;
  font-weight: 600;
}

/* ===== Tab panels ===== */
.app-tab-panel {
  display: none;
}
.app-tab-panel.app-active {
  display: block;
}

/* Cards */
.app-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.app-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.app-main > h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
}

.app-card h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
}

.app-card p {
  font-size: 13px;
  color: var(--muted);
  margin: 3px 0;
}

/* Stats */

.app-task-header {
  font-size: 16px;
  color: #666;
}
.app-stats-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 28px 0 12px;
  position: relative;
}

.app-stats-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 16px;
}

.app-stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

/*.app-stat strong {
      font-size: 24px;
      display: block;
      margin: 6px 0;
    }*/

.app-stat span {
  font-size: 13px;
  color: var(--muted);
}

/* ===== Stat layout fix ===== */
.app-stat {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  row-gap: 6px;
}

.app-stat span:first-child {
  grid-column: 1 / -1;
  font-size: 13px;
  color: var(--muted);
}

.app-stat strong {
  grid-column: 1;
  font-size: 24px;
  display: block;
  margin: 0;
}

.app-stat span:last-child {
  grid-column: 2;
  align-self: center;
  transform: translateY(1px);
  font-size: 13px;
  color: var(--muted);
}

/* Advisor */
.app-advisor {
  margin-top: 26px;
  background: #f1f1f1;
  border-radius: var(--radius);
  padding: 26px;
  text-align: center;
  font-size: 14px;
  color: #555;
}

@media (max-width: 600px) {
  .app-card {
    padding: 12px;
  }

  .app-card h3 {
    font-size: 13px;
  }

  .app-card p {
    font-size: 12px;
  }
}

@media (max-width: 600px) {
  .app-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .app-stat {
    padding: 10px;
    min-height: auto;
  }

  .app-stat strong {
    font-size: 18px;
    margin: 4px 0;
  }

  .app-stat span {
    font-size: 12px;
  }

  .app-stats-header {
    margin-top: 20px;
    margin-bottom: 8px;
  }
}

@media (max-width: 420px) {
  .app-stat strong {
    font-size: 16px;
  }
}

/* ===== Top task title with icon ===== */
.app-task-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}

.app-task-title i {
  font-size: 16px;
  color: #666;
}

@media (max-width: 600px) {
  .app-task-title i {
    font-size: 15px;
  }
}

/* ===== Recent activity ===== */
.app-recent-filters {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 90vw;
  overflow-x: auto;
  flex-wrap: nowrap;
  white-space: nowrap;
  padding-bottom: 6px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.app-recent-filters::-webkit-scrollbar {
  display: none;
}

.app-pill {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  border: 1px solid var(--border);
  cursor: pointer;
  background: #f5f5f5;
  flex-shrink: 0;
  transition: all 0.2s ease;
  user-select: none;
}

.app-pill:hover {
  background: #e9e9e9;
  transform: translateY(-1px);
}

.app-pill.app-active {
  background: #fff;
  border: 2px solid #000;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Activity Items */
.app-activity-items {
  margin-top: 20px;
  display: grid;
  gap: 12px;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.app-activity-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.app-activity-item[data-filter] {
  display: flex;
}

/* CHANGED: Updated activity icon to handle product images */
.app-activity-icon {
  width: 50px;
  height: 50px;
  border-radius: 8px;
  /* Makes it round */
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  /* Ensures image stays within round boundary */
}

.app-activity-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Ensures image fills the circle properly */
}

.app-activity-details h4 {
  margin: 0 0 4px 0;
  font-size: 14px;
  font-weight: 600;
}

.app-activity-details p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.app-activity-time {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.app-no-activities {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 14px;
  display: none;
}

.app-no-activities.app-show {
  display: block;
  animation: fadeIn 0.4s ease;
}

.app-activity-item.app-hidden {
  display: none !important;
}

.app-activity-item.app-visible {
  animation: fadeIn 0.4s ease;
}

.app-statsSelect {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;

  appearance: auto;
  -webkit-appearance: auto;
  -moz-appearance: auto;

  padding-right: 0.5rem;

  font-size: 13px;
}

/* ===== Purchase Activity Card ===== */
.app-activity-item[data-filter="purchase"] {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px;
  border-radius: 12px;
  background: #fff;
}

/* ===== Product Image ===== */
.app-activity-icon {
  width: 70px;
  height: 70px;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}

.app-activity-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ===== Cart Badge ===== */
.app-purchase-badge {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 22px;
  height: 22px;
  background: #34a853;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  border: 2px solid #fff;
}

/* ===== Details ===== */
.app-activity-details {
  flex: 1;
  min-width: 0;
}

/* ===== Title (Name + Action inline) ===== */
.app-activity-purchase-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  margin: 0 0 4px;
  line-height: 1.4;
  white-space: nowrap;
}

.purchaser-name {
  font-weight: 700;
  color: #111;
}

.purchase-text {
  font-weight: 400;
  color: #777;
}

/* ===== Product Name ===== */
.app-activity-purchase-product {
  font-size: 13px;
  color: #333;
  margin: 0 0 6px;
  line-height: 1.4;
}

/* ===== Meta (Date + Promo) ===== */
.app-activity-purchase-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: #888;
  gap: 8px;
}

.app-activity-purchase-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.app-activity-purchase-meta strong {
  font-weight: 600;
  color: #444;
}

@media (max-width: 576px) {
  .app-activity-purchase-meta {
    font-size: 11px;
    gap: 6px;
  }

  .app-activity-purchase-meta .meta-date {
    flex-shrink: 0;
    color: #999;
  }

  .app-activity-purchase-meta .meta-promo {
    margin-left: auto;
    gap: 4px;
  }

  .app-activity-purchase-meta i {
    font-size: 13px;
  }

  .app-activity-purchase-product {
    display: -webkit-box;
    /*-webkit-line-clamp: 2;*/
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}

/* ===============================
     MOBILE TOP BAR
    ================================ */
.app-mobile-top {
  display: none;
  align-items: center;
  gap: 8px;
  /*padding: 8px;*/
  background: #f8f8f8;
  /*border-bottom: 1px solid var(--border);*/
  position: sticky;
  top: 0;
  z-index: 1200;
}

.app-mobile-title {
  font-size: 14px;
  font-weight: 600;
}

.app-hamburger {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-hamburger i {
  font-size: 24px;
  color: #222;
  line-height: 1;
}

.app-sidebar {
  width: 260px;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 16px;
  position: relative;
  z-index: 1300;
  overflow: hidden;
  transition: transform 0.3s ease;
}

.app-sidebar-content {
  flex: 1;
  overflow: hidden; 
  overflow-x: hidden;
  padding-right: 6px;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

@media (max-width: 900px) {
  .app-sidebar {
    padding-bottom: calc(70px + env(safe-area-inset-bottom));
  }
}

.app-sidebar-close {
  display: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-bottom: 14px;
}

.app-sidebar-close i {
  font-size: 20px;
  line-height: 1;
}

.app-sidebar-close:hover {
  background: #f0f0f0;
}

.app-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
  z-index: 1250;
}

.app-overlay.app-show {
  opacity: 1;
  visibility: visible;
}

/* ===============================
  MOBILE BEHAVIOR
================================ */
@media (max-width: 900px) {
  .app-mobile-top {
    display: flex;
  }

  .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    transform: translateX(-100%);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
  }

  .app-sidebar.app-open {
    transform: translateX(0);
  }

  .app-sidebar-close {
    display: flex;
  }

  .app-main {
    width: 100%;
    padding-top: 12px;
  }
}

@media (min-width: 901px) {
  .app-overlay {
    display: none;
  }

  .app-sidebar-close {
    display: none;
  }
}
