:root {
  --bg: #f3f6fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --accent: #0f766e;
  --accent-weak: #d1fae5;
  --border: #e5e7eb;
  --error: #b91c1c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background: linear-gradient(160deg, #eef6ff 0%, #f5fff7 100%);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  background: rgba(248, 250, 252, 0.96);
  backdrop-filter: blur(3px);
  padding: 10px 14px;
}

.menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  color: #111827;
}

.topbar-title {
  font-weight: 700;
}

.topbar-page {
  color: var(--muted);
  font-size: 14px;
}

.side-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(300px, 86vw);
  background: #ffffff;
  border-right: 1px solid var(--border);
  padding: 18px 14px;
  z-index: 40;
  transform: translateX(-102%);
  transition: transform 180ms ease-out;
  display: grid;
  align-content: start;
  gap: 8px;
}

.side-drawer.open {
  transform: translateX(0);
}

.drawer-title {
  font-weight: 700;
  margin-bottom: 8px;
}

.drawer-section-title {
  margin-top: 8px;
  margin-bottom: 4px;
  padding: 0 2px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.32);
  z-index: 35;
}

.drawer-backdrop.hidden {
  display: none;
}

.side-link {
  display: block;
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 10px;
  background: #fff;
}

.side-link.active {
  border-color: var(--accent);
  background: #ecfeff;
  color: #0f766e;
  font-weight: 600;
}

.container {
  max-width: 1100px;
  margin: 32px auto;
  padding: 0 16px 24px;
}

h1 {
  margin: 0 0 8px;
}

h2 {
  margin: 0 0 12px;
}

.sub {
  margin-top: 0;
  color: var(--muted);
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin: 14px 0;
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.search-inline {
  justify-content: flex-start;
}

.search-inline label {
  margin-right: 2px;
  white-space: nowrap;
}

.toolbar {
  margin-top: 10px;
}

input[type="text"] {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 15px;
}

input[type="number"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 15px;
}

input[type="range"] {
  width: 100%;
}

select {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 15px;
  background: #fff;
}

button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  padding: 9px 12px;
  cursor: pointer;
}

.link-button {
  border: 0;
  background: transparent;
  color: #0f766e;
  padding: 0;
  border-radius: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.link-button:hover {
  color: #115e59;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

body.drawer-open {
  overflow: hidden;
}

.menu-toggle {
  border: 1px solid var(--border);
  background: #fff;
  color: #111827;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--border);
  text-align: left;
  padding: 8px;
  vertical-align: top;
  font-size: 14px;
}

th.sortable {
  cursor: pointer;
  user-select: none;
}

th.sortable::after {
  content: " \2195";
  color: #9ca3af;
  font-size: 12px;
}

th.sortable.sort-asc::after {
  content: " \2191";
  color: #111827;
}

th.sortable.sort-desc::after {
  content: " \2193";
  color: #111827;
}

th.sortable.sort-active {
  color: #0f766e;
}

tbody tr {
  cursor: pointer;
}

tbody tr.selected {
  background: var(--accent-weak);
}

tbody tr.dragging {
  opacity: 0.55;
}

.thumb {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}

pre {
  white-space: pre-wrap;
  background: #0b1220;
  color: #dbeafe;
  border-radius: 10px;
  padding: 10px 12px;
  min-height: 48px;
}

pre.error {
  color: #fecaca;
}

.summary {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
}

.home-own-summary {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 18px;
  margin-bottom: 14px;
  padding: 16px 18px;
  border: 1px solid #dbe4ef;
  border-radius: 14px;
  background: #fbfdff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.home-own-ring-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  border-right: 1px solid #e5e7eb;
  padding-right: 16px;
}

.home-own-ring {
  --coverage-deg: 0deg;
  width: 82px;
  height: 82px;
  border-radius: 9999px;
  background: conic-gradient(#7ba9d4 var(--coverage-deg), #e5e7eb 0deg);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.home-own-ring::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 9999px;
  background: #ffffff;
}

.home-own-ring-pct {
  position: relative;
  z-index: 1;
  font-size: 24px;
  line-height: 1;
  font-weight: 700;
  color: #5e93c4;
}

.home-own-ring-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.home-own-ring-label {
  font-size: 14px;
  font-weight: 800;
  color: #374151;
}

.home-own-ring-meta {
  font-size: 13px;
  color: #64748b;
  line-height: 1.3;
}

.home-own-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
}

.home-own-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 16px;
}

.home-own-stat:first-child {
  padding-left: 0;
}

.home-own-stat:not(:first-child) {
  border-left: 1px solid #e5e7eb;
}

.home-own-stat-label {
  font-size: 14px;
  color: #64748b;
  font-weight: 700;
}

.home-own-pct {
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}

.home-own-pct.best {
  color: #5d9d6b;
}

.home-own-pct.equal {
  color: #ba9a4e;
}

.home-own-pct.worse {
  color: #b95a55;
}

.home-own-pct.na {
  color: #5f78be;
}

.home-own-qty {
  font-size: 15px;
  color: #475569;
  font-weight: 600;
  line-height: 1.1;
}

.home-own-stat > div:last-child {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
}

@media (max-width: 980px) {
  .home-own-summary {
    grid-template-columns: 1fr;
  }
  .home-own-ring-wrap {
    border-right: 0;
    border-bottom: 1px solid #e2e8f0;
    padding-right: 0;
    padding-bottom: 12px;
  }
  .home-own-stat {
    padding: 0 12px;
  }
  .home-own-pct {
    font-size: 20px;
  }
  .home-own-qty {
    font-size: 14px;
  }
}

@media (max-width: 640px) {
  .home-own-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .home-own-stat {
    border-left: 0 !important;
    padding: 8px 0;
  }
}

.rule-toolbar {
  justify-content: space-between;
}

.rule-toolbar h2 {
  margin: 0;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  z-index: 30;
}

.modal.hidden {
  display: none;
}

.modal-panel {
  width: min(1000px, 100%);
  max-height: 85vh;
  overflow: auto;
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 12px;
}

.rules-modal-panel {
  width: min(860px, 100%);
}

.delete-confirm-panel {
  width: min(480px, 100%);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tabs {
  display: flex;
  gap: 8px;
  margin: 10px 0 12px;
}

.tab-btn {
  background: #fff;
  color: #374151;
  border: 1px solid var(--border);
}

.tab-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: #ecfeff;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.tab-panel label {
  display: block;
  margin-top: 10px;
  margin-bottom: 4px;
  font-size: 14px;
  color: #374151;
}

.tab-panel input[type="text"],
.tab-panel input[type="number"],
.tab-panel select {
  width: 100%;
}

.inline-fields {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.inline-fields-conditions .field {
  flex: 1 1 260px;
}

.inline-fields-conditions .field:first-child {
  flex: 1.2 1 320px;
}

.inline-fields-conditions #brand-value-field {
  flex: 1 1 100%;
  max-width: 100%;
}

.check-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.schedule-toggle-row {
  width: 100%;
  justify-content: flex-start;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #dbe7f3;
  border-radius: 12px;
  background: #f8fafc;
}

.schedule-toggle-row input[type="checkbox"] {
  margin-top: 2px;
  width: 18px;
  height: 18px;
  accent-color: #0f766e;
}

.schedule-toggle-copy {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
}

.schedule-toggle-title {
  font-weight: 600;
  color: #334155;
}

.schedule-toggle-sub {
  font-size: 12px;
  color: #64748b;
}

.brand-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.brand-badges .js-remove-brand {
  border: 1px solid #0f766e;
  background: #ccfbf1;
  color: #0f172a;
  font-size: 13px;
  font-weight: 700;
  padding: 7px 12px;
}

.brand-badges .js-remove-brand:hover {
  background: #99f6e4;
}

.days-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}

.days-grid label {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #d5dee9;
  border-radius: 12px;
  background: #fff;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: #334155;
  transition: border-color 0.16s ease, background-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.days-grid label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #0f766e;
}

.days-grid label:has(input[type="checkbox"]:checked) {
  border-color: #0f766e;
  background: #ecfeff;
  color: #0f766e;
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.12);
}

.field {
  flex: 1 1 250px;
}

.modal-actions {
  margin-top: 14px;
}

.row-tight {
  gap: 6px;
}

.hidden {
  display: none !important;
}

.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #cbd5e1;
  transition: 0.2s;
  border-radius: 999px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  top: 3px;
  background-color: #fff;
  transition: 0.2s;
  border-radius: 50%;
}

.switch input:checked + .slider {
  background-color: #10b981;
}

.switch input:checked + .slider:before {
  transform: translateX(20px);
}

.ghost {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  border: 1px solid var(--border);
}

.badge.prime {
  background: #fff7ed;
  border-color: #fdba74;
  color: #9a3412;
}

.prime-wordmark {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.prime-wordmark-icon {
  height: 18px;
  width: auto;
  display: block;
}

.badge.buybox {
  background: #ecfdf5;
  border-color: #6ee7b7;
  color: #065f46;
}

.badge.fba {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
}

@media (max-width: 700px) {
  .days-grid {
    grid-template-columns: repeat(3, minmax(80px, 1fr));
  }

  .inline-fields-conditions .field,
  .inline-fields-conditions .field:first-child {
    flex: 1 1 100%;
  }

  .container {
    margin-top: 18px;
  }
}

/* Repricing Rules visual refresh */
.rules-theme {
  background: #f8fafc;
}

.rules-theme .topbar {
  border-bottom: 1px solid #e2e8f0;
  background: rgba(255, 255, 255, 0.88);
}

.rules-container {
  max-width: 1180px;
}

.rules-container .card {
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.06);
  padding: 18px;
}

.rules-container h1 {
  font-size: 30px;
}

.rules-container .sub {
  color: #475569;
}

.rules-container input[type="text"],
.rules-container input[type="number"],
.rules-container select {
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(15, 23, 42, 0.02);
  height: 48px;
  min-height: 48px;
  padding: 0 14px;
  line-height: 1.2;
  box-sizing: border-box;
  font: inherit;
  display: block;
  width: 100%;
}

.rules-container select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M5 7.5L10 12.5L15 7.5' stroke='%23334155' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 18px 18px;
}

.rules-container input[type="text"]:focus,
.rules-container input[type="number"]:focus,
.rules-container select:focus {
  outline: none;
  border-color: #0ea5a5;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.15);
}

.rules-container table th {
  background: #f8fafc;
  color: #334155;
  font-weight: 600;
  border-bottom: 1px solid #e2e8f0;
}

.rules-container table td {
  border-bottom: 1px solid #eef2f7;
}

.rules-container table tbody tr:hover {
  background: #f8fafc;
}

.rules-container .rule-toolbar {
  margin-bottom: 10px;
}

.auto-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.auto-enabled-row {
  margin: 0;
  height: 48px;
  border: 1px solid #dbe7f3;
  border-radius: 12px;
  background: #f8fafc;
  padding: 10px 12px;
  align-items: center;
}

.auto-enabled-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #0f766e;
}

.rules-container .tabs {
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 10px;
}

.rules-container .tab-btn {
  border-radius: 999px;
  padding: 8px 14px;
}

.rules-container .tab-btn.active {
  background: linear-gradient(135deg, #0ea5a5, #14b8a6);
  color: #fff;
  border-color: #0f766e;
}

.time-range-wrap {
  border: 1px solid #d9e9ff;
  border-radius: 14px;
  background: linear-gradient(180deg, #f8fbff 0%, #f2faff 100%);
  padding: 12px 14px;
}

.time-range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 10px;
}

.dual-range {
  position: relative;
  height: 28px;
}

.dual-range-track {
  position: absolute;
  top: 12px;
  left: 0;
  right: 0;
  height: 6px;
  border-radius: 999px;
  background: #d5dee9;
}

.dual-range-fill {
  position: absolute;
  top: 12px;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, #22d3ee, #14b8a6);
}

.dual-range input[type="range"] {
  position: absolute;
  left: 0;
  right: 0;
  top: 12px;
  width: 100%;
  height: 6px;
  margin: 0;
  background: transparent;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
}

.dual-range input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  background: transparent;
}

.dual-range input[type="range"]::-moz-range-track {
  height: 4px;
  background: transparent;
}

.dual-range input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #0f766e;
  background: #fff;
  margin-top: -6px;
  pointer-events: auto;
  box-shadow: 0 2px 8px rgba(15, 118, 110, 0.25);
}

.dual-range input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #0f766e;
  background: #fff;
  pointer-events: auto;
  box-shadow: 0 2px 8px rgba(15, 118, 110, 0.25);
}

#schedule-window-wrap {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #fff;
  padding: 14px;
}

#time-range-preview {
  margin-top: 10px;
  font-weight: 600;
  color: #334155;
}

.rules-theme .modal-panel {
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.22);
}

.rules-theme .modal-actions {
  justify-content: space-between;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(15, 23, 42, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.loading-overlay.hidden {
  display: none;
}

.loading-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  min-width: 260px;
  padding: 16px 20px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
}

.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid #cbd5e1;
  border-top-color: #0f766e;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-text {
  font-size: 14px;
  color: #334155;
  font-weight: 600;
}

.loading-content {
  min-width: 220px;
}

.loading-progress-wrap {
  margin-top: 8px;
}

.loading-progress-wrap.hidden {
  display: none;
}

.loading-progress-track {
  height: 8px;
  width: 100%;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.loading-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #22c55e, #16a34a);
  transition: width 160ms linear;
}

.loading-progress-pct {
  margin-top: 4px;
  font-size: 12px;
  color: #64748b;
  font-weight: 600;
}

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

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

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

/* Home dashboard SaaS polish */
.home-dashboard-page {
  max-width: 1240px;
}

.home-dashboard-page h1 {
  letter-spacing: -0.02em;
}

#home-toolbar-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 251, 255, 0.96) 100%);
  border-color: #dbe5f2;
}

#home-toolbar-card .inline-flex.rounded-xl {
  border-color: #d5e2f0;
  background: #f7fafc;
  padding: 4px;
  border-radius: 12px;
}

#home-toolbar-card #tab-supplier,
#home-toolbar-card #tab-competitor {
  min-width: 122px;
  border-radius: 10px;
  transition: all 0.18s ease;
}

#home-toolbar-card #tab-supplier:not(.bg-white),
#home-toolbar-card #tab-competitor:not(.bg-white) {
  color: #64748b;
}

#home-toolbar-card #tab-supplier:hover,
#home-toolbar-card #tab-competitor:hover {
  color: #334155;
}

#home-toolbar-card #build-report-btn,
#home-toolbar-card #download-report-btn,
#home-toolbar-card #sync-catalog-btn {
  height: 42px;
  border-radius: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

#home-count-info {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border: 1px solid #dbe4ef;
  border-radius: 10px;
  background: #ffffff;
  color: #334155;
  font-weight: 600;
}

#home-built-at {
  color: #64748b;
  font-weight: 600;
}

#home-sync-line {
  margin-top: 10px;
  padding: 7px 11px;
  border: 1px dashed #d2ddea;
  border-radius: 10px;
  background: #f8fbff;
  color: #6b7c93;
}

#home-table-card {
  background: #ffffff;
  border-color: #dbe5f2;
}

.home-own-summary {
  border-color: #d9e5f3;
  background: linear-gradient(180deg, #fbfdff 0%, #f8fbff 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95);
  padding: 14px 16px;
  margin-bottom: 12px;
}

.home-own-ring-wrap {
  border-right-color: #e2e8f0;
  gap: 12px;
}

.home-own-ring {
  width: 72px;
  height: 72px;
  background: conic-gradient(#76a6d4 var(--coverage-deg), #e7edf5 0deg);
}

.home-own-ring::after {
  inset: 7px;
  background: #ffffff;
}

.home-own-ring-pct {
  font-size: 22px;
  color: #4f89bf;
}

.home-own-ring-label {
  font-size: 13px;
  color: #334155;
}

.home-own-ring-meta {
  font-size: 12.5px;
  color: #64748b;
}

.home-own-stats-grid {
  gap: 10px;
}

.home-own-stat {
  border: 1px solid #e4ebf4;
  border-radius: 10px;
  padding: 10px 12px !important;
  background: #ffffff;
  min-height: 76px;
}

.home-own-stat:first-child,
.home-own-stat:not(:first-child) {
  border-left: 1px solid #e4ebf4;
}

.home-own-stat-label {
  font-size: 13px;
  color: #64748b;
}

.home-own-pct {
  font-size: 30px;
  font-weight: 700;
}

.home-own-pct.best {
  color: #4a8d58;
}

.home-own-pct.equal {
  color: #9f833c;
}

.home-own-pct.worse {
  color: #a65451;
}

.home-own-pct.na {
  color: #4d67b0;
}

.home-own-qty {
  color: #475569;
  font-size: 15px;
}

#home-table-card #brand-filter {
  height: 46px;
  border-radius: 11px;
}

#home-table-card #home-page-info {
  background: #f1f5f9;
  color: #475569;
  font-weight: 700;
}

#home-table-card table thead th {
  background: #f7f9fc;
  color: #334155;
  font-size: 12px;
  letter-spacing: 0.03em;
}

#home-table-card table tbody tr:hover {
  background: #fafcff;
}

#home-table-card table tbody td {
  color: #334155;
}

#home-table-card .underline {
  text-decoration-color: #9cc0e6;
  text-underline-offset: 3px;
}

#home-table-card #home-prev-page,
#home-table-card #home-next-page {
  border-radius: 10px;
  height: 40px;
  font-weight: 600;
}

@media (max-width: 980px) {
  .home-own-summary {
    grid-template-columns: 1fr;
  }

  .home-own-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  #home-toolbar-card #build-report-btn,
  #home-toolbar-card #download-report-btn,
  #home-toolbar-card #sync-catalog-btn {
    width: 100%;
    justify-content: center;
  }

  .home-own-stats-grid {
    grid-template-columns: 1fr;
  }
}

/* Home dashboard refinement pass */
.home-dashboard-page {
  padding-top: 8px;
}

.home-dashboard-page > h1 {
  font-size: clamp(34px, 3.4vw, 44px);
  font-weight: 800;
  line-height: 1.02;
  color: #0f172a;
  margin-bottom: 8px;
}

.home-dashboard-page > .sub {
  font-size: 21px;
  color: #4b5563;
  max-width: 820px;
  line-height: 1.35;
  margin-bottom: 20px;
}

#home-toolbar-card,
#home-table-card {
  border-radius: 18px;
  border: 1px solid #d6e0ec;
  box-shadow:
    0 18px 44px rgba(15, 23, 42, 0.07),
    0 1px 0 rgba(255, 255, 255, 0.92) inset;
  animation: home-fade-up 260ms ease-out;
}

#home-toolbar-card {
  padding: 20px 22px;
  background:
    radial-gradient(140% 120% at 0% 0%, rgba(56, 189, 248, 0.09) 0%, rgba(56, 189, 248, 0) 40%),
    radial-gradient(120% 100% at 100% 0%, rgba(20, 184, 166, 0.09) 0%, rgba(20, 184, 166, 0) 42%),
    #ffffff;
}

#home-toolbar-card .inline-flex.rounded-xl {
  border-radius: 12px;
  border-color: #cdd9e6;
  background: #f8fafc;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

#home-toolbar-card #tab-supplier,
#home-toolbar-card #tab-competitor {
  height: 44px;
  min-width: 130px;
  font-size: 16px;
  font-weight: 700;
  border: 1px solid transparent;
}

#home-toolbar-card #tab-supplier.bg-white,
#home-toolbar-card #tab-competitor.bg-white {
  border-color: #bed4ea;
  color: #1d4f8d !important;
}

#home-toolbar-card #sync-catalog-btn,
#home-toolbar-card #build-report-btn,
#home-toolbar-card #download-report-btn {
  height: 44px;
  padding-left: 16px;
  padding-right: 16px;
  border-radius: 12px;
  font-size: 17px;
  font-weight: 700;
}

#home-toolbar-card #build-report-btn:disabled {
  opacity: 1;
  color: #64748b;
  border-color: #d6e0ec;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

#home-toolbar-card #build-report-btn:disabled i,
#home-toolbar-card #build-report-btn:disabled svg {
  color: #94a3b8;
  stroke: currentColor;
}

#home-count-info {
  border: 1px solid #cedced;
  border-radius: 12px;
  background: #ffffff;
  padding: 10px 14px;
  font-size: 18px;
  color: #0f172a;
  font-weight: 700;
}

#home-built-at {
  font-size: 14px;
  color: #64748b;
  letter-spacing: 0.01em;
}

#home-sync-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  border: 0;
  background: transparent;
  padding: 0;
}

#home-sync-line .sync-chip {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid #d6e1ee;
  background: #f8fbff;
  color: #52647e;
  font-size: 13px;
  font-weight: 700;
}

#home-sync-line .sync-chip.ok {
  background: #f1f9f4;
  border-color: #cfe8d8;
  color: #2f6d44;
}

#home-sync-line .sync-chip.warn {
  background: #fffbeb;
  border-color: #f4e3b0;
  color: #8a6712;
}

#home-table-card {
  padding: 18px 22px 16px;
  background: #ffffff;
}

.home-own-summary {
  margin-bottom: 14px;
  border-radius: 16px;
  border: 1px solid #d8e3f0;
  background:
    linear-gradient(180deg, #fcfdff 0%, #f6faff 100%);
  padding: 14px;
}

.home-own-ring-wrap {
  border-right: 1px solid #dbe5f1;
  padding-right: 14px;
}

.home-own-ring {
  width: 76px;
  height: 76px;
}

.home-own-ring-pct {
  font-size: 21px;
}

.home-own-ring-label {
  font-size: 18px;
  font-weight: 800;
}

.home-own-ring-meta {
  font-size: 14px;
}

.home-own-stats-grid {
  gap: 10px;
}

.home-own-stat {
  min-height: 84px;
  border-radius: 12px;
  border: 1px solid #dce6f1;
  background: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.94);
  position: relative;
  overflow: hidden;
}

.home-own-stat::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: #c7d2e1;
}

.home-own-stat:nth-child(1)::before {
  background: #7cc58b;
}

.home-own-stat:nth-child(2)::before {
  background: #d9bb61;
}

.home-own-stat:nth-child(3)::before {
  background: #cf7d7a;
}

.home-own-stat:nth-child(4)::before {
  background: #7f93cf;
}

.home-own-pct {
  font-size: 52px;
  letter-spacing: -0.02em;
}

.home-own-qty {
  font-size: 15px;
  font-weight: 700;
}

#home-table-card #brand-filter {
  height: 58px;
  border-radius: 14px;
  border-color: #c8d6e6;
  font-size: 16px;
  font-weight: 600;
  color: #0f172a;
}

#home-table-card #brand-filter::placeholder {
  font-size: 16px;
  font-weight: 600;
  color: #94a3b8;
}

#home-table-card #home-page-info {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  padding-left: 14px;
  padding-right: 14px;
  border-radius: 999px;
  border: 1px solid #d3deea;
  background: #f7fafc;
  color: #334155;
  font-size: 15px;
}

#home-table-card table thead th {
  background: #f4f7fb;
  border-bottom: 1px solid #dbe6f1;
  color: #334155;
  font-size: 13px;
  font-weight: 800;
}

#home-table-card table td {
  font-size: 16px;
  padding-top: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid #ecf2f8;
}

#home-table-card table tbody tr:hover {
  background: #f9fbff;
}

#home-table-card #home-prev-page,
#home-table-card #home-next-page {
  height: 42px;
  border-radius: 12px;
}

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

@media (max-width: 980px) {
  .home-dashboard-page > h1 {
    font-size: clamp(30px, 8vw, 40px);
  }

  .home-dashboard-page > .sub {
    font-size: 18px;
  }

  #home-table-card #brand-filter {
    height: 50px;
    font-size: 18px;
  }

  .home-own-pct {
    font-size: 44px;
  }
}

@media (max-width: 640px) {
  #home-toolbar-card,
  #home-table-card {
    padding: 14px;
    border-radius: 14px;
  }

  #home-count-info {
    font-size: 16px;
    width: 100%;
    justify-content: center;
  }

  #home-table-card #brand-filter {
    height: 46px;
    font-size: 16px;
  }

  .home-own-pct {
    font-size: 38px;
  }
}

/* Home production overrides */
.rules-container > #home-toolbar-card,
.rules-container > #home-table-card {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06) !important;
  animation: none !important;
}

#home-toolbar-card {
  padding: 18px !important;
}

#home-toolbar-card #build-report-btn {
  background: #ecfdf5 !important;
  border-color: #86efac !important;
  color: #14532d !important;
}

#home-toolbar-card #build-report-btn:hover:not(:disabled) {
  background: #dcfce7 !important;
}

#home-toolbar-card #build-report-btn:disabled {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
  color: #64748b !important;
  opacity: 1 !important;
}

#home-toolbar-card #build-report-btn:disabled i,
#home-toolbar-card #build-report-btn:disabled svg {
  color: #94a3b8 !important;
}

#home-sync-line .sync-chip {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
  color: #475569 !important;
}

#home-sync-line .sync-chip.ok {
  background: #f0fdf4 !important;
  border-color: #bbf7d0 !important;
  color: #166534 !important;
}

#home-sync-line .sync-chip.warn {
  background: #fffbeb !important;
  border-color: #fde68a !important;
  color: #92400e !important;
}

#home-table-card table thead th {
  background: #f8fafc !important;
  border-bottom-color: #e2e8f0 !important;
}

#home-table-card table td {
  border-bottom-color: #eef2f7 !important;
}

/* Global simple SaaS theme */
:root {
  --bg: #f6f8fc;
  --card: #ffffff;
  --text: #1f2a44;
  --muted: #73809b;
  --accent: #6d6afc;
  --accent-weak: #f0efff;
  --border: #e6ebf3;
}

body {
  background: var(--bg) !important;
  color: var(--text);
}

.topbar {
  border-bottom: 1px solid var(--border) !important;
  background: rgba(255, 255, 255, 0.94) !important;
  backdrop-filter: blur(6px);
}

.topbar-title {
  color: #242f49;
}

.topbar-page {
  color: #8090ab;
}

.side-drawer {
  border-right: 1px solid var(--border);
  background: #ffffff;
}

.side-link {
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #52617c;
  font-weight: 600;
}

.side-link:hover {
  border-color: #e2e8f5;
  background: #fafbff;
}

.side-link.active {
  border-color: #deddff;
  background: #f5f4ff;
  color: #4f46e5;
}

.rules-container {
  max-width: 1240px;
}

.rules-container h1 {
  color: #1f2a44;
  letter-spacing: -0.02em;
}

.rules-container .sub {
  color: #73809b;
}

.rules-container .card {
  border: 1px solid var(--border) !important;
  border-radius: 14px !important;
  background: #ffffff !important;
  box-shadow: 0 4px 20px rgba(22, 34, 66, 0.05) !important;
}

.rules-container input[type="text"],
.rules-container input[type="number"],
.rules-container select {
  border: 1px solid #dce3ef;
  border-radius: 10px;
  background: #ffffff;
  color: #1f2a44;
  box-shadow: none;
}

.rules-container input[type="text"]::placeholder,
.rules-container input[type="number"]::placeholder {
  color: #9aa8bf;
}

.rules-container input[type="text"]:focus,
.rules-container input[type="number"]:focus,
.rules-container select:focus {
  border-color: #b7b8ff;
  box-shadow: 0 0 0 3px rgba(109, 106, 252, 0.16);
}

.rules-container table th {
  background: #f9fbff !important;
  color: #667792 !important;
  border-bottom: 1px solid #e6ebf3 !important;
  font-weight: 700;
}

.rules-container table td {
  border-bottom: 1px solid #eef2f8 !important;
  color: #33415e;
}

.rules-container table tbody tr:hover {
  background: #fafbff !important;
}

button {
  border-radius: 10px;
}

button:disabled {
  opacity: 0.8;
}

.link-button {
  color: #4f46e5;
}

.link-button:hover {
  color: #4338ca;
}

pre {
  border-radius: 12px;
  border: 1px solid #1f2a44;
}

/* Home page ultra-minimal override */
#home-toolbar-card,
#home-table-card,
#home-table-card #home-own-summary,
#home-table-card .home-own-stat,
#home-count-info,
#home-sync-line .sync-chip,
#home-table-card #home-page-info {
  box-shadow: none !important;
  background: #ffffff !important;
  background-image: none !important;
}

#home-toolbar-card,
#home-table-card {
  border-color: #e7ecf4 !important;
  border-radius: 12px !important;
}

#home-toolbar-card {
  padding: 14px !important;
}

#home-toolbar-card .inline-flex.rounded-xl {
  border-color: #e2e8f0 !important;
  background: #ffffff !important;
  padding: 2px !important;
}

#home-toolbar-card #tab-supplier,
#home-toolbar-card #tab-competitor {
  min-width: 116px !important;
  height: 38px !important;
  border: 0 !important;
  box-shadow: none !important;
  font-size: 14px !important;
}

#home-toolbar-card #tab-supplier.bg-white,
#home-toolbar-card #tab-competitor.bg-white {
  border: 1px solid #e2e8f0 !important;
  color: #111827 !important;
}

#home-toolbar-card #sync-catalog-btn,
#home-toolbar-card #download-report-btn {
  background: #ffffff !important;
  border-color: #dbe3ef !important;
  color: #334155 !important;
}

#home-toolbar-card #build-report-btn {
  background: #eef2ff !important;
  border-color: #c7d2fe !important;
  color: #3730a3 !important;
}

#home-toolbar-card #build-report-btn:hover:not(:disabled) {
  background: #e0e7ff !important;
}

#home-count-info {
  border-color: #e5eaf2 !important;
  border-radius: 10px !important;
  padding: 8px 12px !important;
  font-size: 15px !important;
  font-weight: 600 !important;
}

#home-built-at {
  font-size: 14px !important;
  color: #64748b !important;
}

#home-sync-line {
  display: flex !important;
  gap: 6px !important;
  margin-top: 10px !important;
  padding: 0 !important;
  border: 0 !important;
}

#home-sync-line .sync-chip {
  height: 28px !important;
  border: 1px solid #e5eaf2 !important;
  border-radius: 999px !important;
  padding: 0 10px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  color: #64748b !important;
}

#home-sync-line .sync-chip.ok,
#home-sync-line .sync-chip.warn {
  background: #ffffff !important;
  border-color: #e5eaf2 !important;
  color: #64748b !important;
}

.topbar-spacer {
  flex: 1 1 auto;
}

.auth-menu {
  position: relative;
}

.auth-menu-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid #d8e1ef;
  background: #ffffff;
  color: #2b3a56;
  cursor: pointer;
}

.auth-initial {
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

.auth-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 190px;
  border: 1px solid #e2e8f4;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.14);
  padding: 8px;
  z-index: 60;
}

.auth-menu-panel.hidden {
  display: none;
}

.auth-menu-head {
  padding: 6px 8px 10px;
  border-bottom: 1px solid #edf1f7;
  margin-bottom: 6px;
}

.auth-menu-name {
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
}

.auth-menu-role {
  font-size: 12px;
  color: #64748b;
  text-transform: uppercase;
}

.auth-menu-item {
  display: flex;
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #334155;
  text-decoration: none;
  font-size: 14px;
  line-height: 1.2;
  padding: 9px 10px;
  cursor: pointer;
}

.auth-menu-item:hover {
  background: #f8fafc;
}

.auth-menu-item-danger {
  color: #b91c1c;
}

#home-table-card {
  padding: 14px !important;
}

#home-table-card #home-own-summary {
  border: 1px solid #e7ecf4 !important;
  border-radius: 12px !important;
  padding: 12px !important;
  gap: 10px !important;
}

#home-table-card .home-own-ring-wrap {
  border-right-color: #edf2f7 !important;
  gap: 10px !important;
}

#home-table-card .home-own-ring {
  width: 66px !important;
  height: 66px !important;
  background: conic-gradient(#7aa2d9 var(--coverage-deg), #e7edf5 0deg) !important;
}

#home-table-card .home-own-ring::after {
  inset: 8px !important;
}

#home-table-card .home-own-ring-pct {
  font-size: 16px !important;
  font-weight: 700 !important;
}

#home-table-card .home-own-ring-label {
  font-size: 13px !important;
  font-weight: 600 !important;
  color: #475569 !important;
}

#home-table-card .home-own-ring-meta {
  font-size: 12px !important;
  color: #94a3b8 !important;
}

#home-table-card .home-own-stats-grid {
  gap: 8px !important;
}

#home-table-card .home-own-stat {
  min-height: 88px !important;
  border: 1px solid #e7ecf4 !important;
  border-radius: 10px !important;
  padding: 10px !important;
  transform: none !important;
}

#home-table-card .home-own-stat::before {
  display: none !important;
}

#home-table-card .home-own-stat-label {
  font-size: 13px !important;
  color: #64748b !important;
  font-weight: 600 !important;
}

#home-table-card .home-own-pct {
  font-size: 34px !important;
  line-height: 1 !important;
  font-weight: 700 !important;
}

#home-table-card .home-own-qty {
  font-size: 14px !important;
  color: #64748b !important;
  font-weight: 600 !important;
}

#home-table-card #brand-filter {
  height: 44px !important;
  border-radius: 10px !important;
  border-color: #dbe3ef !important;
}

#home-table-card #home-page-info {
  border: 1px solid #e2e8f0 !important;
  border-radius: 999px !important;
  background: #ffffff !important;
  color: #475569 !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  min-height: 38px !important;
}

#home-table-card table thead th {
  background: #fbfcfe !important;
  color: #94a3b8 !important;
  font-size: 11px !important;
  letter-spacing: 0.03em !important;
}

#home-table-card table td {
  font-size: 14px !important;
  color: #334155 !important;
  padding-top: 11px !important;
  padding-bottom: 11px !important;
}

/* Home summary v3 polish */
#home-table-card #home-own-summary {
  border: 1px solid #e2e8f0 !important;
  border-radius: 20px !important;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%) !important;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06) !important;
  padding: 18px !important;
  gap: 14px !important;
}

#home-table-card .home-own-ring-wrap {
  border-right: 1px solid #e5edf6 !important;
  padding-right: 16px !important;
  gap: 16px !important;
}

#home-table-card .home-own-ring {
  width: 84px !important;
  height: 84px !important;
  background: conic-gradient(#5ca0db var(--coverage-deg), #e7eef7 0deg) !important;
  box-shadow: inset 0 0 0 1px rgba(147, 197, 253, 0.16);
}

#home-table-card .home-own-ring::after {
  inset: 9px !important;
  background: #ffffff !important;
}

#home-table-card .home-own-ring-pct {
  font-size: 20px !important;
  font-weight: 800 !important;
  color: #3f7eb8 !important;
}

#home-table-card .home-own-ring-label {
  font-size: 15px !important;
  font-weight: 700 !important;
  color: #334155 !important;
}

#home-table-card .home-own-ring-meta {
  font-size: 13px !important;
  font-weight: 600 !important;
  color: #64748b !important;
}

#home-table-card .home-own-stats-grid {
  gap: 12px !important;
}

#home-table-card .home-own-stat {
  min-height: 120px !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 16px !important;
  background: #ffffff !important;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#home-table-card .home-own-stat:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.09);
}

#home-table-card .home-own-stat-label {
  font-size: 16px !important;
  font-weight: 700 !important;
  color: #64748b !important;
}

#home-table-card .home-own-pct {
  font-size: 44px !important;
  line-height: 0.95 !important;
  letter-spacing: -0.03em !important;
  font-weight: 800 !important;
}

#home-table-card .home-own-qty {
  font-size: 16px !important;
  line-height: 1.1 !important;
  font-weight: 700 !important;
  color: #475569 !important;
  letter-spacing: 0 !important;
}

#home-table-card .home-own-stat:nth-child(1) {
  background: linear-gradient(180deg, #ffffff 0%, #f4fbf6 100%) !important;
}

#home-table-card .home-own-stat:nth-child(2) {
  background: linear-gradient(180deg, #ffffff 0%, #fffbf2 100%) !important;
}

#home-table-card .home-own-stat:nth-child(3) {
  background: linear-gradient(180deg, #ffffff 0%, #fff6f6 100%) !important;
}

#home-table-card .home-own-stat:nth-child(4) {
  background: linear-gradient(180deg, #ffffff 0%, #f5f8ff 100%) !important;
}

#home-table-card .home-own-pct.best {
  color: #2f8550 !important;
}

#home-table-card .home-own-pct.equal {
  color: #9a7a2f !important;
}

#home-table-card .home-own-pct.worse {
  color: #a44747 !important;
}

#home-table-card .home-own-pct.na {
  color: #3f58a8 !important;
}

@media (max-width: 980px) {
  #home-table-card .home-own-stat {
    min-height: 98px !important;
  }

  #home-table-card .home-own-pct {
    font-size: 36px !important;
  }

  #home-table-card .home-own-qty {
    font-size: 15px !important;
  }
}

@media (max-width: 640px) {
  #home-table-card #home-own-summary {
    border-radius: 14px !important;
    padding: 12px !important;
  }

  #home-table-card .home-own-ring-wrap {
    border-right: 0 !important;
    border-bottom: 1px solid #e5edf6 !important;
    padding-right: 0 !important;
    padding-bottom: 10px !important;
  }

  #home-table-card .home-own-pct {
    font-size: 32px !important;
  }

  #home-table-card .home-own-qty {
    font-size: 14px !important;
  }
}
