/* ─── Dashboard layout ─── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  background: var(--bg-elevated);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  gap: 24px;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--fg);
}

.brand-icon {
  color: var(--accent);
  font-size: 1.2rem;
}

.brand-name {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.topbar-nav {
  flex: 1;
  display: flex;
  gap: 4px;
}

.nav-item {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--fg-dim);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.nav-item.active {
  color: var(--fg);
  background: rgba(255,255,255,0.06);
}

.topbar-back {
  font-size: 0.8rem;
  color: var(--fg-muted);
  text-decoration: none;
  transition: color 0.15s;
}

.topbar-back:hover { color: var(--fg-dim); }

/* ─── Dash layout ─── */
.dash-layout {
  display: flex;
  min-height: calc(100vh - 56px);
}

.dash-sidebar {
  width: 240px;
  flex-shrink: 0;
  padding: 24px 16px;
  background: var(--bg-elevated);
  border-right: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.dash-main {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
}

/* ─── Sidebar ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--sans);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: #ea6b10;
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--fg-dim);
  border: 1px solid rgba(255,255,255,0.1);
}

.btn-ghost:hover {
  background: rgba(255,255,255,0.05);
  color: var(--fg);
}

.btn-danger {
  background: rgba(239,68,68,0.15);
  color: var(--red);
  border: 1px solid rgba(239,68,68,0.2);
}

.btn-danger:hover {
  background: rgba(239,68,68,0.25);
}

.btn-full { width: 100%; justify-content: center; }

.btn-upgrade {
  background: rgba(249,115,22,0.15);
  color: var(--accent);
  border: 1px solid rgba(249,115,22,0.3);
  font-size: 0.8rem;
}

.btn-upgrade:hover {
  background: rgba(249,115,22,0.25);
}

/* ─── Upgrade prompt ─── */
.upgrade-prompt {
  text-align: center;
  padding: 40px 20px;
}

.upgrade-icon {
  font-size: 3rem;
  color: var(--accent);
  margin-bottom: 20px;
}

.upgrade-prompt p {
  color: var(--fg-dim);
  margin-bottom: 12px;
  font-size: 1rem;
}

.upgrade-prompt p strong {
  color: var(--fg);
  font-weight: 700;
  font-size: 1.1rem;
}

.upgrade-sub {
  color: var(--fg-muted) !important;
  font-size: 0.85rem !important;
  margin-bottom: 24px !important;
}

.upgrade-cta {
  margin-top: 8px;
  padding: 14px 24px;
  font-size: 1rem;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--fg-muted);
  padding: 0 4px;
}

.channel-filters {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.filter-btn {
  padding: 8px 12px;
  background: transparent;
  border: none;
  color: var(--fg-dim);
  font-family: var(--sans);
  font-size: 0.875rem;
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}

.filter-btn:hover { background: rgba(255,255,255,0.04); color: var(--fg); }
.filter-btn.active { background: var(--accent-dim); color: var(--accent); font-weight: 600; }

.stat-mini {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.05);
}

.stat-mini-num {
  font-family: var(--mono);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
}

.stat-mini-label {
  font-size: 0.8rem;
  color: var(--fg-muted);
}

/* ─── Dash main ─── */
.dash-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 32px;
  gap: 16px;
}

.dash-title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.dash-sub {
  font-size: 0.9rem;
  color: var(--fg-dim);
}

.dash-search-wrap {
  flex-shrink: 0;
}

.dash-search {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  color: var(--fg);
  font-family: var(--sans);
  font-size: 0.875rem;
  width: 220px;
  outline: none;
  transition: border-color 0.15s;
}

.dash-search::placeholder { color: var(--fg-muted); }
.dash-search:focus { border-color: var(--accent); }

/* ─── Product grid ─── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.product-card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
}

.product-card:hover {
  border-color: rgba(249,115,22,0.3);
  transform: translateY(-2px);
}

.product-photo {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-muted);
  font-size: 2rem;
}

.product-photo img {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.product-info {
  padding: 20px;
}

.product-name {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}

.product-meta {
  font-size: 0.8rem;
  color: var(--fg-muted);
  margin-bottom: 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.meta-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.product-channels {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.ch-badge {
  font-family: var(--mono);
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 100px;
  font-weight: 500;
}

.ch-etsy   { background: rgba(241,100,30,0.15); color: #f1641e; border: 1px solid rgba(241,100,30,0.2); }
.ch-ebay   { background: rgba(14,118,168,0.15); color: #5ab4d8; border: 1px solid rgba(14,118,168,0.2); }
.ch-tiktok { background: rgba(255,0,80,0.12);   color: #ff6b8a; border: 1px solid rgba(255,0,80,0.15); }
.ch-facebook { background: rgba(66,103,178,0.15); color: #7a9fd4; border: 1px solid rgba(66,103,178,0.2); }
.ch-none   { background: rgba(255,255,255,0.04); color: var(--fg-muted); border: 1px solid rgba(255,255,255,0.06); }

.product-profit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.05);
}

.profit-label {
  font-size: 0.78rem;
  color: var(--fg-muted);
}

.profit-value {
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--green);
}

.profit-value.neg { color: var(--red); }

/* ─── Empty state ─── */
.empty-state {
  text-align: center;
  padding: 80px 24px;
}

.empty-icon {
  font-size: 3rem;
  color: var(--fg-muted);
  margin-bottom: 20px;
}

.empty-state h2 {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--fg-dim);
  margin-bottom: 24px;
}

/* ─── Modal ─── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: var(--bg-elevated);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  position: sticky;
  top: 0;
  background: var(--bg-elevated);
  z-index: 1;
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--fg-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 0.15s;
}

.modal-close:hover { color: var(--fg); }

.modal-body {
  padding: 24px 28px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 20px 28px 24px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

/* ─── Form ─── */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 0;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--fg-dim);
  letter-spacing: 0.02em;
}

.form-input {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--fg);
  font-family: var(--sans);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}

.form-input::placeholder { color: var(--fg-muted); }
.form-input:focus { border-color: var(--accent); }

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

select.form-input option { background: var(--bg-card); }

/* ─── Profit Calculator ─── */
.calc-section {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

.calc-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.calc-icon {
  width: 30px;
  height: 30px;
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

.calc-title {
  font-weight: 700;
  font-size: 0.95rem;
}

.profit-breakdown {
  border-top: 1px solid rgba(255,255,255,0.06);
  padding-top: 14px;
  margin-top: 4px;
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
}

.breakdown-row.sub {
  padding-left: 14px;
  border-left: 2px solid rgba(255,255,255,0.06);
  margin: 2px 0 2px 4px;
}

.breakdown-row.total {
  border-top: 1px solid rgba(255,255,255,0.08);
  margin-top: 8px;
  padding-top: 8px;
}

.breakdown-label {
  font-size: 0.82rem;
  color: var(--fg-muted);
}

.breakdown-row.sub .breakdown-label { font-size: 0.78rem; }
.breakdown-row.total .breakdown-label { font-weight: 600; color: var(--fg-dim); font-size: 0.85rem; }

.breakdown-val {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--fg-dim);
  font-weight: 500;
}

.breakdown-val.neg { color: var(--red); }
.breakdown-val.profit { color: var(--green); font-weight: 700; font-size: 0.95rem; }

.breakdown-group {
  padding: 4px 0;
  opacity: 0.7;
}

/* ─── Channel checkboxes ─── */
.channels-section {
  margin-bottom: 4px;
}

.channel-checkboxes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}

.channel-check {
  cursor: pointer;
}

.channel-check input { display: none; }

.channel-check-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s;
}

.channel-check:hover .channel-check-inner {
  border-color: rgba(255,255,255,0.15);
}

.channel-check input:checked + .channel-check-inner {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
}

.channel-check-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.etsy-dot     { background: #f1641e; }
.ebay-dot     { background: #5ab4d8; }
.tiktok-dot   { background: #ff6b8a; }
.facebook-dot { background: #7a9fd4; }

/* ─── Toast ─── */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 300;
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.25s;
}

.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { border-color: rgba(34,197,94,0.3); color: var(--green); }
.toast.error { border-color: rgba(239,68,68,0.3); color: var(--red); }

/* ─── Responsive ─── */
@media (max-width: 900px) {
  .dash-sidebar { width: 200px; padding: 16px 12px; }
  .dash-main { padding: 20px; }
}

@media (max-width: 700px) {
  .dash-layout { flex-direction: column; }
  .dash-sidebar { width: 100%; border-right: none; border-bottom: 1px solid rgba(255,255,255,0.06); padding: 16px; }
  .channel-filters { flex-direction: row; flex-wrap: wrap; }
  .filter-btn { padding: 6px 10px; font-size: 0.8rem; }
  .form-row { grid-template-columns: 1fr; }
  .channel-checkboxes { grid-template-columns: 1fr 1fr; }
  .dash-header { flex-direction: column; }
  .dash-search { width: 100%; }
  .product-grid { grid-template-columns: 1fr; }
}

/* ─── Channel Connections (sidebar) ─── */
.channel-connections {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.conn-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.06);
}

.conn-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  flex-shrink: 0;
  transition: background 0.2s;
}

.conn-dot.connected {
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34,197,94,0.5);
}

.conn-name {
  font-size: 0.85rem;
  color: var(--fg-dim);
  flex: 1;
}

.conn-seller {
  font-size: 0.75rem;
  color: var(--fg-muted);
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conn-btn {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.15s;
  white-space: nowrap;
  border: none;
}

.conn-btn:hover { opacity: 0.85; }

.conn-btn-disconnect {
  background: rgba(239,68,68,0.15);
  color: #f87171;
}

/* ─── Imported card badge ─── */
.ch-readonly {
  background: rgba(255,255,255,0.06);
  color: var(--fg-muted);
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
}

.ch-external-link {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--accent);
  text-decoration: none;
  margin-top: 6px;
}

.ch-external-link:hover { text-decoration: underline; }

.imported-card {
  opacity: 0.92;
  border-style: dashed;
}

/* ─── Nav item cursor ─── */
.nav-item[data-tab] { cursor: pointer; }
.nav-item[data-tab]:hover:not(.active) { color: var(--fg); }
}
