/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.58rem 1.05rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  transition:
    background var(--transition),
    border-color var(--transition),
    color var(--transition),
    box-shadow var(--transition),
    transform var(--transition);
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Full-capacity CTAs stay solid danger red (not washed out). */
.btn.btn-danger.is-full:disabled,
.btn.is-full:disabled {
  opacity: 1;
}

.btn-primary {
  background: var(--color-accent);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08) inset, 0 1px 2px rgba(12, 26, 43, 0.12);
}

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

.btn-primary:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-secondary {
  background: var(--color-surface);
  border-color: var(--color-border-strong);
  color: var(--color-text);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--color-surface-muted);
  border-color: var(--color-accent-mid);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--color-surface-muted);
  color: var(--color-text);
}

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

.btn-danger-outline {
  background: var(--color-surface);
  border-color: #f0c4c0;
  color: var(--color-danger);
}

.btn-danger-outline:hover:not(:disabled) {
  background: var(--color-danger-bg);
}

.btn-sm {
  padding: 0.38rem 0.75rem;
  font-size: var(--text-xs);
}

.btn-icon {
  padding: 0.45rem;
  width: 36px;
  height: 36px;
}

.view-toggle {
  display: inline-flex;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--color-surface);
}

.view-toggle .btn {
  border-radius: 0;
  border: none;
  border-right: 1px solid var(--color-border);
  box-shadow: none;
}

.view-toggle .btn:last-child {
  border-right: none;
}

.view-toggle .btn-primary {
  background: var(--color-accent-soft);
  color: var(--color-accent);
}

/* Forms */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.field label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
}

.field .hint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin: 0;
}

.input,
.select,
.textarea {
  width: 100%;
  padding: 0.62rem 0.8rem;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.input::placeholder,
.textarea::placeholder {
  color: var(--color-text-muted);
  opacity: 0.85;
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: #a8b8c9;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--color-focus);
  box-shadow: var(--shadow-focus);
  outline: none;
}

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

.input-error {
  border-color: var(--color-danger);
}

.field-error {
  color: var(--color-danger);
  font-size: var(--text-xs);
  margin: 0;
}

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

.form-grid .full {
  grid-column: 1 / -1;
}

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

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.18rem 0.55rem;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  line-height: 1.35;
  border: 1px solid transparent;
}

.badge-new {
  background: var(--color-new-bg);
  color: var(--color-new);
  border-color: rgba(13, 107, 99, 0.15);
}

.badge-closing {
  background: var(--color-closing-bg);
  color: var(--color-closing);
  border-color: rgba(180, 83, 12, 0.15);
}

.badge-neutral {
  background: var(--color-surface-muted);
  color: var(--color-text-secondary);
  border-color: var(--color-border);
}

.badge-success {
  background: var(--color-success-bg);
  color: var(--color-success);
  border-color: rgba(13, 107, 76, 0.14);
}

.badge-warning {
  background: var(--color-warning-bg);
  color: var(--color-warning);
  border-color: rgba(154, 91, 12, 0.14);
}

.badge-danger {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  border-color: rgba(180, 35, 24, 0.14);
}

.badge-info {
  background: var(--color-info-bg);
  color: var(--color-info);
  border-color: rgba(26, 79, 140, 0.14);
}

/* Cards / surfaces */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card-pad {
  padding: var(--space-5);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  transition: border-color var(--transition);
}

.stat-card:hover {
  border-color: var(--color-border-strong);
}

.stat-card .label {
  font-size: 0.68rem;
  color: var(--color-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  margin: 0 0 var(--space-2);
}

.stat-card .value {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 650;
  color: var(--color-text);
  margin: 0;
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--tracking-tight);
  line-height: 1.1;
}

.stat-card .meta {
  margin: var(--space-2) 0 0;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.stat-strip {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-6);
  padding: var(--space-3) 0;
  margin-bottom: var(--space-6);
  border-bottom: 1px solid var(--color-border);
  font-size: var(--text-sm);
}

.stat-strip .stat-inline {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  color: var(--color-text-secondary);
}

.stat-strip .stat-inline strong {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 650;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}

.stat-strip .stat-inline span {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-weight: 500;
}

/* Deal cards — distinctive B2B layout */
.deal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: var(--space-4);
}

/* Product imagery — page-tint wells so white JPEG pads read less boxy.
   Real transparency needs PNG/WebP alpha; multiply softens baked-in white. */
.product-media {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--color-bg);
  isolation: isolate;
}

.product-img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}

.product-media .product-img:not(.is-fallback):not([src^="data:image/svg"]) {
  mix-blend-mode: multiply;
}

.deal-card-media.product-media .product-img {
  object-fit: contain;
  object-position: center;
  padding: var(--space-4);
  box-sizing: border-box;
}

.deal-card-media.product-media .product-img.is-fallback {
  padding: var(--space-5);
  object-fit: contain;
}

/* Hide browser alt-text bleed over broken / fallback product art */
.product-img.is-fallback,
.product-media .product-img[src^="data:image/svg"] {
  color: transparent;
  text-indent: 0;
  font-size: 0;
  -webkit-user-select: none;
  user-select: none;
}

.top-deal-media .product-img {
  color: transparent;
  font-size: 0;
  -webkit-user-select: none;
  user-select: none;
}

/* Suppress broken-image icon flash before onerror swaps to fallback */
.product-img:-moz-broken,
.top-deal-media .product-img:-moz-broken,
.qb-item-thumb .product-img:-moz-broken {
  visibility: hidden;
}

.top-deal-media .product-img.is-fallback,
.top-deal-media .product-img[src^="data:image/svg"] {
  visibility: visible;
}

.product-media .product-img:not([src]),
.product-media .product-img[src=""] {
  visibility: hidden;
}

/* Suppress broken-image glyphs for retailer logos inside deal cards. */
.top-deal-retailer-logo img:-moz-broken,
.top-deal-retailer-logo img:not([src]),
.top-deal-retailer-logo img[src=""] {
  visibility: hidden;
}

.top-deal-retailer-logo img {
  color: transparent;
  font-size: 0;
  -webkit-user-select: none;
  user-select: none;
}

/* Title / price / meter are text-only — hide any stray broken-image glyphs */
.top-deal-body > img,
.top-deal-title img,
.top-deal-price-row img,
.top-deal-price-block img,
.buyer-pool-meter img,
.top-deal-retailer-logo img:-moz-broken {
  display: none !important;
}

.product-media--detail {
  min-height: 0;
  aspect-ratio: auto;
  border-radius: inherit;
  padding: 0;
  background: var(--color-bg);
}

.product-media--detail .product-img {
  object-fit: contain;
  object-position: center;
  border-radius: 0;
}

.deal-list-thumb {
  width: 96px;
  height: 96px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--color-bg);
  isolation: isolate;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border: 1px solid var(--color-border);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.deal-list-thumb .product-img:not(.is-fallback):not([src^="data:image/svg"]) {
  mix-blend-mode: multiply;
}

.deal-list-thumb .product-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  padding: 8px;
  box-sizing: border-box;
}

.image-preview-wrap {
  margin-top: var(--space-3);
  width: min(280px, 100%);
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  overflow: hidden;
  background: #ffffff;
}

.deal-image-field .field-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
}

.deal-dropzone {
  margin-top: var(--space-1);
  min-height: 168px;
  border: 1.5px dashed var(--color-border-strong);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, var(--color-accent-soft) 0%, var(--color-commission-bg) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
  cursor: pointer;
  position: relative;
  transition:
    border-color var(--transition),
    background var(--transition),
    box-shadow var(--transition);
}

.deal-dropzone:hover,
.deal-dropzone:focus-visible {
  border-color: var(--color-accent-mid);
  box-shadow: var(--shadow-sm);
  outline: none;
}

.deal-dropzone.is-dragover {
  border-color: var(--color-commission);
  border-style: solid;
  background: #dff0ef;
  box-shadow: var(--shadow-focus);
}

.deal-dropzone.is-busy {
  cursor: wait;
  pointer-events: none;
}

.deal-dropzone.is-busy .deal-dropzone-empty,
.deal-dropzone.is-busy .deal-dropzone-filled {
  opacity: 0.28;
}

.deal-dropzone-busy {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-4);
  text-align: center;
  z-index: 2;
}

.deal-dropzone-busy[hidden] {
  display: none !important;
}

.deal-dropzone-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--color-border-strong);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: deal-dropzone-spin 0.75s linear infinite;
}

@keyframes deal-dropzone-spin {
  to {
    transform: rotate(360deg);
  }
}

.deal-dropzone-busy-msg {
  margin: 0;
  max-width: 28ch;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
}

.deal-image-field > .hint {
  margin-top: 6px;
}

.deal-image-field > .hint a {
  font-weight: 600;
  text-decoration: none;
}

.deal-image-field > .hint a:hover {
  text-decoration: underline;
}

.deal-dropzone.has-image {
  cursor: default;
  background: var(--color-surface);
  border-style: solid;
  border-color: var(--color-border);
  justify-content: flex-start;
}

.deal-dropzone-empty,
.deal-dropzone-filled {
  width: 100%;
}

.deal-dropzone-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  text-align: center;
}

.deal-dropzone-empty[hidden],
.deal-dropzone-filled[hidden] {
  display: none !important;
}

.deal-dropzone-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0.7rem 1.15rem;
  border-radius: 999px;
  font-weight: 650;
}

.deal-dropzone-plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  font-size: 1.05rem;
  line-height: 1;
  font-weight: 700;
}

.deal-dropzone-or {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  font-weight: 500;
}

.deal-dropzone-filled {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--space-4);
}

.deal-dropzone-filled .image-preview-wrap {
  margin-top: 0;
  width: min(180px, 100%);
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.deal-image-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  max-width: 28rem;
  padding-top: 2px;
}

.deal-image-actions .hint {
  flex: 1 1 100%;
  margin: 0;
}

.deal-image-actions #image-status {
  color: var(--color-accent-bright);
  font-weight: 600;
}

.image-preview-wrap.product-media {
  background: #ffffff;
}

.image-preview-wrap.product-media .product-img {
  mix-blend-mode: normal;
}

.image-preview-wrap .image-preview,
.image-preview.product-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  padding: var(--space-4);
  box-sizing: border-box;
  border: none;
  border-radius: 0;
  background: transparent;
}

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

.deal-card {
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition:
    box-shadow var(--transition),
    border-color var(--transition),
    transform var(--transition);
  position: relative;
}

.deal-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-border-strong);
  transform: translateY(-2px);
}

.deal-card.is-new {
  box-shadow: inset 3px 0 0 var(--color-new);
}

.deal-card.is-new:hover {
  box-shadow: inset 3px 0 0 var(--color-new), var(--shadow-md);
}

.deal-card-title a {
  color: inherit;
  text-decoration: none;
}

.deal-card-title a:hover {
  color: var(--color-accent-mid);
}

.deal-card-media {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--color-bg);
  overflow: hidden;
  display: block;
}

.deal-card-img-link {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.deal-card-img-link:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: -2px;
}

.deal-card-media img,
.deal-card-img-link .product-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  transition: transform var(--transition-slow);
  pointer-events: none;
}

.deal-card:hover .deal-card-img-link .product-img:not(.is-fallback) {
  transform: scale(1.04);
}

.deal-card-badges {
  position: absolute;
  top: var(--space-3);
  left: var(--space-3);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  z-index: 2;
  pointer-events: none;
}

.deal-card-watch {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--color-text-muted);
  z-index: 3;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}

.deal-card-watch:hover {
  border-color: var(--color-border-strong);
  color: var(--color-text);
}

.deal-card-watch.active {
  color: var(--color-danger);
  border-color: #f0c4c0;
  background: var(--color-danger-bg);
}

.deal-card-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
  flex: 1;
}

.deal-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  font-size: 0.68rem;
  color: var(--color-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.deal-card-meta span:not(.badge)::after {
  content: "·";
  margin-left: var(--space-2);
  opacity: 0.45;
}

.deal-card-meta span:not(.badge):last-child::after {
  content: none;
}

.deal-card-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--color-text);
  line-height: 1.3;
}

.deal-card-model {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.deal-card-pricing {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-top: var(--space-2);
  padding: var(--space-3);
  background: var(--color-surface-muted);
  border-radius: var(--radius-md);
  /* Reserve 2-row height so cards don't shift when "Your earnings" is absent. */
  min-height: 6.25rem;
}

.deal-card-pricing div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.deal-card-pricing span {
  font-size: 0.68rem;
  color: var(--color-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.deal-card-pricing strong {
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.deal-card-pricing .commission-cell {
  border-left: 1px solid var(--color-border);
  padding-left: var(--space-3);
}

.deal-card-pricing .commission-cell strong {
  /* Match deal-card glossary payout "up" tone */
  color: #48bca2;
  font-size: var(--text-base);
}

.deal-card-progress {
  margin-top: var(--space-1);
}

.deal-card-progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: 6px;
  font-variant-numeric: tabular-nums;
}

.progress {
  height: 5px;
  background: var(--color-border);
  border-radius: 999px;
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--color-accent-mid), var(--color-accent-bright));
  border-radius: inherit;
  transition: width var(--transition-slow);
}

/* Buyer pool meter — percent only (no exact unit counts) */
.buyer-pool-meter {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  width: 100%;
}

.buyer-pool-meter-bar {
  flex: 1 1 auto;
  min-width: 0;
  height: 8px;
  background: #e6ebf1;
  border-radius: 999px;
  overflow: hidden;
}

.buyer-pool-meter-bar > span {
  display: block;
  height: 100%;
  background: var(--color-accent-mid);
  border-radius: inherit;
  transition: width var(--transition-slow);
}

.buyer-pool-meter-pct {
  flex: 0 0 auto;
  font-size: 0.82rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  color: var(--color-text);
  line-height: 1;
  min-width: 2.4rem;
  text-align: right;
}

.buyer-pool-meter.is-full .buyer-pool-meter-bar > span {
  background: var(--color-danger);
}

.buyer-pool-meter.is-full .buyer-pool-meter-pct {
  color: var(--color-danger);
}

.buyer-pool-meter--card {
  margin: 0.05rem 0;
}

.buyer-pool-meter--card .buyer-pool-meter-bar {
  height: 7px;
}

.buyer-pool-meter--inline {
  width: 100%;
  max-width: 9.5rem;
  margin: 0 auto;
}

.buyer-pool-meter--inline .buyer-pool-meter-bar {
  height: 6px;
}

.buyer-pool-meter--inline .buyer-pool-meter-pct {
  font-size: 0.72rem;
  min-width: 2rem;
}

.buyer-pool-meter--detail {
  max-width: 14rem;
  margin-left: auto;
}

.buyer-pool-meter--modal {
  max-width: 18rem;
}

.qb-deal-meter {
  margin: 0.35rem 0 0.85rem;
}

.dd-pool-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.dd-pool-payout {
  font-size: 0.68rem;
  color: var(--color-text-muted);
}

.deal-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: auto;
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
}

.deal-card-footer .ends {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.35;
}

.deal-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
  max-width: 100%;
}

.deal-list-item {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) auto;
  gap: var(--space-4);
  align-items: center;
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.deal-list-item:hover {
  border-color: var(--color-border-strong);
  box-shadow: var(--shadow-sm);
}

.deal-list-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: transparent;
}

.deal-list-item.is-new {
  box-shadow: inset 3px 0 0 var(--color-new);
}

.deal-list-item .list-commission {
  text-align: right;
}

.deal-list-item .list-commission span {
  display: block;
  font-size: 0.68rem;
  color: var(--color-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.deal-list-item .list-commission strong {
  color: var(--color-commission);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-base);
}

.list-actions {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  justify-content: flex-end;
}

@media (max-width: 720px) {
  .deal-list-item {
    grid-template-columns: 72px 1fr;
  }
  .deal-list-item .list-actions {
    grid-column: 1 / -1;
    justify-content: space-between;
  }
}

/* Chips / tabs */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  align-items: center;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.3rem 0.55rem 0.3rem 0.7rem;
  background: var(--color-accent-soft);
  color: var(--color-accent);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  border: 1px solid rgba(18, 48, 79, 0.1);
}

.chip button {
  border: none;
  background: rgba(18, 48, 79, 0.08);
  color: inherit;
  padding: 0;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  transition: background var(--transition);
}

.chip button:hover {
  background: rgba(18, 48, 79, 0.16);
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 0;
}

.tab {
  border: none;
  background: transparent;
  padding: var(--space-3) var(--space-3);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  position: relative;
  transition: color var(--transition), background var(--transition);
  margin-bottom: -1px;
}

.tab:hover {
  color: var(--color-text);
  background: var(--color-surface-muted);
}

.tab.active {
  color: var(--color-accent);
  background: transparent;
}

.tab.active::after {
  content: "";
  position: absolute;
  left: var(--space-2);
  right: var(--space-2);
  bottom: 0;
  height: 2px;
  background: var(--color-accent);
  border-radius: 2px 2px 0 0;
}

.tab .count {
  margin-left: 4px;
  color: var(--color-text-muted);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  min-width: 720px;
}

.table th,
.table td {
  padding: 0.7rem var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.table th {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--color-text-muted);
  background: var(--color-surface-muted);
  font-weight: 700;
  position: sticky;
  top: 0;
  white-space: nowrap;
}

.table th.sticky-col,
.table td.sticky-col {
  position: sticky;
  left: 0;
  background: var(--color-surface);
  z-index: 1;
  box-shadow: 4px 0 8px -4px rgba(12, 26, 43, 0.08);
}

.table th.sticky-col {
  background: var(--color-surface-muted);
  z-index: 2;
}

.table tr:last-child td {
  border-bottom: none;
}

.table tbody tr {
  transition: background var(--transition);
}

.table tbody tr:hover td {
  background: #f7fafc;
}

.table tbody tr:hover td.sticky-col {
  background: #f7fafc;
}

.table .row-identity {
  font-weight: 600;
  color: var(--color-text);
}

.table .row-meta {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-weight: 500;
  margin-top: 2px;
}

.table a.admin-table-link,
.admin-stack-list a.admin-table-link,
a.admin-table-link {
  color: var(--color-accent-mid);
  cursor: pointer;
  text-decoration: none;
}

.table a.admin-table-link.row-identity,
.table a.admin-table-link.row-meta,
.admin-stack-list a.admin-table-link.row-identity,
.admin-stack-list a.admin-table-link.row-meta {
  color: var(--color-accent-mid);
}

.table a.admin-table-link:hover,
.admin-stack-list a.admin-table-link:hover,
a.admin-table-link:hover {
  color: var(--color-accent);
  text-decoration: underline;
}

.table tr.is-highlighted td,
.table tr.is-highlighted td.sticky-col {
  background: var(--color-accent-soft);
}

/* Empty / alert states */
.empty-state {
  text-align: center;
  padding: var(--space-10) var(--space-5);
  background:
    linear-gradient(180deg, var(--color-surface-elevated), var(--color-surface));
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-xl);
}

.empty-state h3 {
  font-family: var(--font-display);
  margin-bottom: var(--space-2);
  font-weight: 600;
}

.empty-state p {
  max-width: 36ch;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: var(--space-4);
}

.empty-state .btn {
  margin-top: var(--space-1);
}

.alert {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-surface-muted);
  margin-bottom: var(--space-4);
  font-size: var(--text-sm);
}

.alert-info {
  background: var(--color-info-bg);
  border-color: #c5daf0;
  color: var(--color-info);
}

.alert-success {
  background: var(--color-success-bg);
  border-color: #b8e4d2;
  color: var(--color-success);
}

.alert-warning {
  background: var(--color-warning-bg);
  border-color: #f0d9a8;
  color: var(--color-warning);
}

.alert-danger {
  background: var(--color-danger-bg);
  border-color: #f0c4c0;
  color: var(--color-danger);
}

/* Avatar / notification bell */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background:
    linear-gradient(145deg, var(--color-accent), var(--color-accent-mid));
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: var(--text-sm);
  font-family: var(--font-display);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.user-chip .meta {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.user-chip .meta strong {
  font-size: var(--text-sm);
}

.user-chip .meta span {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.user-menu {
  position: relative;
  z-index: 10;
}

.user-chip-btn {
  border: 1px solid transparent;
  background: transparent;
  border-radius: 999px;
  padding: 4px 8px 4px 4px;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  transition: background var(--transition), border-color var(--transition);
}

.user-chip-btn:hover,
.user-chip-btn[aria-expanded='true'] {
  background: var(--color-surface-muted);
  border-color: var(--color-border);
}

.user-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 300px;
  max-width: min(300px, calc(100vw - 24px));
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  z-index: 500;
  padding: 4px 0;
  max-height: calc(100dvh - var(--chrome-h, 0px) - var(--header-height) - 16px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.user-menu-id {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  font-weight: 550;
  border-bottom: 1px solid var(--color-border);
}

.user-menu-ext {
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
}

.user-menu-ext:hover {
  color: var(--color-accent);
  background: var(--color-surface-muted);
}

.user-menu-section {
  padding: 8px;
  border-bottom: 1px solid var(--color-border);
}

.user-menu-section--footer {
  border-bottom: none;
}

.user-menu-heading {
  margin: 4px 8px 6px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #1a2b48;
}

.user-menu-panel a,
.user-menu-logout {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  background: transparent;
  border-radius: 8px;
  color: #5d7092;
  font-size: var(--text-sm);
  font-weight: 550;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  text-align: left;
}

.user-menu-panel a:hover,
.user-menu-logout:hover {
  background: var(--color-surface-muted);
  color: #1a2b48;
}

.user-menu-panel .icon {
  opacity: 0.85;
  flex-shrink: 0;
}

.account-link-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.account-link-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  text-decoration: none;
  color: var(--color-text);
  font-weight: 550;
}

.account-link-list a:hover {
  background: var(--color-surface-muted);
}

.session-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface-muted);
}

.session-row p {
  margin: 4px 0 0;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.bell-btn {
  position: relative;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  border-radius: var(--radius-sm);
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  color: var(--color-text-secondary);
  transition: border-color var(--transition), background var(--transition), color var(--transition);
}

.bell-btn:hover {
  border-color: var(--color-border-strong);
  color: var(--color-text);
  background: var(--color-surface-muted);
}

.bell-btn.bell-ping {
  animation: bell-ping 0.7s ease;
}

@keyframes bell-ping {
  0%,
  100% {
    transform: rotate(0deg);
  }
  20% {
    transform: rotate(14deg);
  }
  40% {
    transform: rotate(-12deg);
  }
  60% {
    transform: rotate(8deg);
  }
  80% {
    transform: rotate(-4deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .bell-btn.bell-ping {
    animation: none;
  }
}

.bell-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--color-danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 2px var(--color-surface);
}

/* Toast */
.toast-region {
  position: fixed;
  right: var(--space-4);
  bottom: var(--space-4);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-width: min(360px, calc(100vw - 2rem));
}

.toast {
  background: var(--color-accent);
  color: #f0f5fa;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  animation: toast-in 220ms cubic-bezier(0.22, 1, 0.36, 1);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.toast-title {
  font-weight: 600;
  line-height: 1.3;
}

.toast-body {
  margin-top: 2px;
  font-size: var(--text-xs);
  line-height: 1.35;
  color: rgba(240, 245, 250, 0.82);
}

.toast a {
  color: #9ec5e8;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Modal / drawer */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(12, 26, 43, 0.48);
  z-index: 80;
  display: grid;
  place-items: center;
  padding: var(--space-4);
  animation: soft-in 160ms ease;
  backdrop-filter: blur(2px);
}

.modal {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  width: min(520px, 100%);
  max-height: min(90vh, 800px);
  overflow: auto;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--color-border);
  animation: fade-up 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.modal--wide {
  width: min(960px, 100%);
}

.modal--pop {
  animation: modal-pop 280ms cubic-bezier(0.22, 1, 0.36, 1);
}

.modal-backdrop.is-closing {
  animation: soft-out 200ms ease forwards;
}

.modal-backdrop.is-closing .modal--pop {
  animation: modal-pop-out 200ms ease forwards;
}

@keyframes modal-pop {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes modal-pop-out {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
}

@keyframes soft-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border);
}

.modal-header h2 {
  margin: 0;
  font-size: var(--text-lg);
}

.modal-body {
  padding: var(--space-5);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--color-border);
  background: var(--color-surface-muted);
}

.modal--glossary {
  width: min(640px, 100%);
}

.modal--glossary .modal-body {
  padding-top: var(--space-4);
}

.modal--glossary .modal-footer {
  background: #fff;
}

/* Deal Card Glossary */
.glossary-lead {
  margin: 0 0 var(--space-4);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

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

.glossary-row {
  display: grid;
  grid-template-columns: minmax(120px, 160px) 1fr;
  gap: var(--space-4);
  align-items: start;
  padding: 0.95rem 0;
  border-bottom: 1px solid #e8eef4;
}

.glossary-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.glossary-sample {
  display: flex;
  align-items: center;
  min-height: 1.5rem;
}

.glossary-delta {
  font-size: 0.9rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.glossary-delta.is-up {
  color: #48bca2;
}

.glossary-delta.is-down {
  color: #cfb04c;
}

.glossary-delta.is-flat {
  color: #3b82c4;
}

.glossary-stock {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #5b4db8;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  line-height: 1;
}

.glossary-deadline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #d4547a;
  font-weight: 650;
  font-size: 0.9rem;
}

.glossary-fav {
  color: #c9a227;
  display: inline-flex;
}

.glossary-copy {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: 1.45;
}

.glossary-term--up {
  color: #2a9d82;
}

.glossary-term--flat {
  color: #3b82c4;
}

.glossary-term--down {
  color: #b8962f;
}

.glossary-term--stock {
  color: #5b4db8;
}

.glossary-term--deadline {
  color: #d4547a;
}

.glossary-term--fav {
  color: #c9a227;
}

@media (max-width: 800px) {
  .glossary-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(400px, 100vw);
  height: 100vh;
  background: var(--color-surface);
  z-index: 90;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: drawer-in 240ms cubic-bezier(0.22, 1, 0.36, 1);
  border-left: 1px solid var(--color-border);
}

@keyframes drawer-in {
  from { transform: translateX(100%); }
  to { transform: none; }
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border);
}

.drawer-header h2 {
  margin: 0;
  font-size: var(--text-lg);
}

.drawer-body {
  padding: var(--space-4);
  overflow: auto;
  flex: 1;
  background: linear-gradient(180deg, var(--color-surface) 0%, var(--color-surface-muted) 120%);
}

.notif-item {
  padding: var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  margin-bottom: var(--space-2);
  background: var(--color-surface);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.notif-item:hover {
  border-color: var(--color-border-strong);
}

.notif-item.unread {
  background: var(--color-info-bg);
  border-color: #c5daf0;
  box-shadow: inset 3px 0 0 var(--color-info);
}

.notif-item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: 4px;
}

.notif-item h4 {
  margin: 0;
  font-size: var(--text-sm);
  flex: 1;
  min-width: 0;
}

.notif-dismiss {
  flex-shrink: 0;
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin: -4px -4px 0 0;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  opacity: 0.55;
  transition: opacity var(--transition), color var(--transition), background var(--transition);
}

.notif-item:hover .notif-dismiss,
.notif-dismiss:focus-visible {
  opacity: 1;
}

.notif-dismiss:hover {
  color: var(--color-accent);
  background: var(--color-surface-muted);
}

.notif-dismiss:focus-visible {
  outline: 2px solid var(--color-accent-mid);
  outline-offset: 1px;
}

.notif-item p {
  margin: 0;
  font-size: var(--text-xs);
}

.notif-item time {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  display: block;
  margin-top: 6px;
}

/* Pagination / toolbar */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.toolbar-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.search-field {
  position: relative;
  min-width: min(280px, 100%);
}

.search-field .icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  pointer-events: none;
  display: grid;
  place-items: center;
}

.search-field .input {
  padding-left: 2.35rem;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-5);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

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

.pagination-controls .btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* —— Deals browse toolbar (connected under header) —— */
.deals-page {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  max-width: 100%;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overflow-x: clip;
  position: relative;
  z-index: 0;
}

.deals-page-body {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  width: 100%;
  max-width: none;
  overflow-y: auto;
  overflow-x: clip;
  scrollbar-gutter: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 var(--space-6) var(--space-4);
  box-sizing: border-box;
  position: relative;
  z-index: 0;
  -webkit-overflow-scrolling: touch;
}

.deals-page-body .deal-grid--browse,
.deals-page-body .deal-list {
  box-sizing: border-box;
  padding-inline-end: var(--scroll-content-gap);
}

@media (max-width: 960px) {
  .deals-page-body {
    padding-inline: var(--space-4);
  }
}

@media (max-width: 640px) {
  .deals-page-body {
    padding-inline: var(--space-3);
  }
}

.deals-toolbar-bar {
  background: #fff;
  border-bottom: 1px solid var(--color-border);
  padding: 8px var(--space-6);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.deals-page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
}

.deals-page-head-main {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2) var(--space-3);
}

.deals-page-actions {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.deals-action-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #b8c9da;
  background: #fff;
  color: #334155;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 650;
  padding: 0.45rem 0.9rem;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.deals-action-btn:hover {
  border-color: #8aa3bc;
  background: #f8fafc;
  box-shadow: 0 0 0 3px rgba(42, 82, 120, 0.1);
}

.deals-page-title {
  margin: 0;
  font-size: var(--text-xl);
  font-weight: 700;
  font-family: var(--font-sans);
  letter-spacing: -0.02em;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.deals-page-title .dash-refresh {
  width: 30px;
  height: 30px;
}

.deals-page-sub {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

.deals-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  min-width: 0;
  max-width: 100%;
}

.deals-toolbar-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
}

.deals-toolbar-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex: 0 1 auto;
  min-width: 0;
  margin-left: auto;
}

.deals-pills {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 5px;
}

.deals-pill {
  appearance: none;
  border: 1px solid #cdd6e1;
  background: #fff;
  color: #3d4a5c;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 650;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.2;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.deals-pill:hover {
  border-color: #9aadc0;
  color: #1a2b48;
}

.deals-pill.is-active {
  background: #12304f;
  border-color: #12304f;
  color: #fff;
}

.deals-menu {
  position: relative;
}

.deals-menu-toggle {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid #cdd6e1;
  background: #fff;
  color: #334155;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.28rem 0.6rem;
  border-radius: 8px;
  cursor: pointer;
  max-width: 170px;
  white-space: nowrap;
  line-height: 1.2;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.deals-menu-toggle:hover {
  border-color: #8aa3bc;
  background: #f8fafc;
}

.deals-menu.is-open .deals-menu-toggle {
  border-color: #2a5278;
  box-shadow: 0 0 0 3px rgba(42, 82, 120, 0.12);
}

.deals-menu-toggle.has-value {
  border-color: #2a5278;
  color: #12304f;
  background: #eef4fa;
}

.deals-menu-label {
  color: inherit;
  white-space: nowrap;
}

.deals-menu-value {
  display: none;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.85;
  font-weight: 500;
}

.deals-menu-toggle.has-value .deals-menu-value {
  display: inline;
}

.deals-menu-toggle.has-value .deals-menu-label::after {
  content: ' ·';
}

.deals-menu-caret {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.7;
}

.deals-menu-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 140;
  min-width: 220px;
  max-width: 280px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
  padding: 8px;
}

.deals-menu-options {
  max-height: 220px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.deals-menu-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: var(--text-sm);
  color: var(--color-text);
  cursor: pointer;
}

.deals-menu-option:hover {
  background: var(--color-surface-muted);
}

.deals-menu-option input {
  accent-color: var(--color-accent);
}

.deals-menu-panel--deal-type {
  min-width: 168px;
  padding: 0;
  overflow: hidden;
}

.deals-menu-options--deal-type {
  max-height: none;
  gap: 0;
  overflow: visible;
}

.deals-type-option {
  appearance: none;
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  border-bottom: 1px solid #eef1f5;
  background: #fff;
  color: var(--color-text);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 500;
  padding: 0.7rem 0.95rem;
  cursor: pointer;
  line-height: 1.25;
}

.deals-type-option:last-child {
  border-bottom: none;
}

.deals-type-option:hover {
  background: #f4f7fa;
}

.deals-type-option.is-active {
  background: var(--color-accent-soft);
  color: var(--color-accent);
  font-weight: 650;
}

.deals-menu-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  padding-top: 8px;
  margin-top: 6px;
  border-top: 1px solid var(--color-border);
}

.deals-sort-btn,
.deals-view-toggle {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid #cdd6e1;
  background: #fff;
  color: #334155;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.28rem 0.6rem;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.2;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.deals-sort-btn:hover,
.deals-view-toggle:hover {
  border-color: #8aa3bc;
  background: #f8fafc;
}

.deals-sort-menu.is-open .deals-sort-btn,
.deals-view-menu.is-open .deals-view-toggle {
  border-color: #2a5278;
  box-shadow: 0 0 0 3px rgba(42, 82, 120, 0.12);
}

.deals-sort-btn .icon,
.deals-view-toggle .icon {
  color: #475569;
  flex-shrink: 0;
}

.deals-sort-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 140;
  min-width: 240px;
  max-width: 280px;
  max-height: 280px;
  overflow: auto;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
  padding: 0;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.deals-sort-menu .deals-sort-panel {
  left: auto;
  right: 0;
}

.deals-view-panel {
  min-width: 160px;
  max-height: none;
}

.deals-sort-option {
  appearance: none;
  display: block;
  width: 100%;
  border: none;
  border-bottom: 1px solid #e8eef4;
  background: #fff;
  color: #334155;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  text-align: left;
  padding: 0.85rem 1.1rem;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.deals-sort-option:last-child {
  border-bottom: none;
}

.deals-sort-option:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.deals-sort-option.is-active {
  background: #eef6f3;
  color: #0f3d32;
  font-weight: 650;
}

.deal-grid--browse {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 1rem;
  align-items: start;
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

@media (min-width: 1100px) {
  .deal-grid--browse {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1500px) {
  .deal-grid--browse {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.deal-grid--browse .top-deal-card {
  height: auto;
  min-height: 0;
  align-self: start;
  overflow: hidden;
}

/* Browse cards: full-bleed hero image, stacked content, dual CTAs */
.deal-grid--browse .top-deal-media {
  height: clamp(200px, 16vw, 240px);
  aspect-ratio: auto;
  margin: 0;
  background: var(--color-bg);
}

.deal-grid--browse .top-deal-media .product-img {
  padding: 0.75rem 0.9rem;
}

.deal-grid--browse .top-deal-body {
  flex: 0 0 auto;
  gap: 0.55rem;
  padding: 0.65rem 0.9rem 0.9rem;
}

.deal-grid--browse .top-deal-title {
  font-size: 0.92rem;
  line-height: 1.35;
}

.deal-grid--browse .top-deal-price {
  font-size: 1.3rem;
}

.deal-grid--browse .top-deal-info-bar {
  min-height: 2.4rem;
}

.deal-grid--browse .top-deal-footer {
  margin-top: 0.1rem;
  padding-top: 0;
}

.deal-grid--browse .top-deal-buy,
.deal-grid--browse .top-deal-view-deal {
  min-height: 40px;
}

@media (max-width: 640px) {
  .deal-grid--browse .top-deal-media {
    height: clamp(190px, 56vw, 230px);
  }

  .deal-grid--browse .top-deal-body {
    padding: 0.6rem 0.75rem 0.8rem;
  }
}

.deals-search {
  position: relative;
  width: 168px;
  flex: 0 0 168px;
  min-width: 140px;
  max-width: 190px;
}

.deals-search-icon {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: #8a9aab;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.deals-search input {
  width: 100%;
  border: 1px solid #cdd6e1;
  border-radius: 999px;
  padding: 0.28rem 0.65rem 0.28rem 1.7rem;
  font: inherit;
  font-size: 0.75rem;
  color: var(--color-text);
  background: #fff;
  line-height: 1.2;
}

.deals-search input:focus {
  outline: none;
  border-color: #2a5278;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(42, 82, 120, 0.12);
}

.deals-chips {
  margin-top: 0;
}

@media (max-width: 1100px) {
  .deals-toolbar {
    flex-wrap: wrap;
    gap: 8px;
  }

  .deals-toolbar-left {
    flex-wrap: wrap;
  }

  .deals-toolbar-right {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }

  .deals-search {
    flex: 1 1 160px;
    width: auto;
    max-width: none;
  }
}

@media (max-width: 900px) {
  .deals-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .deals-toolbar-left,
  .deals-toolbar-right {
    width: 100%;
  }

  .deals-toolbar-right {
    flex-wrap: wrap;
  }

  .deals-pills {
    flex-wrap: wrap;
  }

  .deals-search {
    flex: 1 1 100%;
    width: 100%;
    max-width: none;
  }
}

@media (max-width: 960px) {
  .app-header-sub .deals-toolbar-bar {
    padding: 8px var(--space-4);
  }
}


.filter-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-4);
  position: sticky;
  top: calc(var(--chrome-h, 0px) + var(--header-height) + var(--space-4));
  box-shadow: var(--shadow-sm);
}

.filter-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border);
}

.filter-panel-head h3 {
  font-family: var(--font-display);
  font-size: var(--text-base);
  margin: 0;
  font-weight: 650;
}

.filter-group {
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.filter-group:last-of-type {
  border-bottom: none;
}

.filter-group legend,
.filter-group .filter-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
  display: block;
}

.filter-group > label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  font-weight: 500;
  margin-bottom: 6px;
}

.check-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 160px;
  overflow: auto;
  padding-right: 4px;
}

.check-list label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  font-weight: 500;
  padding: 2px 0;
}

.check-list input,
.filter-group input[type="checkbox"] {
  accent-color: var(--color-accent);
}

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

.filter-drawer-toggle {
  display: none;
}

@media (max-width: 960px) {
  .browse-layout {
    grid-template-columns: 1fr;
  }

  .filter-panel {
    display: none;
    position: fixed;
    inset: auto 0 0 0;
    top: auto;
    max-height: 88vh;
    overflow: auto;
    z-index: 70;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    box-shadow: var(--shadow-lg);
    padding-bottom: calc(var(--space-6) + env(safe-area-inset-bottom, 0));
  }

  .filter-panel.open {
    display: block;
    animation: drawer-up 240ms cubic-bezier(0.22, 1, 0.36, 1);
  }

  @keyframes drawer-up {
    from { transform: translateY(100%); }
    to { transform: none; }
  }

  .filter-drawer-toggle {
    display: inline-flex;
  }

  .filter-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(12, 26, 43, 0.42);
    z-index: 65;
  }

  .filter-backdrop.open {
    display: block;
    animation: soft-in 160ms ease;
  }
}

.section {
  margin-bottom: var(--space-8);
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.section-header h2 {
  margin: 0;
}

.section-header a {
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.mobile-cards {
  display: none;
}

@media (max-width: 1100px) {
  .hide-mobile-table.admin-table-wrap,
  .hide-mobile-table .table-wrap,
  .table-wrap.hide-mobile-table {
    display: none;
  }
  .mobile-cards,
  .admin-stack-list.mobile-cards {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
  }
}

@media (max-width: 720px) {
  .mobile-cards {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
  }
  .mobile-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    box-shadow: var(--shadow-sm);
  }
  .mobile-card h3 {
    margin: 0 0 var(--space-2);
    font-family: var(--font-display);
    font-size: var(--text-base);
  }
  .mobile-card dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px 14px;
    margin: 0 0 var(--space-3);
    font-size: var(--text-sm);
  }
  .mobile-card dt {
    color: var(--color-text-muted);
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
  }
  .mobile-card dd {
    margin: 0;
    font-weight: 500;
  }
  .mobile-card .mobile-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    padding-top: var(--space-3);
    border-top: 1px solid var(--color-border);
  }

  /* Prefer dense admin stack over soft mobile cards when both exist */
  .admin-stack-list.mobile-cards {
    gap: var(--space-2);
  }
  .admin-stack-list.mobile-cards .admin-stack-row {
    box-shadow: none;
    border-radius: var(--radius-sm);
  }
}
