/* ============================================================
   VIEWS — View-specific styles
   ============================================================ */

/* ── Login View ── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #071626 0%, #0d2a47 50%, #071626 100%);
  padding: var(--space-6);
}

.login-card {
  background: var(--color-bg-content);
  border-radius: var(--radius-2xl);
  padding: var(--space-8);
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-xl);
}

.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
  text-align: center;
}

.login-logo img,
.login-logo svg {
  width: 48px;
  height: 48px;
}

.login-logo-name {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
  letter-spacing: -0.5px;
}

.login-logo-sub {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

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

.login-error {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fecaca;
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  font-size: var(--font-size-sm);
  display: none;
}

.login-error.visible {
  display: block;
}

.login-submit {
  margin-top: var(--space-2);
}

.login-footer {
  margin-top: var(--space-6);
  text-align: center;
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
}

.login-demo-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  border: none;
  background: none;
  font-family: var(--font-family);
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  cursor: pointer;
  padding: 0;
}

.login-demo-toggle svg { transition: transform 200ms ease; }
.login-demo-toggle.open svg { transform: rotate(180deg); }

.login-demo-accounts {
  margin-top: var(--space-3);
  text-align: left;
}

.login-demo-hint {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
  text-align: center;
}

.login-demo-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.login-demo-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: none;
  font-family: var(--font-family);
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background var(--transition-base);
}

.login-demo-item:hover { background: var(--color-bg-panel); }

.login-demo-avatar {
  width: 28px; height: 28px;
  border-radius: var(--radius-full);
  background: var(--color-primary-dark);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  flex-shrink: 0;
}

.login-demo-user-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.login-demo-name {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-primary);
}

.login-demo-company {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
}

.login-demo-role {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

/* ── Dashboard ── */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

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

.dash-deal-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.dash-deal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border);
}

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

.dash-deal-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.dash-deal-item {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-deal-buyer {
  font-size: 11px;
  color: var(--color-text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-deal-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.dash-deal-amount {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.dash-deal-time {
  font-size: 11px;
  color: var(--color-text-tertiary);
  white-space: nowrap;
}

.action-required-card {
  background: linear-gradient(135deg, var(--color-primary-dark), #0d2a47);
  color: white;
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  grid-column: span 4;
}

.action-required-count {
  font-size: 48px;
  font-weight: var(--font-weight-bold);
  color: var(--color-accent);
  line-height: 1;
  flex-shrink: 0;
}

.action-required-text h3 {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--space-1);
}

.action-required-text p {
  font-size: var(--font-size-sm);
  color: rgba(255,255,255,0.7);
}

.dashboard-main {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-4);
}

.dashboard-main > div {
    min-width: 0;
}
/* ── Inventory List ── */
.inventory-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

.view-toggle {
  display: flex;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.view-toggle-btn {
  padding: var(--space-2) var(--space-3);
  border: none;
  background: var(--color-bg-content);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition-base);
  font-size: var(--font-size-sm);
  font-family: var(--font-family);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.view-toggle-btn svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
}

.view-toggle-btn.active {
  background: var(--color-primary-dark);
  color: white;
}

.bulk-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--color-accent-light);
  border: 1px solid rgba(255, 120, 71, 0.2);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-3);
  animation: slideDown var(--transition-base);
}

@keyframes slideDown {
  from { transform: translateY(-8px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.bulk-count {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-accent);
  flex: 1;
}

/* ── Item Thumbnail ── */
.item-thumb {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-md);
  object-fit: cover;
  background: var(--color-bg-panel);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

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

.item-thumb svg {
  width: 20px;
  height: 20px;
  stroke: var(--color-text-tertiary);
  fill: none;
  stroke-width: 1.5;
}

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

.item-card {
  background: var(--color-bg-content);
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border);
  overflow: hidden;
  transition: box-shadow var(--transition-base), transform var(--transition-base);
  cursor: pointer;
}

.item-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.item-card-image {
  aspect-ratio: 16/9;
  background: var(--color-bg-panel);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.item-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.item-card-image svg {
  width: 48px;
  height: 48px;
  stroke: var(--color-border-hover);
  fill: none;
  stroke-width: 1.25;
}

/* ── Card image carousel ── */
.card-img-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(255,120,71,0.75);
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  opacity: 0;
  transition: opacity var(--transition-fast), background var(--transition-fast);
  z-index: 2;
}
.card-img-arrow svg {
  width: 14px; height: 14px;
  stroke: #fff; fill: none; stroke-width: 2.5;
  pointer-events: none;
}
.card-img-prev { left: 6px; }
.card-img-next { right: 6px; }
.card-img-arrow:hover { background: rgba(255,120,71,1); }
.item-card-image:hover .card-img-arrow { opacity: 1; }

.card-img-dots {
  position: absolute;
  bottom: 7px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 5px;
  z-index: 2;
}
.card-img-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,0.45);
  transition: background var(--transition-fast), transform var(--transition-fast);
}
.card-img-dot.active {
  background: #ff7847;
  transform: scale(1.25);
}

.item-card-body {
  padding: var(--space-4);
}

.item-card-title {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  line-height: 1.4;
  margin-bottom: var(--space-1);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.item-card-meta {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-3);
}

.item-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.item-price {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
}

.item-card-actions {
  display: flex;
  gap: var(--space-1);
}

/* ── Deal Thread ── */
.deal-thread-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--space-4);
  height: calc(100vh - var(--header-height) - 48px);
}

.chat-area {
  display: flex;
  flex-direction: column;
  background: var(--color-bg-content);
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border);
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.chat-bubble {
  max-width: 70%;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-xl);
  font-size: var(--font-size-base);
  line-height: 1.5;
}

.chat-bubble.buyer {
  align-self: flex-start;
  background: var(--color-bg-panel);
  color: var(--color-text-primary);
  border-bottom-left-radius: var(--radius-sm);
}

.chat-bubble.admin {
  align-self: flex-end;
  background: var(--color-primary-dark);
  color: white;
  border-bottom-right-radius: var(--radius-sm);
}

.chat-bubble.offer-card {
  background: #dbeafe;
  color: var(--color-text-primary);
  max-width: 85%;
  align-self: flex-start;
}

.offer-card-amount {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: #1d4ed8;
}

.chat-input-area {
  border-top: 1px solid var(--color-border);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.canned-responses {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.canned-btn {
  padding: 4px var(--space-3);
  border: 1px solid var(--color-border);
  background: var(--color-bg-panel);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-family: var(--font-family);
  cursor: pointer;
  color: var(--color-text-secondary);
  transition: all var(--transition-base);
}

.canned-btn:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: var(--color-accent-light);
}

.deal-context-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  overflow-y: auto;
}

/* ── Promotions Wizard ── */
.wizard-steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: var(--space-8);
}

.wizard-step {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: 1;
}

.wizard-step-num {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--color-bg-panel);
  border: 2px solid var(--color-border);
  color: var(--color-text-tertiary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.wizard-step.done .wizard-step-num {
  background: var(--color-status-sold);
  border-color: var(--color-status-sold);
  color: white;
}

.wizard-step.active .wizard-step-num {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: white;
}

.wizard-step-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.wizard-step.active .wizard-step-label {
  color: var(--color-text-primary);
  font-weight: var(--font-weight-medium);
}

.wizard-divider {
  flex: 1;
  height: 1px;
  background: var(--color-border);
  margin: 0 var(--space-2);
}

/* ── Reports / Charts ── */
.chart-bar {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.chart-bar-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.chart-bar-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  width: 160px;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chart-bar-track {
  flex: 1;
  height: 8px;
  background: var(--color-bg-panel);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.chart-bar-fill {
  height: 100%;
  background: var(--color-accent);
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

.chart-bar-value {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  width: 50px;
  text-align: right;
  flex-shrink: 0;
}

/* ── Promotions Wizard ── */

.promo-wizard {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.promo-wizard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) 0 var(--space-6);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-6);
}

.promo-steps {
  display: flex;
  align-items: center;
  gap: 0;
}

.promo-step {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.promo-step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  background: var(--color-bg-content);
  color: var(--color-text-tertiary);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color 200ms, background 200ms, color 200ms;
}

.promo-step.active .promo-step-dot {
  border-color: var(--color-accent);
  background: var(--color-accent);
  color: #fff;
}

.promo-step.done .promo-step-dot {
  border-color: var(--color-accent);
  background: var(--color-accent);
  color: #fff;
}

.promo-step-label {
  font-size: 13px;
  color: var(--color-text-tertiary);
  font-weight: 500;
  white-space: nowrap;
}

.promo-step.active .promo-step-label {
  color: var(--color-text-primary);
  font-weight: 600;
}

.promo-step.done .promo-step-label {
  color: var(--color-accent);
}

.promo-step-connector {
  width: 40px;
  height: 2px;
  background: var(--color-border);
  margin: 0 var(--space-2);
  flex-shrink: 0;
}

.promo-wizard-body {
  min-height: 420px;
}

.promo-wizard-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) 0 var(--space-4);
  border-top: 1px solid var(--color-border);
  margin-top: var(--space-6);
}

/* Step shared */
.promo-step-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-1);
}

.promo-step-desc {
  font-size: var(--font-size-sm);
  color: var(--color-text-tertiary);
  margin-bottom: var(--space-5);
}

/* Step 1 — Item selection */
.promo-step-items {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.promo-canned-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.promo-category-select-wrap select {
  height: 32px;
  padding: 0 var(--space-3);
  font-size: 13px;
}

.promo-filter-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.promo-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: color-mix(in srgb, var(--color-accent) 10%, var(--color-bg-content));
  border: 1px solid color-mix(in srgb, var(--color-accent) 30%, transparent);
  border-radius: var(--radius-full);
  font-size: 11px;
  color: var(--color-accent);
  font-weight: 500;
}

.promo-filter-pill-selection {
  background: color-mix(in srgb, var(--color-status-sold) 10%, var(--color-bg-content));
  border-color: color-mix(in srgb, var(--color-status-sold) 30%, transparent);
  color: var(--color-status-sold);
}

.promo-filter-clear {
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  opacity: 0.7;
}

.promo-filter-clear:hover { opacity: 1; }

.promo-item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  max-height: 400px;
  overflow-y: auto;
  padding-right: 2px;
}

.promo-item-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  background: var(--color-bg-content);
  transition: border-color 150ms, box-shadow 150ms;
  position: relative;
}

.promo-item-card:hover {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent) 12%, transparent);
}

.promo-item-card.selected {
  border-color: var(--color-accent);
  background: color-mix(in srgb, var(--color-accent) 6%, var(--color-bg-content));
}

.promo-item-thumb {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--color-bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
}

.promo-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.promo-item-thumb svg {
  width: 20px;
  height: 20px;
  stroke: var(--color-text-tertiary);
  fill: none;
  stroke-width: 1.5;
}

.promo-item-info {
  flex: 1;
  min-width: 0;
}

.promo-item-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-primary);
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.promo-item-meta {
  font-size: 11px;
  color: var(--color-text-tertiary);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.promo-item-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 150ms, border-color 150ms;
}

.promo-item-check svg {
  opacity: 0;
  transition: opacity 150ms;
  stroke: #fff;
}

.promo-item-card.selected .promo-item-check {
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.promo-item-card.selected .promo-item-check svg {
  opacity: 1;
}

.promo-selection-tray {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-bg-subtle);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  flex-wrap: wrap;
}

.promo-tray-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-accent);
  white-space: nowrap;
  padding-top: 2px;
}

.promo-tray-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  flex: 1;
}

.promo-tray-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: var(--color-bg-content);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  font-size: 11px;
  color: var(--color-text-secondary);
}

.promo-tray-remove {
  cursor: pointer;
  color: var(--color-text-tertiary);
  font-size: 14px;
  line-height: 1;
}

.promo-tray-remove:hover { color: var(--color-danger); }

/* Step 2 — Compose */
.promo-step-compose {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
  align-items: start;
}

.promo-compose-form {
  display: flex;
  flex-direction: column;
}

.promo-subject-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-3);
  margin-bottom: var(--space-5);
}

.promo-suggestion-chip {
  display: inline-block;
  padding: 6px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-bg-subtle);
  font-size: 11px;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: border-color 120ms, color 120ms, background 120ms;
  text-align: left;
}

.promo-suggestion-chip:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: color-mix(in srgb, var(--color-accent) 6%, var(--color-bg-content));
}

.promo-send-row-items {
  align-items: flex-start;
}

.promo-send-items-list {
  margin: var(--space-2) 0 0 0;
  padding-left: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.promo-send-items-list li {
  font-size: 13px;
  color: var(--color-text-primary);
}

.promo-compose-meta {
  display: flex;
  gap: var(--space-2);
  font-size: 12px;
  color: var(--color-text-tertiary);
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
}

/* Step 3 — Send */
.promo-step-send {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
  align-items: start;
}

.promo-send-details {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.promo-send-row {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  font-size: 13px;
}

.promo-send-row:last-child { border-bottom: none; }

.promo-send-label {
  font-weight: 600;
  color: var(--color-text-secondary);
  width: 90px;
  flex-shrink: 0;
  font-size: 12px;
}

.promo-send-value {
  color: var(--color-text-primary);
  flex: 1;
}

/* Success screen */
.promo-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-12) var(--space-6);
  min-height: 360px;
}

.promo-success-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--color-accent) 15%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-5);
  stroke: var(--color-accent);
}

/* Preview pane */
.promo-preview-pane {
  position: sticky;
  top: var(--space-4);
}

.promo-email-preview {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: #f5f5f5;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.promo-email-chrome {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: #e8e8e8;
  border-bottom: 1px solid var(--color-border);
}

.promo-email-chrome-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #d0d0d0;
}

.promo-email-chrome-label {
  font-size: 11px;
  color: #999;
  margin-left: auto;
  letter-spacing: .04em;
}

.promo-email-meta {
  padding: var(--space-3) var(--space-4);
  background: #fafafa;
  border-bottom: 1px solid var(--color-border);
  font-size: 11px;
  color: #666;
}

.promo-email-meta-row {
  padding: 2px 0;
}

.promo-email-meta-row span {
  font-weight: 600;
  color: #444;
  margin-right: 4px;
}

.promo-email-subject-line {
  font-weight: 600;
  color: #222 !important;
  font-size: 12px;
}

.promo-email-body {
  padding: var(--space-5) var(--space-5) var(--space-4);
  background: #fff;
  max-height: 480px;
  overflow-y: auto;
}

.promo-email-masthead {
  font-size: 16px;
  font-weight: 700;
  color: #111;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 2px solid #111;
}

.promo-email-intro {
  font-size: 13px;
  color: #444;
  line-height: 1.6;
  margin-bottom: var(--space-4);
}

.promo-email-items {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.promo-email-item {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid #e8e8e8;
  border-radius: 6px;
}

.promo-email-item-img {
  width: 60px;
  height: 60px;
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.promo-email-item-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.promo-email-item-img svg {
  width: 24px;
  height: 24px;
  stroke: #ccc;
  fill: none;
  stroke-width: 1.5;
}

.promo-email-item-body {
  flex: 1;
  min-width: 0;
}

.promo-email-item-name {
  font-size: 12px;
  font-weight: 600;
  color: #111;
  line-height: 1.3;
  margin-bottom: 2px;
}

.promo-email-item-mfr {
  font-size: 11px;
  color: #888;
  margin-bottom: 4px;
}

.promo-email-item-price {
  font-size: 13px;
  font-weight: 700;
  color: #111;
  margin-bottom: var(--space-2);
}

.promo-email-item-cta {
  display: inline-block;
  font-size: 11px;
  color: #0066cc;
  text-decoration: none;
  font-weight: 600;
}

.promo-email-footer {
  font-size: 10px;
  color: #aaa;
  text-align: center;
  padding-top: var(--space-3);
  border-top: 1px solid #eee;
  line-height: 1.5;
}

/* Responsive */
@media (max-width: 900px) {
  .promo-step-compose,
  .promo-step-send {
    grid-template-columns: 1fr;
  }
  .promo-preview-pane {
    position: static;
  }
}

@media (max-width: 600px) {
  .promo-wizard-header {
    flex-direction: column;
    gap: var(--space-4);
    align-items: flex-start;
  }
  .promo-step-connector { width: 24px; }
  .promo-step-label { display: none; }
  .promo-step.active .promo-step-label { display: inline; }
  .promo-item-grid { grid-template-columns: 1fr; max-height: 320px; }
}

/* ── Operations ── */
.ops-section {
  background: var(--color-bg-content);
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border);
}

.template-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--color-border);
}

.template-item:last-child {
  border-bottom: none;
}

.template-name {
  flex: 1;
  font-weight: var(--font-weight-medium);
}

.template-meta {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
}

/* ── Activity Feed ── */
.activity-feed {
  display: flex;
  flex-direction: column;
}

.activity-item {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border);
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--color-bg-panel);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.activity-icon svg {
  width: 15px;
  height: 15px;
  stroke: var(--color-text-secondary);
  fill: none;
  stroke-width: 1.75;
}

.activity-text {
  flex: 1;
  font-size: var(--font-size-sm);
  min-width: 0;
  overflow-wrap: break-word;
}

.activity-time {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  flex-shrink: 0;
}

/* ── Responsive overrides for views ── */
@media (max-width: 1024px) {
  .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
  .action-required-card { grid-column: span 2; }
  .dashboard-main { grid-template-columns: 1fr; }
  .dash-kpi-row { grid-template-columns: repeat(2, 1fr); }
  .deals-stats-row { gap: var(--space-3); }
  .deals-stat-card { min-width: 160px; padding: var(--space-4) var(--space-5); }
  .deals-stat-num { font-size: 30px; }
  /* Deal thread: stack panels at tablet */
  .dt-layout {
    flex-direction: column;
    height: auto;
    min-height: 0;
  }
  .dt-chat-panel {
    height: 70vh;
    min-height: 420px;
  }
  .dt-context-panel {
    width: 100%;
    max-height: none;
    overflow-y: visible;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: var(--space-3);
    align-items: start;
  }
}

@media (max-width: 768px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .action-required-card { grid-column: span 1; }
  .dash-kpi-row { grid-template-columns: 1fr; }
  .login-card { padding: var(--space-6); }
  .deals-stats-row { flex-direction: column; align-items: stretch; }
  .deals-stat-card { min-width: 0; flex-direction: row; align-items: center; gap: var(--space-4); }
  .deals-stat-main { flex: 1; }
  .deals-stat-subordinate { margin-left: 0; max-width: none; }
  /* Deal thread: single column, context stacks as cards */
  .dt-chat-panel { height: 60vh; min-height: 360px; }
  .dt-context-panel { grid-template-columns: 1fr; }
  .dt-actions-row { flex-wrap: wrap; gap: var(--space-2); }
}

/* ============================================================
   INVENTORY LIST VIEW
   ============================================================ */

/* ── Search row ── */
.inv-search-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

/* ── Filter bar ── */
.inv-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.filter-chip-wrap {
  position: relative;
}

/* Shared height/style for all filter controls */
.filter-chip-input {
  height: 34px;
  padding: 0 var(--space-3);
  background: var(--color-bg-content);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  font-size: var(--font-size-sm);
  font-family: var(--font-family);
  color: var(--color-text-primary);
  outline: none;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
  min-width: 120px;
}

.filter-chip-input::placeholder { color: var(--color-text-tertiary); }

.filter-chip-input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-light);
}

.filter-chip-input.filter-active {
  border-color: var(--color-accent);
}

.filter-chip-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
  cursor: pointer;
}

/* Multi-select toggle button */
.filter-chip-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: 34px;
  padding: 0 var(--space-3);
  background: var(--color-bg-content);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  font-size: var(--font-size-sm);
  font-family: var(--font-family);
  color: var(--color-text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color var(--transition-base), color var(--transition-base);
}

.filter-chip-btn:hover {
  border-color: var(--color-border-hover);
  color: var(--color-text-primary);
}

.filter-chip-btn.filter-active {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

/* Typeahead + multi-select shared dropdown */
.typeahead-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 200px;
  background: var(--color-bg-content);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  z-index: 500;
  display: none;
  max-height: 240px;
  overflow-y: auto;
}

.typeahead-dropdown.open { display: block; }

.typeahead-option {
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-size-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition-fast);
}

.typeahead-option:hover,
.typeahead-option.typeahead-active { background: var(--color-bg-panel); }

.typeahead-mark {
  background: none;
  color: var(--color-accent);
  font-weight: var(--font-weight-semibold);
}

/* Multi-select dropdown extras */
.multi-select-dd {
  min-width: 150px;
  padding: var(--space-2) 0;
}

.multi-select-option {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
  user-select: none;
}

.multi-select-option:hover { background: var(--color-bg-panel); }

/* Price range group */
.filter-price-range {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.filter-price-symbol {
  font-size: var(--font-size-sm);
  color: var(--color-text-tertiary);
  padding-right: 2px;
}

.filter-price-input { min-width: 72px !important; width: 72px; }

.filter-price-sep {
  font-size: var(--font-size-sm);
  color: var(--color-text-tertiary);
  padding: 0 2px;
}

/* ── Table ── */
.col-item-nr  { color: var(--color-text-tertiary); font-size: var(--font-size-xs); white-space: nowrap; }
.col-thumb    { padding-top: 8px !important; padding-bottom: 8px !important; }
.col-headline { min-width: 200px; }
.col-price    { white-space: nowrap; }
.col-date     { white-space: nowrap; }
.col-actions  { padding-right: var(--space-3) !important; }

.inv-headline {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-primary);
  line-height: 1.35;
  max-width: 300px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inv-sub {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  margin-top: 2px;
}

.best-offer-label {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  font-style: italic;
}

/* ── Row action buttons ── */
.inv-row-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  opacity: 0;
  transition: opacity var(--transition-base);
}

tr:hover .inv-row-actions { opacity: 1; }

.btn-row-action {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--color-text-tertiary);
  transition: background var(--transition-base), color var(--transition-base);
  flex-shrink: 0;
}

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

.btn-row-action-danger:hover {
  background: #fee2e2;
  color: #dc2626;
}

.btn-row-action svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

/* ── Table footer ── */
.inv-table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
  padding: var(--space-4) 0 var(--space-2);
}

.inv-per-page {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.pagination-ellipsis {
  padding: 0 var(--space-1);
  color: var(--color-text-tertiary);
  font-size: var(--font-size-sm);
}

/* ── Responsive column hiding ── */
@media (max-width: 1100px) {
  .col-hide-md { display: none; }
}

@media (max-width: 860px) {
  .col-hide-sm { display: none; }
}

/* ── Card view overlays ── */
.card-status-badge {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  font-size: var(--font-size-xs);
  pointer-events: none;
}

.card-deal-badge {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  background: var(--color-accent);
  color: #fff;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  pointer-events: none;
}

.item-card-sub {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  margin-bottom: var(--space-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Card sort bar ── */
.inv-card-sort-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

/* ── Visibility badges ── */
.badge-vis {
  display: inline-block;
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
}
.badge-vis-inventory    { background: #f1f5f9; color: #475569; }
.badge-vis-redeployment { background: #dbeafe; color: #1d4ed8; }
.badge-vis-public       { background: #dcfce7; color: #15803d; }
.badge-vis-marketplaces { background: #fef3c7; color: #b45309; }

/* ── User-controlled column visibility ── */
#inv-table.hide-col-thumb  .col-thumb  { display: none; }
#inv-table.hide-col-mfr    .col-mfr    { display: none; }
#inv-table.hide-col-model  .col-model  { display: none; }
#inv-table.hide-col-cat    .col-cat    { display: none; }
#inv-table.hide-col-loc    .col-loc    { display: none; }
#inv-table.hide-col-qty    .col-qty    { display: none; }
#inv-table.hide-col-status .col-status { display: none; }
#inv-table.hide-col-vis    .col-vis    { display: none; }
#inv-table.hide-col-price  .col-price  { display: none; }
#inv-table.hide-col-date   .col-date   { display: none; }

/* Category column */
.col-cat { white-space: nowrap; }

/* ── Clickable table rows ── */
#inv-table tbody tr { cursor: pointer; }
#inv-table tbody tr td:first-child { cursor: default; }

/* ── Deals badge (inline in headline cell) ── */
.deals-badge {
  display: inline-flex;
  align-items: center;
  margin-top: 4px;
  padding: 2px var(--space-2);
  background: var(--color-accent-light);
  color: var(--color-accent);
  border: 1px solid rgba(255,120,71,0.25);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition-base);
}
.deals-badge:hover {
  background: rgba(255,120,71,0.22);
}

/* ── Slide-over backdrop + panel ── */
.slide-over-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(7,22,38,0.45);
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-slow);
}
.slide-over-backdrop.open {
  opacity: 1;
  pointer-events: all;
}
.slide-over {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 620px;
  max-width: 100vw;
  background: var(--color-bg-content);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--transition-slow);
}
.slide-over-backdrop.open .slide-over {
  transform: translateX(0);
}

/* ── Slide-over header ── */
.slide-over-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}
.slide-over-title-block { flex: 1; min-width: 0; }
.slide-over-title-row {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  margin-bottom: var(--space-1);
}
.slide-over-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
}
.slide-over-item-nr {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-accent);
  letter-spacing: 0.02em;
}
.slide-over-meta {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  line-height: 1.6;
}
.slide-over-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--color-text-secondary);
  flex-shrink: 0;
  transition: background var(--transition-base), color var(--transition-base);
}
.slide-over-close:hover { background: var(--color-bg-panel); color: var(--color-text-primary); }
.slide-over-close svg {
  width: 18px; height: 18px;
  stroke: currentColor; fill: none; stroke-width: 2;
}

/* ── Slide-over body ── */
.slide-over-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-5) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* ── Slide-over footer ── */
.slide-over-footer {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
  background: var(--color-bg-panel);
}

/* ── Form sections ── */
.form-section {
  background: var(--color-bg-content);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
}
.form-section-title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-4);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}
.form-row:last-child { margin-bottom: 0; }
.form-group-full { grid-column: 1 / -1; }
.form-required { color: var(--color-accent); }
.form-hint {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  font-weight: var(--font-weight-normal);
  margin-left: var(--space-1);
}
.char-counter {
  position: absolute;
  right: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  pointer-events: none;
}
.input-error {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 3px rgba(220,38,38,0.1) !important;
}

/* ── Image Upload ── */
.img-drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-5) var(--space-4);
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  text-align: center;
  transition: border-color var(--transition-base), background var(--transition-base);
}
.img-drop-zone.drag-over {
  border-color: var(--color-accent);
  background: var(--color-accent-light);
}
.img-drop-icon {
  width: 28px; height: 28px;
  stroke: var(--color-text-tertiary); fill: none; stroke-width: 1.5;
}
.img-drop-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin: 0;
}
.img-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: var(--space-2);
  margin-top: var(--space-3);
}
.img-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: grab;
  background: var(--color-bg-panel);
  border: 2px solid transparent;
  transition: border-color var(--transition-base), opacity var(--transition-base);
  user-select: none;
}
.img-thumb:first-child { border-color: var(--color-accent); }
.img-thumb.dragging    { opacity: 0.35; cursor: grabbing; }
.img-thumb.drag-target { border-color: var(--color-accent); box-shadow: 0 0 0 2px var(--color-accent-light); }
.img-thumb img {
  width: 100%; height: 100%;
  object-fit: cover; display: block; pointer-events: none;
}
.img-primary-badge {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(255,120,71,0.82);
  color: #fff;
  font-size: 10px; font-weight: 600;
  text-align: center; padding: 3px 0;
  text-transform: uppercase; letter-spacing: 0.05em;
  pointer-events: none;
}
.img-delete-btn {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(0,0,0,0.52); color: #fff;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0; opacity: 0;
  transition: opacity var(--transition-fast);
}
.img-thumb:hover .img-delete-btn { opacity: 1; }
.img-delete-btn svg {
  width: 10px; height: 10px;
  stroke: currentColor; fill: none; stroke-width: 2.5;
  pointer-events: none;
}

@media (max-width: 640px) {
  .slide-over { width: 100vw; }
  .form-row { grid-template-columns: 1fr; }
}

/* ============================================================
   BATCH UPLOAD
   ============================================================ */

/* Step bar */
.batch-step-bar {
  display: flex;
  align-items: center;
  margin-bottom: var(--space-6);
  padding: var(--space-4) var(--space-6);
  background: var(--color-bg-content);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
}
.batch-step-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  opacity: 0.4;
  transition: opacity var(--transition-base);
}
.batch-step-item.active  { opacity: 1; }
.batch-step-item.done    { opacity: 0.75; }
.batch-step-item.skipped { opacity: 0.25; }
.batch-step-num {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--color-bg-panel);
  border: 1.5px solid var(--color-border);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-secondary);
  flex-shrink: 0;
}
.batch-step-item.active .batch-step-num {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
}
.batch-step-item.done .batch-step-num {
  background: var(--color-status-sold);
  border-color: var(--color-status-sold);
  color: #fff;
}
.batch-step-label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-secondary);
  white-space: nowrap;
}
.batch-step-item.active .batch-step-label { color: var(--color-text-primary); }
.batch-step-line {
  flex: 1;
  height: 1px;
  background: var(--color-border);
  margin: 0 var(--space-3);
  min-width: var(--space-6);
}

/* Panels */
.batch-panel {
  background: var(--color-bg-content);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
}
.batch-panel-center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}
.batch-panel-desc {
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  margin-bottom: var(--space-5);
}
.batch-panel-actions {
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
  margin-top: var(--space-5);
  padding-top: var(--space-5);
  border-top: 1px solid var(--color-border);
}

/* Upload zone */
.batch-upload-zone {
  display: flex; flex-direction: column; align-items: center;
  gap: var(--space-3);
  padding: var(--space-10) var(--space-6);
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  text-align: center;
  transition: border-color var(--transition-base), background var(--transition-base);
}
.batch-upload-zone.drag-over {
  border-color: var(--color-accent);
  background: var(--color-accent-light);
}
.batch-upload-zone.has-file { border-style: solid; border-color: var(--color-status-sold); }
.batch-drop-icon {
  width: 36px; height: 36px;
  stroke: var(--color-text-tertiary); fill: none; stroke-width: 1.5;
}
.batch-drop-label {
  font-size: var(--font-size-base);
  color: var(--color-text-secondary);
  margin: 0;
}
.batch-template-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-4);
}
.btn-ghost {
  background: none;
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
}
.btn-ghost:hover { background: var(--color-bg-panel); }
.btn-ghost svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }

/* Parse result */
.batch-parse-result {
  margin-top: var(--space-5);
  padding-top: var(--space-5);
  border-top: 1px solid var(--color-border);
}
.batch-parse-info {
  display: flex; align-items: center; gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.batch-parse-info svg {
  width: 32px; height: 32px; flex-shrink: 0;
  stroke: var(--color-accent); fill: none; stroke-width: 1.5;
}
.batch-filename {
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-base);
}
.batch-rowcount { font-size: var(--font-size-sm); color: var(--color-text-secondary); }
.batch-detect-msg { margin-bottom: var(--space-4); }
.batch-detect-ok, .batch-detect-warn {
  display: inline-flex; align-items: center; gap: var(--space-2);
  font-size: var(--font-size-sm); font-weight: var(--font-weight-medium);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-full);
}
.batch-detect-ok {
  background: #dcfce7; color: #15803d;
}
.batch-detect-ok svg, .batch-detect-warn svg {
  width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2.5;
}
.batch-detect-warn { background: #fef3c7; color: #b45309; }

/* Column mapping */
.batch-mapping-table-wrap { overflow-x: auto; margin-bottom: var(--space-2); }
.batch-mapping-table {
  width: 100%; border-collapse: collapse;
  font-size: var(--font-size-sm);
}
.batch-mapping-table th {
  text-align: left; padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  font-weight: var(--font-weight-medium);
}
.batch-mapping-table td { padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--color-bg-panel); }
.batch-map-source { font-weight: var(--font-weight-medium); }
.batch-map-sample { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.batch-map-arrow  { color: var(--color-text-tertiary); font-size: var(--font-size-lg); }
.form-control-sm  { padding: var(--space-1) var(--space-2); font-size: var(--font-size-sm); height: 30px; }

/* Preview */
.batch-preview-summary { margin-bottom: var(--space-4); }
.batch-summary-pills { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.batch-pill {
  display: inline-flex; align-items: center; gap: var(--space-1);
  padding: 3px 10px; border-radius: var(--radius-full);
  font-size: var(--font-size-xs); font-weight: var(--font-weight-semibold);
}
.batch-pill svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 2.5; }
.batch-pill-ok    { background: #dcfce7; color: #15803d; }
.batch-pill-warn  { background: #fef3c7; color: #b45309; }
.batch-pill-error { background: #fee2e2; color: #b91c1c; }

.batch-preview-wrap {
  overflow-x: auto; overflow-y: auto;
  max-height: 420px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-2);
}
.batch-preview-table { width: max-content; min-width: 100%; font-size: var(--font-size-xs); }
.batch-preview-table th,
.batch-preview-table td { white-space: nowrap; }
.batch-row-error { background: #fff5f5; }
.batch-row-warn  { background: #fffbeb; }
.batch-col-status { width: 28px; }
.batch-row-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%;
}
.batch-row-icon svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 2.5; }
.batch-row-icon.ok    { color: #15803d; }
.batch-row-icon.warn  { color: #b45309; }
.batch-row-icon.error { color: #b91c1c; }
.batch-cell-error { background: #fee2e2 !important; }

/* Progress */
.batch-progress-block { width: 100%; max-width: 440px; text-align: center; }
.batch-progress-track {
  height: 8px; background: var(--color-bg-panel);
  border-radius: var(--radius-full); overflow: hidden;
  margin-bottom: var(--space-3);
}
.batch-progress-fill {
  height: 100%; background: var(--color-accent);
  border-radius: var(--radius-full);
  transition: width 150ms ease;
}
.batch-progress-text {
  font-size: var(--font-size-sm); color: var(--color-text-secondary);
}

/* Results */
.batch-results-cards {
  display: flex; gap: var(--space-4); margin-bottom: var(--space-5);
}
.batch-results-card {
  flex: 1; text-align: center; padding: var(--space-6);
  border-radius: var(--radius-xl); border: 1px solid;
}
.batch-results-card-ok   { border-color: #bbf7d0; background: #f0fdf4; }
.batch-results-card-skip { border-color: #fde68a; background: #fffbeb; }
.batch-results-num {
  font-size: 40px; font-weight: var(--font-weight-bold);
  line-height: 1;  margin-bottom: var(--space-2);
}
.batch-results-card-ok   .batch-results-num { color: #15803d; }
.batch-results-card-skip .batch-results-num { color: #b45309; }
.batch-results-label { font-size: var(--font-size-sm); color: var(--color-text-secondary); }
.batch-results-errors { margin-top: var(--space-4); }
.batch-results-errors-title {
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-sm);
  margin-bottom: var(--space-3);
  color: var(--color-text-secondary);
}
.text-danger { color: #b91c1c; }

/* Preview issues column */
.batch-col-issues { min-width: 180px; }
.batch-issue-error {
  font-size: var(--font-size-xs);
  color: #b91c1c;
  line-height: 1.4;
}
.batch-issue-warn {
  font-size: var(--font-size-xs);
  color: #b45309;
  line-height: 1.4;
}

/* ── Deals List View ─────────────────────────────────────── */

/* Stats row */
.deals-stats-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
}
.deals-stat-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  background: var(--color-bg-content);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-5) var(--space-6);
  text-align: left;
  cursor: pointer;
  transition: border-color 150ms, box-shadow 150ms;
  min-width: 200px;
}
.deals-stat-main {
  display: flex;
  flex-direction: column;
}
.deals-stat-num {
  font-size: 36px;
  font-weight: var(--font-weight-bold);
  line-height: 1;
}
.deals-stat-label {
  font-size: 11px;
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin-top: var(--space-1);
  color: var(--color-text-secondary);
}
.deals-stat-needs {
  font-size: 11px;
  font-weight: var(--font-weight-medium);
  padding: 2px 9px;
  border-radius: 99px;
  color: var(--color-text-secondary);
  white-space: normal;
  word-break: break-word;
}
.deals-stat-needs:empty { display: none; }
.deals-stat-needs.has-alert {
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
}
.deals-stat-needs.has-alert:hover { filter: brightness(0.93); }
.deals-stat-card--inquiry .deals-stat-needs.active { background: #16a34a; color: white; }
.deals-stat-card--offer   .deals-stat-needs.active { background: #2563eb; color: white; }

/* Inquiry card — green */
.deals-stat-card--inquiry:hover {
  border-color: #16a34a;
  box-shadow: 0 0 0 3px rgba(22,163,74,.12);
}
.deals-stat-card--inquiry.active {
  background: #f0fdf4;
  border-color: #16a34a;
  box-shadow: 0 0 0 3px rgba(22,163,74,.15);
}
.deals-stat-card--inquiry .deals-stat-num { color: #16a34a; }
.deals-stat-card--inquiry .deals-stat-needs.has-alert { background: #dcfce7; color: #15803d; }

/* Offer card — blue */
.deals-stat-card--offer:hover {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
.deals-stat-card--offer.active {
  background: #eff6ff;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.deals-stat-card--offer .deals-stat-num { color: #2563eb; }
.deals-stat-card--offer .deals-stat-needs.has-alert { background: #dbeafe; color: #1d4ed8; }

/* Subordinate "my responses" link */
.deals-stat-subordinate {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin-left: var(--space-2);
  white-space: normal;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
  max-width: 220px;
  text-align: left;
}
.deals-stat-subordinate:hover { color: var(--color-accent); }
.deals-stat-subordinate.active { color: var(--color-accent); font-weight: var(--font-weight-medium); }

/* Filter bar */
.deals-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  margin-bottom: var(--space-3);
}
.deals-filter-select {
  width: auto;
  min-width: 130px;
  padding: 6px 10px;
  font-size: var(--font-size-sm);
}
.deals-filter-date {
  width: 140px;
  padding: 6px 10px;
  font-size: var(--font-size-sm);
}

/* Toolbar */
.deals-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
  padding: 0 2px;
}
.deals-group-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  cursor: pointer;
  user-select: none;
}

/* Chain list */
.deals-chain-list {
  background: var(--color-bg-content);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.deals-chain-list-nested {
  border: none;
  border-top: 1px solid var(--color-border);
  border-radius: 0;
  margin-left: 48px;
}

/* Chain row */
.deals-chain-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  transition: background 150ms;
}
.deals-chain-row:last-child { border-bottom: none; }
.deals-chain-row:hover { background: var(--color-bg-page); }
.deals-chain-row.needs-response { background: #fafbff; }

.deals-chain-unread-col {
  width: 10px;
  flex-shrink: 0;
  padding-top: 6px;
  display: flex;
  justify-content: center;
}
.deals-unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-accent);
  flex-shrink: 0;
}

.deals-chain-thumb {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-bg-page);
  display: flex;
  align-items: center;
  justify-content: center;
}
.deals-chain-thumb img { width: 100%; height: 100%; object-fit: cover; }
.deals-chain-thumb svg { width: 20px; height: 20px; stroke: var(--color-text-tertiary); fill: none; stroke-width: 1.5; }

.deals-chain-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.deals-chain-top {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.deals-chain-buyer { font-size: var(--font-size-sm); }
.deals-chain-company { font-size: var(--font-size-xs); }
.deals-chain-item-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deals-chain-preview {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--color-text-tertiary);
  font-size: var(--font-size-xs);
}
.deals-chain-date { white-space: nowrap; }

.deals-chain-right {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-1);
  padding-top: 2px;
}
.deals-msg-count { font-size: var(--font-size-xs); }
.deals-chain-id {
  font-size: 10px;
  color: var(--color-text-tertiary);
  letter-spacing: 0.02em;
  margin-top: auto;
}

.deals-offer-amt {
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-sm);
  color: var(--color-text-primary);
}

/* Portal badge */
.deals-portal-badge {
  font-size: 10px;
  font-weight: var(--font-weight-semibold);
  padding: 2px 7px;
  border-radius: var(--radius-full);
  white-space: nowrap;
  letter-spacing: 0.02em;
}

/* Type badge */
.deals-type-badge {
  font-size: 10px;
  font-weight: var(--font-weight-semibold);
  padding: 2px 7px;
  border-radius: var(--radius-full);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.deals-type-offer         { background: #dbeafe; color: #2563eb; }
.deals-type-counter-offer { background: #dbeafe; color: #2563eb; }
.deals-type-inquiry       { background: #dcfce7; color: #15803d; }
.deals-type-accepted      { background: #dcfce7; color: #166534; }
.deals-type-message       { background: #f3f4f6; color: #374151; }

/* Unread dots — colored by chain type */
.deals-unread-dot               { background: var(--color-accent); }
.deals-unread-dot.deals-unread-inquiry { background: #16a34a; }
.deals-unread-dot.deals-unread-offer   { background: #3b82f6; }

/* Separator between type badge and portal badge */
.deals-badge-sep {
  display: inline-block;
  width: 1px;
  height: 14px;
  background: var(--color-border);
  margin: 0 var(--space-1);
  vertical-align: middle;
  flex-shrink: 0;
}

/* Status badge */
.deals-status-badge {
  font-size: 10px;
  font-weight: var(--font-weight-medium);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}
.deals-status-pending   { background: #eff6ff; color: #1d4ed8; }
.deals-status-countered { background: #fffbeb; color: #92400e; }
.deals-status-responded { background: #f0fdf4; color: #166534; }
.deals-status-accepted  { background: #dcfce7; color: #166534; }
.deals-status-suspended { background: #f3f4f6; color: #6b7280; }

/* Unread badge */
.deals-unread-badge {
  font-size: var(--font-size-xs);
  background: var(--color-accent);
  color: #fff;
  padding: 1px 8px;
  border-radius: var(--radius-full);
  font-weight: var(--font-weight-medium);
}

/* Grouped view */
.deals-item-group {
  background: var(--color-bg-content);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-3);
  overflow: hidden;
}
.deals-item-group-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  transition: background 150ms;
  background: var(--color-bg-page);
}
.deals-item-group-header:hover { background: var(--color-border); }

.deals-group-chevron svg {
  width: 16px; height: 16px;
  stroke: var(--color-text-tertiary);
  fill: none; stroke-width: 2;
  transition: transform 150ms;
}
.deals-group-chevron.expanded svg { transform: rotate(90deg); }

.deals-group-thumb {
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-bg-content);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.deals-group-thumb img { width: 100%; height: 100%; object-fit: cover; }
.deals-group-thumb svg { width: 16px; height: 16px; stroke: var(--color-text-tertiary); fill: none; stroke-width: 1.5; }

.deals-group-info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
}
.deals-group-headline {
  font-weight: var(--font-weight-medium);
  font-size: var(--font-size-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.deals-group-nr { font-size: var(--font-size-xs); }
.deals-group-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}
.deals-group-count {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
}

/* Mapping type-mismatch warning */
.batch-map-type-warn {
  font-size: var(--font-size-xs);
  color: #b45309;
  margin-top: 3px;
  min-height: 1em;
}

/* ── Deal Thread View ────────────────────────────────────── */

.deal-thread-view { padding-bottom: 0; }

/* 2-column layout */
.dt-layout {
  display: flex;
  gap: var(--space-4);
  height: calc(100vh - 180px);
  min-height: 500px;
}

/* Left: chat panel */
.dt-chat-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--color-bg-content);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

/* Messages area */
.dt-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* Message wrapper */
.dt-msg-wrapper {
  display: flex;
  gap: var(--space-2);
  position: relative;
}
.dt-msg-buyer  { justify-content: flex-start; }
.dt-msg-admin  { justify-content: flex-end; }
.dt-msg-unread { background: #fffbf5; border-radius: var(--radius-md); padding: 4px; margin: -4px; }

.dt-unread-bar {
  position: absolute;
  left: -12px;
  top: 0; bottom: 0;
  width: 3px;
  background: var(--color-accent);
  border-radius: 2px;
}

/* Bubble */
.dt-bubble {
  max-width: 72%;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.dt-msg-admin .dt-bubble { align-items: flex-end; }

.dt-msg-meta {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  font-size: var(--font-size-xs);
  padding: 0 4px;
}
.dt-msg-admin .dt-msg-meta { flex-direction: row-reverse; }
.dt-msg-sender { font-weight: var(--font-weight-medium); color: var(--color-text-secondary); }
.dt-msg-time   { color: var(--color-text-tertiary); }

.dt-bubble-text {
  background: var(--color-bg-page);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  font-size: var(--font-size-sm);
  line-height: 1.55;
  color: var(--color-text-primary);
  white-space: pre-wrap;
}
.dt-msg-admin .dt-bubble-text {
  background: #f0f4ff;
  border-color: #c7d2fe;
}

/* Price cards */
.dt-price-card {
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  min-width: 200px;
}
.dt-price-card-offer {
  background: #dbeafe;
  border: 1px solid #93c5fd;
}
.dt-price-card-counter {
  background: #fef3c7;
  border: 1px solid #fcd34d;
}
.dt-price-card-accepted {
  background: #dcfce7;
  border: 1px solid #86efac;
}
.dt-price-card-label {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-secondary);
  margin-bottom: 4px;
}
.dt-price-card-offer .dt-price-card-label   { color: #1e40af; }
.dt-price-card-counter .dt-price-card-label { color: #92400e; }
.dt-price-card-accepted .dt-price-card-label{ color: #166534; }
.dt-price-card-math {
  font-size: 15px;
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
}

/* Inquiry indicator */
.dt-inquiry-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #3730a3;
  margin-bottom: 4px;
}
.dt-inquiry-indicator svg {
  width: 14px; height: 14px;
  stroke: #3730a3; fill: none; stroke-width: 2;
}

/* Archived compose replacement */
.dt-compose-archived {
  background: var(--color-bg-subtle, #f8f9fa);
}
.dt-archived-notice {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-2);
  color: var(--color-text-secondary);
}
.dt-archived-notice svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  opacity: 0.6;
}
.dt-archived-notice-title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
}
.dt-archived-notice-sub {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
}

/* Archive blocking modal */
.arch-block-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-height: 240px;
  overflow-y: auto;
}
.arch-block-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--color-bg-subtle);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
}
.arch-block-chain {
  font-family: var(--font-mono, monospace);
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  white-space: nowrap;
}
.arch-block-buyer {
  flex: 1;
  color: var(--color-text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.arch-block-status {
  white-space: nowrap;
}

/* Compose area */
.dt-compose {
  flex-shrink: 0;
  border-top: 1px solid var(--color-border);
  padding: var(--space-3) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  background: var(--color-bg-content);
}

.dt-counter-inputs { padding-bottom: var(--space-2); }
.dt-counter-row {
  display: flex;
  gap: var(--space-3);
  align-items: flex-end;
}

.dt-canned-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}
.dt-canned-btn {
  font-size: var(--font-size-xs);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: var(--color-bg-page);
  color: var(--color-text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 150ms, background 150ms;
}
.dt-canned-btn:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: #fff5f0;
}

.dt-compose-textarea {
  resize: none;
  font-size: var(--font-size-sm);
}

.dt-actions-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

/* Right: context panel */
.dt-context-panel {
  width: 260px;
  flex-shrink: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.dt-context-card {
  background: var(--color-bg-content);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}

.dt-context-card-title {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-tertiary);
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.dt-item-thumb {
  width: 100%;
  height: 120px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-bg-page);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-3);
}
.dt-item-thumb img { width: 100%; height: 100%; object-fit: cover; }
.dt-item-thumb svg { width: 32px; height: 32px; stroke: var(--color-text-tertiary); fill: none; stroke-width: 1.5; }

.dt-context-item-headline {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  line-height: 1.4;
  margin-bottom: 2px;
}
.dt-context-item-meta { margin-bottom: var(--space-2); }

.dt-context-item-rows { display: flex; flex-direction: column; gap: 4px; }
.dt-context-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-2);
}
.dt-context-label {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  white-space: nowrap;
}
.dt-context-value { font-size: var(--font-size-xs); }

.dt-context-buyer-name {
  font-size: var(--font-size-sm);
  margin-bottom: 2px;
}

/* Competing offers */
.dt-competing-row {
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dt-competing-row:last-child { border-bottom: none; }
.dt-competing-price { color: var(--color-text-secondary); }

/* Invoice context card */
.dt-invoice-card {
  border-top: 2px solid var(--color-primary);
}
.dt-invoice-card--empty {
  border-top-color: var(--color-border);
}
.dt-invoice-nr {
  font-family: monospace;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
}
.dt-invoice-meta {
  display: flex;
  justify-content: space-between;
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-3);
}
.dt-invoice-total {
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
}
.dt-invoice-actions {
  display: flex;
  gap: var(--space-2);
}
.dt-invoice-delete-btn {
  color: var(--color-danger, #dc2626);
}
.dt-invoice-empty-msg {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  margin-bottom: var(--space-1);
}

/* Accept modal styles */
.dt-accept-summary {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  background: var(--color-bg-page);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-3);
}
.dt-accept-row {
  display: flex;
  justify-content: space-between;
  font-size: var(--font-size-sm);
  gap: var(--space-4);
}
.dt-accept-row span { color: var(--color-text-secondary); }
.dt-notify-row {
  display: flex;
  gap: var(--space-2);
  align-items: baseline;
  padding: 3px 0;
  font-size: var(--font-size-sm);
}

/* ── INVOICE VIEW ── */

/* Form card — adds top accent border */
.inv-form-card {
  padding: var(--space-5) var(--space-6);
  border-top: 3px solid var(--color-primary);
}

/* Section header */
.inv-form-section-head {
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border);
}
.inv-form-section-title {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  margin-bottom: 2px;
}
.inv-form-section-sub {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
}

/* Party panels */
.inv-parties-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
}
.inv-party-form-panel {
  background: var(--color-bg-subtle, #f8f9fa);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  /* In paper mode the panel border still anchors each column visually */
}
.inv-party-form-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: var(--font-weight-semibold);
  letter-spacing: .08em;
  padding: 2px 8px;
  border-radius: var(--radius-full, 999px);
  margin-bottom: var(--space-4);
}
.inv-party-badge--seller {
  background: #dbeafe;
  color: #1d4ed8;
}
.inv-party-badge--buyer {
  background: #dcfce7;
  color: #15803d;
}

/* Invoice # display */
.inv-details-row {
  display: flex;
  gap: var(--space-5);
  align-items: flex-end;
}
.inv-number-block {
  flex: 1;
}
.inv-number-label {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-1);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.inv-number-input {
  font-family: monospace;
  font-size: var(--font-size-lg, 18px);
  font-weight: var(--font-weight-semibold);
  letter-spacing: .04em;
  color: var(--color-text-primary);
}

/* Line item table */
.inv-line-table {
  width: 100%;
  border-collapse: collapse;
}
.inv-line-table thead tr {
  background: var(--color-bg-subtle, #f8f9fa);
  border-bottom: 2px solid var(--color-border);
}
.inv-line-table th {
  text-align: left;
  font-size: 11px;
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--color-text-secondary);
  padding: var(--space-2) var(--space-3);
}
.inv-line-table td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-border);
}
.inv-line-table .inv-total-cell {
  font-size: var(--font-size-lg, 18px);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
}
/* Notes textarea — full width */
.inv-notes-textarea {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
}

/* Labels inside invoice form — softer than input values for clear contrast */
.inv-form-card .form-label,
.inv-number-label {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* Paper-mode inputs — all form-inputs inside inv-form-card look borderless by default */
.inv-form-card .form-input,
.inv-cell-input {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  transition: border-color .15s, background .15s;
}
.inv-form-card .form-input:hover,
.inv-cell-input:hover {
  background: rgba(0, 0, 0, .03);
  border-color: var(--color-border);
}
.inv-form-card .form-input:focus,
.inv-cell-input:focus {
  background: var(--color-bg-content);
  border-color: var(--color-primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb, 59,130,246), .12);
}

/* Charges layout */
.inv-charges-layout {
  display: flex;
  gap: var(--space-6);
  align-items: flex-start;
}
.inv-charges-fields {
  flex: 1;
}

/* Live totals panel */
.inv-totals-panel {
  width: 260px;
  flex-shrink: 0;
  background: var(--color-bg-subtle, #f8f9fa);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}
.inv-totals-panel-title {
  font-size: 11px;
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-border);
}
.inv-totals-panel-rows {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 2px solid var(--color-border);
}
.inv-totals-panel-row {
  display: flex;
  justify-content: space-between;
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}
.inv-totals-panel-total {
  display: flex;
  justify-content: space-between;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
}

/* Legacy — keep for any old refs */
.inv-section-title {
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-border);
}
.inv-totals-row {
  display: flex;
  justify-content: flex-end;
}
.inv-totals-table {
  width: 260px;
}
.inv-totals-table td {
  padding: 3px var(--space-2);
  font-size: var(--font-size-sm);
}
.inv-totals-table .inv-grand-total td {
  font-weight: 700;
  font-size: var(--font-size-base);
  border-top: 2px solid var(--color-border);
  padding-top: var(--space-2);
}

/* Preview overlay */
.inv-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 1000;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.inv-overlay-bar {
  position: sticky;
  top: 0;
  background: var(--color-primary-dark);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-5);
  gap: var(--space-3);
  z-index: 1;
}
.inv-overlay-content {
  background: white;
  margin: var(--space-6) auto;
  width: 794px;
  max-width: 96vw;
  padding: 48px;
  box-shadow: 0 4px 24px rgba(0,0,0,.3);
}

/* Invoice print template */
.inv-preview {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: #1a1a1a;
}
.inv-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 32px;
}
.inv-logo-img {
  max-height: 60px;
  max-width: 200px;
  object-fit: contain;
}
.inv-logo-fallback {
  font-size: 22px;
  font-weight: 700;
  color: #1a1a1a;
}
.inv-title-word {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: .05em;
  text-align: right;
  color: #1a1a1a;
  margin-bottom: 8px;
}
.inv-meta-row {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  font-size: 12px;
  margin-bottom: 3px;
}
.inv-meta-row span {
  color: #666;
}
.inv-parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-bottom: 28px;
  padding: 20px;
  background: #f9fafb;
  border-radius: 6px;
}
.inv-party-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #666;
  margin-bottom: 6px;
}
.inv-party-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 3px;
}
.inv-party > div {
  line-height: 1.5;
  color: #374151;
  font-size: 12px;
}
.inv-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
}
.inv-table th {
  background: #1e3a5f;
  color: white;
  text-align: left;
  padding: 8px 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.inv-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e5e7eb;
  font-size: 13px;
}
.inv-table td:last-child {
  text-align: right;
  font-weight: 600;
}
.inv-table th:last-child {
  text-align: right;
}
.inv-totals-block {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 28px;
}
.inv-totals-inner {
  width: 260px;
}
.inv-totals-inner table {
  width: 100%;
  border-collapse: collapse;
}
.inv-totals-inner td {
  padding: 4px 0;
  font-size: 13px;
}
.inv-totals-inner td:last-child {
  text-align: right;
  font-weight: 500;
}
.inv-grand-row td {
  font-size: 16px;
  font-weight: 800;
  border-top: 2px solid #1e3a5f;
  padding-top: 8px;
}
.inv-section {
  margin-bottom: 20px;
}
.inv-section h4 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: #666;
  margin-bottom: 6px;
  font-weight: 600;
}
.inv-section p {
  font-size: 12px;
  color: #374151;
  line-height: 1.6;
}

/* Print media */
@media print {
  body > *:not(#inv-preview-overlay) { display: none !important; }
  .inv-overlay { position: static; background: none; overflow: visible; }
  .inv-overlay-bar.no-print { display: none !important; }
  .inv-overlay-content { margin: 0; padding: 0; width: 100%; box-shadow: none; }
}

/* ── INVENTORY ARCHIVES VIEW ── */

.inva-list {
  background: var(--color-bg-content);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.inva-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
}
.inva-row:last-child { border-bottom: none; }
.inva-row:hover { background: var(--color-bg-page); }

.inva-thumb {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
}
.inva-thumb img { width: 100%; height: 100%; object-fit: cover; }
.inva-thumb svg { width: 24px; height: 24px; color: var(--color-text-tertiary); stroke: currentColor; fill: none; stroke-width: 1.5; }

.inva-main { flex: 1; min-width: 0; }
.inva-headline {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inva-meta  { margin-top: 2px; }
.inva-sub   { margin-top: 1px; }

.inva-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-1);
  flex-shrink: 0;
  min-width: 120px;
}
.inva-price { color: var(--color-text-primary); }
.inva-archdt, .inva-item-nr { color: var(--color-text-tertiary); }

/* ── CRM VIEW ── */

/* Invite popover */
.invite-popover {
  position: absolute;
  z-index: 300;
  background: var(--color-bg-content);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-3) var(--space-4);
  width: 320px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 150ms ease, transform 150ms ease;
  pointer-events: none;
}
.invite-popover.open { opacity: 1; transform: translateY(0); pointer-events: auto; }
.invite-popover-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin: 0 0 var(--space-2);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.invite-popover-row { display: flex; gap: var(--space-2); align-items: center; }
.invite-popover-row .form-control { flex: 1; min-width: 0; }

.crm-row { cursor: pointer; }
.crm-row:hover td { background: var(--color-bg-page); }

.crm-portal-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: var(--font-weight-medium);
  padding: 2px 7px;
  border-radius: var(--radius-full);
  white-space: nowrap;
  margin-right: 3px;
}

/* Profile slide-over */
.crm-field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3) var(--space-5);
  margin-top: var(--space-2);
}
.crm-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.crm-field-label {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.crm-field-value {
  font-size: var(--font-size-sm);
  color: var(--color-text-primary);
}

/* Deal history list */
.crm-deal-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-1);
}
.crm-deal-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--color-bg-subtle);
  border-radius: var(--radius-md);
}
.crm-deal-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}
.crm-deal-main .text-sm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crm-deal-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

/* Sort header in th */
.sort-header {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  user-select: none;
}

/* Search bar takes its own line on small screens across all filter bars */
@media (max-width: 860px) {
  .deals-filter-bar .search-bar,
  .inv-search-row .search-bar {
    flex: 1 1 100% !important;
    max-width: 100% !important;
  }

  .deals-filter-bar .deals-filter-select,
  .deals-filter-bar .deals-filter-date {
    flex: 1 1 auto;
    min-width: 120px;
  }
}

/* ── Settings — Team ── */

.team-avatar {
  width: 30px; height: 30px;
  border-radius: var(--radius-full);
  background: var(--color-primary-dark);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  flex-shrink: 0;
}

.team-setup-link-box {
  margin-top: var(--space-5);
  padding: var(--space-3) var(--space-4);
  background: var(--color-bg-panel);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.team-setup-link-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
}

.team-setup-link-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.team-setup-link-code {
  flex: 1;
  font-size: var(--font-size-xs);
  color: var(--color-text-primary);
  background: var(--color-bg-content);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-1) var(--space-2);
  word-break: break-all;
}

/* ── Invite popover ── */

.invite-popover {
  position: fixed;
  background: var(--color-bg-content);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  padding: var(--space-4);
  width: 280px;
  z-index: 300;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 150ms ease, transform 150ms ease;
  pointer-events: none;
}

.invite-popover.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.invite-popover-title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-3);
}
