/* ══════════════════════════════════════════════════════════
   App Shell — Full-screen layout for user backend pages
   ══════════════════════════════════════════════════════════ */

:root {
  --aside-width:     240px;
  --aside-width-sm:   56px;
  --topbar-height:    56px;
}

body:has(.app-shell) {
  overflow: hidden;
  height: 100vh;
}

.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ══════════════════════════════════════════════════════════
   SIDEBAR
   ══════════════════════════════════════════════════════════ */

.app-sidebar {
  width: var(--aside-width);
  flex-shrink: 0;
  height: 100%;
  background: var(--bg-primary);
  border-right: var(--border-light);
  display: flex;
  flex-direction: column;
  transition: width 0.22s var(--motion-ease);
  overflow: hidden;
  z-index: 100;
}

.app-sidebar.is-collapsed {
  width: var(--aside-width-sm);
}

/* ── Sidebar Header (logo + toggle) ── */

.aside-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--topbar-height);
  padding: 0 var(--space-3);
  border-bottom: var(--border-light);
  flex-shrink: 0;
  gap: var(--space-2);
}

.aside-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: 1;
  min-width: 0;
  text-decoration: none;
  overflow: hidden;
}

.aside-logo-icon {
  width: 28px;
  height: 28px;
  background: var(--color-brand-500);
  color: white;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  flex-shrink: 0;
  text-decoration: none;
}

.aside-logo-name {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  transition: opacity 0.15s var(--motion-ease), width 0.22s var(--motion-ease);
}

.app-sidebar.is-collapsed .aside-logo-name {
  opacity: 0;
  width: 0;
  pointer-events: none;
}

.app-sidebar.is-collapsed .aside-header {
  justify-content: center;
  padding-inline: 0;
}

.app-sidebar.is-collapsed .aside-header .aside-logo {
  display: none;
}

.app-sidebar.is-collapsed .aside-header .aside-toggle {
  display: flex;
}

.aside-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-card);
  color: var(--text-muted);
  cursor: pointer;
  background: none;
  border: none;
  transition: background-color 0.15s, color 0.15s;
  flex-shrink: 0;
}

.aside-toggle:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* ── Sidebar Nav ── */

.aside-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--space-3) var(--space-2);
  display: flex;
  flex-direction: column;
  gap: 0;
}

.aside-nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.aside-section-title {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: var(--space-3) var(--space-2) var(--space-1);
  white-space: nowrap;
  overflow: hidden;
  transition: opacity 0.15s var(--motion-ease), height 0.22s var(--motion-ease), padding 0.22s var(--motion-ease);
}

.app-sidebar.is-collapsed .aside-section-title {
  opacity: 0;
  height: 0;
  padding-block: 0;
  pointer-events: none;
}

.aside-nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-card);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s, color 0.15s, padding 0.22s var(--motion-ease), justify-content 0.22s;
  position: relative;
}

.aside-nav-link:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.aside-nav-link.active {
  background: var(--color-brand-100);
  color: var(--color-brand-700);
  font-weight: var(--font-weight-semibold);
}

.aside-nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: inline-flex;
}

.aside-nav-icon svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.8;
}

.aside-label {
  white-space: nowrap;
  overflow: hidden;
  transition: opacity 0.12s var(--motion-ease);
}

.app-sidebar.is-collapsed .aside-label {
  opacity: 0;
  width: 0;
  pointer-events: none;
}

.app-sidebar.is-collapsed .aside-nav-link {
  justify-content: center;
  padding-inline: 0;
}

/* ── CTA button (Crea annuncio) ── */

.aside-cta {
  padding: var(--space-3) 0 var(--space-2);
}

.aside-cta-btn {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-card);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-brand-700);
  background: var(--color-brand-100);
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s, padding 0.22s var(--motion-ease);
  white-space: nowrap;
  overflow: hidden;
}

.aside-cta-btn:hover {
  background: var(--color-brand-200);
  color: var(--color-brand-700);
}

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

.app-sidebar.is-collapsed .aside-cta-btn {
  justify-content: center;
  padding-inline: 0;
  background: transparent;
  color: var(--color-brand-500);
}

.app-sidebar.is-collapsed .aside-cta-btn:hover {
  background: var(--color-brand-100);
}

/* ── Sidebar Bottom (user profile) ── */

.aside-bottom {
  flex-shrink: 0;
  border-top: var(--border-light);
  padding: var(--space-3) var(--space-2);
}

.aside-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-2);
  border-radius: var(--radius-card);
  overflow: hidden;
  transition: background-color 0.15s;
  text-decoration: none;
}

.aside-user:hover {
  background: var(--bg-tertiary);
}

.aside-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--color-brand-200);
}

.aside-avatar-fallback {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-brand-100);
  color: var(--color-brand-600);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  flex-shrink: 0;
  border: 2px solid var(--color-brand-200);
}

.aside-user-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  transition: opacity 0.12s var(--motion-ease);
}

.aside-user-name {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.aside-user-role {
  display: block;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.aside-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: var(--text-muted);
  border-radius: var(--radius-card);
  flex-shrink: 0;
  transition: color 0.15s, background-color 0.15s;
}

.aside-logout:hover {
  color: var(--color-danger-500);
  background: var(--color-danger-100);
}

.app-sidebar.is-collapsed .aside-user-info {
  opacity: 0;
  flex: none;
  width: 0;
  max-width: 0;
  overflow: hidden;
  pointer-events: none;
}

.app-sidebar.is-collapsed .aside-logout {
  opacity: 0;
  flex: none;
  width: 0;
  max-width: 0;
  overflow: hidden;
  pointer-events: none;
}

.app-sidebar.is-collapsed .aside-user {
  justify-content: center;
  padding-inline: 0;
  gap: 0;
}

.app-sidebar.is-collapsed .aside-bottom {
  padding-inline: 0;
}

/* ══════════════════════════════════════════════════════════
   APP MAIN
   ══════════════════════════════════════════════════════════ */

.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

/* ── Topbar ── */

.app-topbar {
  flex-shrink: 0;
  height: var(--topbar-height);
  background: var(--bg-primary);
  border-bottom: var(--border-light);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 0 var(--space-6);
}

.topbar-title {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.topbar-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-card);
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s, background-color 0.15s;
}

.topbar-action-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* ── App Content ── */

.app-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

/* ══════════════════════════════════════════════════════════
   DASHBOARD — KPI Cards
   ══════════════════════════════════════════════════════════ */

.dash-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
}

.dash-kpi-card {
  background: var(--bg-primary);
  border: var(--border-light);
  border-radius: var(--radius-card);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.kpi-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}

.kpi-info .kpi-label {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  font-weight: var(--font-weight-medium);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: var(--line-height-tight);
}

.kpi-info .kpi-value {
  font-size: 28px;
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  line-height: var(--line-height-tight);
  margin-top: var(--space-1);
}

.kpi-sparkline {
  width: 80px;
  height: 40px;
  flex-shrink: 0;
  opacity: 0.8;
}

.kpi-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.kpi-trend {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 2px;
}

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

.kpi-trend.down {
  color: var(--color-danger-500);
}

.kpi-link {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s;
}

.kpi-link:hover {
  color: var(--color-brand-500);
}

/* ══════════════════════════════════════════════════════════
   DASHBOARD — Charts row
   ══════════════════════════════════════════════════════════ */

.dash-charts {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: var(--space-4);
}

.dash-chart-card {
  background: var(--bg-primary);
  border: var(--border-light);
  border-radius: var(--radius-card);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.chart-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}

.chart-card-title {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.chart-card-value {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  margin-top: var(--space-1);
}

.chart-legend {
  display: flex;
  gap: var(--space-3);
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  align-items: center;
}

.chart-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}

.chart-period-select {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  border: var(--border-light);
  border-radius: var(--radius-button);
  padding: 4px var(--space-2);
  background: var(--bg-primary);
  cursor: pointer;
  transition: border-color 0.15s;
}

.chart-period-select:hover {
  border-color: var(--color-gray-400);
}

/* SVG line chart */
.mini-line-chart {
  height: 120px;
  width: 100%;
}

.mini-line-chart svg {
  width: 100%;
  height: 100%;
}

/* CSS bar chart */
.mini-bar-chart {
  height: 160px;
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 2px;
  height: 100%;
}

.bar-pair {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  flex: 1;
  width: 100%;
}

.bar-item {
  flex: 1;
  border-radius: 3px 3px 0 0;
  min-height: 4px;
  transition: opacity 0.15s;
}

.bar-item:hover {
  opacity: 0.75;
}

.bar-current {
  background: var(--color-gray-800);
}

.bar-prev {
  background: var(--color-gray-300);
}

.bar-x-label {
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
  padding-bottom: 2px;
}

/* ══════════════════════════════════════════════════════════
   DASHBOARD — Bottom row
   ══════════════════════════════════════════════════════════ */

.dash-bottom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.dash-section-card {
  background: var(--bg-primary);
  border: var(--border-light);
  border-radius: var(--radius-card);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dash-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: var(--border-light);
  flex-shrink: 0;
  gap: var(--space-3);
}

.dash-section-header h2 {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
}

/* ── Listing tabs ── */

.dash-listing-tabs {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-bottom: var(--border-light);
}

.dash-tab {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  border: none;
  background: none;
  transition: background-color 0.15s, color 0.15s;
}

.dash-tab:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.dash-tab.active {
  background: var(--color-gray-900);
  color: white;
}

.dash-tab-count {
  font-size: 10px;
  font-weight: var(--font-weight-regular);
  opacity: 0.65;
  margin-left: 3px;
}

/* ── Listing rows ── */

.dash-listing-row {
  display: grid;
  grid-template-columns: 64px 1fr auto auto;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-5);
  border-bottom: var(--border-light);
  transition: background-color 0.12s;
}

.dash-listing-row:last-child {
  border-bottom: none;
}

.dash-listing-row:hover {
  background: var(--bg-secondary);
}

.dash-listing-thumb {
  width: 64px;
  height: 48px;
  border-radius: var(--radius-card);
  overflow: hidden;
  background: var(--bg-tertiary);
  flex-shrink: 0;
}

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

.dash-listing-thumb-empty {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-gray-400);
}

.dash-listing-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.dash-listing-name {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 50ch;
}

.dash-listing-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.dash-listing-price {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  line-height: var(--line-height-tight);
}

.dash-listing-meta {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.dash-listing-status {
  font-size: 11px;
  font-weight: var(--font-weight-medium);
  color: var(--color-success-600);
  display: flex;
  align-items: center;
  gap: 3px;
}

.dash-listing-status--inactive {
  color: var(--text-muted);
}

.dash-listing-views {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin-top: 4px;
}

.dash-listing-views-new {
  font-size: var(--font-size-xs);
  color: var(--color-success-600);
  font-weight: var(--font-weight-medium);
}

.dash-listing-edit-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: var(--radius-button);
  border: var(--border-light);
  background: var(--bg-primary);
  transition: border-color 0.15s, color 0.15s;
  white-space: nowrap;
}

.dash-listing-edit-btn:hover {
  border-color: var(--color-brand-500);
  color: var(--color-brand-600);
}

.dash-new-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  background: var(--color-gray-900);
  color: white;
  padding: 6px 12px;
  border-radius: var(--radius-button);
  text-decoration: none;
  transition: background-color 0.15s;
  white-space: nowrap;
}

.dash-new-btn:hover {
  background: var(--color-gray-700);
  color: white;
}

/* ── Reputation summary ── */

.dash-rep-summary {
  padding: var(--space-4) var(--space-5);
}

.dash-rep-score {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  line-height: var(--line-height-tight);
  margin: 0;
}

.dash-rep-stars {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: var(--space-2);
}

.dash-rep-stars svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.dash-rep-count {
  margin: var(--space-2) 0 0;
  font-size: var(--font-size-sm);
  color: var(--text-muted);
}

/* ── Reputation rows ── */

.dash-rep-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.dash-rep-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-5);
  border-bottom: var(--border-light);
}

.dash-rep-row:last-child {
  border-bottom: none;
}

.dash-rep-label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-primary);
  margin-bottom: var(--space-1);
  white-space: nowrap;
}

.dash-rep-bar-track {
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.dash-rep-bar {
  width: 100%;
  height: 4px;
  border: none;
  border-radius: var(--radius-pill);
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
}

.dash-rep-bar::-webkit-progress-bar {
  background: transparent;
}

.dash-rep-bar::-webkit-progress-value {
  background: var(--color-gray-800);
  border-radius: var(--radius-pill);
  transition: width 0.4s var(--motion-ease);
}

.dash-rep-bar::-moz-progress-bar {
  background: var(--color-gray-800);
  border-radius: var(--radius-pill);
}

.dash-rep-pct {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  min-width: 42px;
  text-align: right;
}

/* ══════════════════════════════════════════════════════════
   LIVE BADGE
   ══════════════════════════════════════════════════════════ */

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--color-danger-600);
  background: var(--color-danger-100);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

.live-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-danger-500);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ══════════════════════════════════════════════════════════
   EMPTY STATES
   ══════════════════════════════════════════════════════════ */

.dash-empty {
  padding: var(--space-8) var(--space-5);
  text-align: center;
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════ */

@media (max-width: 1200px) {
  .dash-kpis {
    grid-template-columns: repeat(2, 1fr);
  }

  .dash-charts,
  .dash-bottom {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 960px) {
  .app-sidebar {
    width: var(--aside-width-sm);
  }

  .app-sidebar .aside-logo-name,
  .app-sidebar .aside-label,
  .app-sidebar .aside-section-title,
  .app-sidebar .aside-user-info,
  .app-sidebar .aside-logout {
    opacity: 0;
    width: 0;
    pointer-events: none;
  }

  .app-sidebar .aside-nav-link,
  .app-sidebar .aside-cta-btn {
    justify-content: center;
    padding-inline: 0;
  }

  .app-sidebar .aside-user {
    justify-content: center;
    padding-inline: 0;
  }

  .app-sidebar .aside-cta-btn {
    background: transparent;
    color: var(--color-brand-500);
  }

  .app-sidebar.is-expanded {
    width: var(--aside-width);
  }

  .app-sidebar.is-expanded .aside-logo-name,
  .app-sidebar.is-expanded .aside-label,
  .app-sidebar.is-expanded .aside-section-title,
  .app-sidebar.is-expanded .aside-user-info,
  .app-sidebar.is-expanded .aside-logout {
    opacity: 1;
    width: auto;
    pointer-events: auto;
  }

  .app-sidebar.is-expanded .aside-nav-link,
  .app-sidebar.is-expanded .aside-cta-btn {
    justify-content: flex-start;
    padding-inline: var(--space-3);
  }

  .app-sidebar.is-expanded .aside-user {
    justify-content: flex-start;
    padding-inline: var(--space-2);
  }

  .app-sidebar.is-expanded .aside-cta-btn {
    background: var(--color-brand-100);
    color: var(--color-brand-700);
  }
}

@media (max-width: 600px) {
  .dash-kpis {
    grid-template-columns: 1fr 1fr;
  }

  .app-content {
    padding: var(--space-4);
  }

  .app-topbar {
    padding: 0 var(--space-4);
  }
}

/* ══════════════════════════════════════════════════════════
   PAGE HEADER (shared across backend pages)
   ══════════════════════════════════════════════════════════ */

.page-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.page-title {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  line-height: var(--line-height-tight);
}

.page-subtitle {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
}

/* ══════════════════════════════════════════════════════════
   PROFILE PAGE
   ══════════════════════════════════════════════════════════ */

.profile-page-card {
    background: var(--bg-primary);
    border: var(--border-light);
    border-radius: var(--radius-card);
    overflow: visible;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto var(--space-7);
}

/* ── Avatar upload zone ── */

.profile-avatar-zone {
    display: flex;
    align-items: center;
    gap: var(--space-6);
    padding: var(--space-6);
    border-bottom: var(--border-light);
}

.profile-avatar-zone > label[for="fileUpload"] {
  display: block;
  flex-shrink: 0;
  width: 80px;
  cursor: pointer;
}

.profile-avatar-preview {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--color-brand-200);
  display: block;
  transition: opacity 0.15s;
}

.profile-avatar-preview:hover {
  opacity: 0.82;
}

.profile-avatar-fallback-lg {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--color-brand-100);
  color: var(--color-brand-600);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  border: 3px solid var(--color-brand-200);
  cursor: pointer;
  transition: opacity 0.15s;
}

.profile-avatar-fallback-lg:hover {
  opacity: 0.82;
}

.profile-upload-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.profile-upload-title {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
}

.profile-upload-desc {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  line-height: var(--line-height-normal);
}

.profile-upload-hint {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.profile-upload-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: nowrap;
  margin-top: var(--space-3);
}

.profile-upload-actions .btn {
  white-space: nowrap;
  flex-shrink: 0;
}

.profile-upload-status {
  font-size: var(--font-size-xs);
  margin-top: var(--space-1);
  min-height: 18px;
  line-height: var(--line-height-normal);
}

.profile-upload-status.is-success { color: var(--color-secondary-600, #5a9e32); }
.profile-upload-status.is-error   { color: var(--color-danger-500, #ef4444); }
.profile-upload-status.is-info    { color: var(--color-brand-600); }

/* ── Profile form ── */

.profile-form {
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
}

.form-hint {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  line-height: var(--line-height-normal);
}

.form-validation-msg {
  font-size: var(--font-size-xs);
  color: var(--color-danger-500, #ef4444);
  display: none;
  line-height: var(--line-height-normal);
}

.form-submit-row {
  display: flex;
  justify-content: flex-end;
  padding-top: var(--space-5);
  border-top: var(--border-light);
  margin-top: var(--space-1);
}

/* disabled inputs within forms */
.profile-form .input:disabled {
  background: var(--bg-secondary);
  color: var(--text-muted);
  cursor: default;
  opacity: 1;
}

/* hide native file input while keeping it accessible */
.hidden-input {
  display: none;
}

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

  .profile-avatar-zone {
    flex-wrap: wrap;
    gap: var(--space-4);
  }
}

/* ══════════════════════════════════════════════════════════
   TOPBAR MOBILE MENU BUTTON
   ══════════════════════════════════════════════════════════ */

.topbar-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-card);
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.15s, background-color 0.15s;
  flex-shrink: 0;
}

.topbar-menu-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

@media (max-width: 960px) {
  .topbar-menu-btn {
    display: flex;
  }
}

/* Show topbar menu button on desktop when sidebar is collapsed */
.app-sidebar.is-collapsed ~ .app-main .topbar-menu-btn {
  display: flex;
}

/* ══════════════════════════════════════════════════════════
   USER LISTINGS PAGE
   ══════════════════════════════════════════════════════════ */

/* Page header row — title + CTA aligned */
.page-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}

/* Limit warning infobox */
.listing-limit-infobox {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  background: var(--color-warning-100, #FFF6E6);
  border: 1px solid var(--color-warning-300, #FFD58C);
  border-radius: var(--radius-card);
  padding: var(--space-4) var(--space-5);
  font-size: var(--font-size-sm);
  color: var(--color-warning-700, #A66704);
  line-height: var(--line-height-normal);
}

.listing-limit-infobox__icon {
  flex-shrink: 0;
  display: inline-flex;
  margin-top: 1px;
  color: var(--color-warning-600, #D48706);
}

/* Listings grid */
.ulisting-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
}

/* Listing card */
.ulisting-card {
  background: var(--bg-primary);
  border: var(--border-light);
  border-radius: var(--radius-card);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: box-shadow 0.18s, border-color 0.18s;
}

.ulisting-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  border-color: var(--color-gray-400);
}

/* Card media */
.ulisting-card-media {
  aspect-ratio: 16 / 9;
  background: var(--bg-tertiary);
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
}

.ulisting-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.22s var(--motion-ease);
}

.ulisting-card:hover .ulisting-card-media img {
  transform: scale(1.03);
}

.ulisting-card-media-empty {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-gray-300);
}

/* Status badge overlay on image */
.ulisting-status-overlay {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
}

/* Card body */
.ulisting-card-body {
  padding: var(--space-4);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.ulisting-card-title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  line-height: var(--line-height-tight);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Meta tags */
.ulisting-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  align-items: center;
}

.ulisting-tag {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  font-weight: var(--font-weight-medium);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: var(--border-light);
  line-height: var(--line-height-tight);
}

/* Status badges */
.ulisting-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: var(--font-weight-semibold);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.ulisting-badge::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.ulisting-badge--active {
  background: var(--color-success-100);
  color: var(--color-success-700);
}

.ulisting-badge--active::before {
  background: var(--color-success-500);
}

.ulisting-badge--inactive {
  background: var(--bg-secondary);
  color: var(--text-muted);
}

.ulisting-badge--inactive::before {
  background: var(--color-gray-400);
}

.ulisting-badge--draft {
  background: var(--color-warning-100, #fef3c7);
  color: var(--color-warning-700, #92400e);
}

.ulisting-badge--draft::before {
  background: var(--color-warning-500, #f59e0b);
}

/* Price */
.ulisting-card-price {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  line-height: var(--line-height-tight);
  margin-top: auto;
}

.ulisting-card-price-trade {
  font-size: var(--font-size-sm);
  color: var(--color-brand-600);
  font-weight: var(--font-weight-medium);
}

/* Card footer */
.ulisting-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-top: var(--border-light);
  gap: var(--space-2);
  flex-shrink: 0;
}

.ulisting-card-stats {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.ulisting-stat {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

/* Action icon buttons */
.ulisting-card-actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-shrink: 0;
}

.ulisting-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-card);
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.15s, background-color 0.15s;
  text-decoration: none;
  flex-shrink: 0;
}

.ulisting-icon-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.ulisting-icon-btn.is-danger:hover {
  background: var(--color-danger-100);
  color: var(--color-danger-500);
}

/* Empty state */
.ulisting-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-10) var(--space-5);
  text-align: center;
  gap: var(--space-4);
}

.ulisting-empty-icon {
  width: 48px;
  height: 48px;
  color: var(--color-gray-300);
}

.ulisting-empty-title {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  color: var(--text-secondary);
}

.ulisting-empty-desc {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  max-width: 360px;
}

/* ══════════════════════════════════════════════════════════
   MODAL (shared — delete / confirm modals on backend pages)
   ══════════════════════════════════════════════════════════ */

.ds-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.ds-modal {
  background: var(--bg-primary);
  border: var(--border-light);
  border-radius: var(--radius-card);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ds-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-5) var(--space-4);
  border-bottom: var(--border-light);
  gap: var(--space-3);
}

.ds-modal-title {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
}

.ds-modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-card);
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.15s, background-color 0.15s;
  flex-shrink: 0;
}

.ds-modal-close:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.ds-modal-body {
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.ds-modal-text {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  line-height: var(--line-height-normal);
}

.ds-modal-warning {
  font-size: var(--font-size-xs);
  color: var(--color-danger-600);
  font-weight: var(--font-weight-medium);
}

.ds-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-top: var(--border-light);
}

/* Wide modal variant for long content */
.ds-modal--wide {
  max-width: 680px;
}

.ds-modal-body--scroll {
  max-height: 60vh;
  overflow-y: auto;
  font-size: var(--font-size-sm);
  line-height: var(--line-height-relaxed);
}

.ds-modal-body--scroll h4 {
  margin: var(--space-5) 0 var(--space-2);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
}

.ds-modal-body--scroll h4:first-child {
  margin-top: 0;
}

.ds-modal-body--scroll p {
  margin: 0 0 var(--space-3);
  color: var(--text-secondary);
}

.ds-modal-body--scroll a {
  color: var(--color-brand-500);
  text-decoration: none;
}

.ds-modal-body--scroll a:hover {
  text-decoration: underline;
}

/* Publishing rules acceptance checkbox */
.publishing-rules-accept {
  width: 100%;
  margin-bottom: var(--space-4);
}

.publishing-rules-accept .checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  cursor: pointer;
}

.publishing-rules-accept .checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: var(--color-brand-500);
}

.publishing-rules-accept .validation {
  display: none;
  font-size: 12px;
  color: var(--color-danger-500);
  margin-top: var(--space-1);
}

.publishing-rules-accept .validation:not(:empty) {
  display: block;
}

.publishing-rules-accept .link-primary {
  color: var(--color-brand-500);
  text-decoration: none;
  font-weight: var(--font-weight-medium);
}

.publishing-rules-accept .link-primary:hover {
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
  .ulisting-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
}

@media (max-width: 480px) {
  .ulisting-grid {
    grid-template-columns: 1fr;
  }

  .page-header-row {
    flex-direction: column;
    align-items: stretch;
  }

  .page-header-row .btn {
    width: 100%;
    justify-content: center;
  }
}
