/* ════════════════════════════════════════════════════════════
   Ecomstone Listings Dashboard — Design System
   Color palette: navy + gold + orange + cream
   ════════════════════════════════════════════════════════════ */

:root {
  --navy:   #0B1D3A;
  --navy-2: #1a3a6b;
  --gold:   #C9A84C;
  --orange: #FF8C00;
  --orange-h: #e67e00;
  --cream:  #F7F3EC;
  --green:  #22c55e;
  --green-l:#86efac;
  --yellow: #eab308;
  --orange-w:#f59e0b;
  --red:    #ef4444;
  --red-l:  #fca5a5;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow:    0 4px 6px -1px rgba(0,0,0,.08), 0 2px 4px -2px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.05);
  --radius:    8px;
  --radius-lg: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: 'Be Vietnam Pro', 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  color: var(--gray-800);
  background: var(--cream);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--orange); text-decoration: none; }
a:hover { color: var(--orange-h); }

code {
  font-family: 'SF Mono', Menlo, monospace;
  background: var(--gray-100);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--navy);
}

.hidden { display: none !important; }
.muted { color: var(--gray-500); font-size: 13px; }
.loading { padding: 40px; text-align: center; color: var(--gray-400); font-size: 14px; }

/* ── Logo & branding ── */
.logo {
  font-family: 'DM Sans', sans-serif;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -.02em;
  color: var(--orange);
}
.tag {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .15em;
  color: var(--gray-500);
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-weight: 600; font-size: 14px;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, transform .05s, box-shadow .15s;
  text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--orange); color: white; }
.btn-primary:hover { background: var(--orange-h); }
.btn-secondary { background: white; color: var(--navy); border-color: var(--gray-300); }
.btn-secondary:hover { background: var(--gray-50); border-color: var(--gray-400); }
.btn-ghost { background: transparent; color: var(--gray-600); }
.btn-ghost:hover { background: var(--gray-100); color: var(--navy); }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 7px 12px; font-size: 13px; }

/* ── Forms ── */
.fg { margin-bottom: 16px; }
.fg label { display: block; font-size: 13px; font-weight: 600; color: var(--gray-700); margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], textarea, select {
  width: 100%; padding: 11px 14px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  background: white;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(255,140,0,.15);
}

.error-box {
  margin-top: 12px;
  padding: 10px 14px;
  background: #fef2f2;
  border-left: 4px solid var(--red);
  border-radius: var(--radius);
  font-size: 13px;
  color: #991b1b;
}

/* ════════════════════════════════════════════════════════════
   LOGIN PAGE
   ════════════════════════════════════════════════════════════ */
#page-login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  background: linear-gradient(135deg, var(--navy), var(--navy-2));
}
.login-card {
  width: 100%; max-width: 420px;
  background: white;
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  box-shadow: var(--shadow-lg);
}
.logo-block { text-align: center; margin-bottom: 24px; }
.logo-block .logo { font-size: 28px; }
.login-card h1 {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 8px;
}
.login-card .muted { text-align: center; margin-bottom: 24px; }
.login-footer {
  margin-top: 20px; padding-top: 20px;
  border-top: 1px solid var(--gray-200);
  text-align: center;
  color: var(--gray-500);
}

/* ════════════════════════════════════════════════════════════
   APP MAIN LAYOUT (Sidebar + Main)
   ════════════════════════════════════════════════════════════ */
#app-main {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  background: var(--navy);
  color: white;
  display: flex;
  flex-direction: column;
  padding: 20px 0;
}
.sidebar-logo {
  padding: 0 20px 24px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  display: flex; align-items: center; gap: 8px;
}
.sidebar-logo .logo { color: var(--orange); font-size: 18px; }
.sidebar-logo .badge {
  background: rgba(201,168,76,.2);
  color: var(--gold);
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
}
.sidebar-nav { flex: 1; padding: 16px 0; overflow-y: auto; }
.nav-section {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .15em;
  color: rgba(255,255,255,.4);
  padding: 16px 20px 8px;
  font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,.75);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.nav-item:hover {
  background: rgba(255,255,255,.05);
  color: white;
}
.nav-item.active {
  background: rgba(255,140,0,.15);
  color: var(--orange);
  border-left: 3px solid var(--orange);
  padding-left: 17px;
}
.nav-icon { font-size: 16px; }
.brand-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
}

.sidebar-footer {
  padding: 16px 20px 0;
  border-top: 1px solid rgba(255,255,255,.1);
}
.user-block { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--orange);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}
.user-name { font-size: 13px; font-weight: 600; color: white; }
.user-role { font-size: 11px; color: rgba(255,255,255,.5); text-transform: uppercase; letter-spacing: .1em; }

/* ── Main content ── */
.main-content {
  background: var(--cream);
  padding: 32px 40px;
  overflow-y: auto;
}
.page-header {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--gray-200);
}
.page-header h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--navy);
}
.page-actions { margin-left: auto; display: flex; gap: 8px; }
#detail-title-block { flex: 1; }
#detail-asin { font-family: 'SF Mono', monospace; font-size: 18px; }

/* ── Cards ── */
.card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
}
.card h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--gray-700);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 16px;
}

/* ── Brand grid (dashboard home) ── */
.brand-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.brand-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  cursor: pointer;
  transition: transform .15s, box-shadow .15s, border-color .15s;
  text-decoration: none;
  color: inherit;
  display: block;
}
.brand-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--orange);
  color: inherit;
}
.brand-card-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px;
}
.brand-card h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
}
.brand-card-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  font-size: 13px;
}
.stat-block { padding: 10px; background: var(--gray-50); border-radius: 6px; }
.stat-label { color: var(--gray-500); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.stat-value { font-size: 20px; font-weight: 700; color: var(--navy); margin-top: 2px; }
.stat-value.score-high { color: var(--green); }
.stat-value.score-mid { color: var(--orange-w); }
.stat-value.score-low { color: var(--red); }

/* ── ASIN list table ── */
.filter-bar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-chip {
  padding: 8px 14px;
  background: white;
  border: 1px solid var(--gray-300);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.filter-chip:hover { border-color: var(--orange); }
.filter-chip.active { background: var(--orange); color: white; border-color: var(--orange); }

.asin-table-wrap {
  background: white;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--gray-200);
}
.asin-table { width: 100%; border-collapse: collapse; }
.asin-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--gray-500);
  padding: 12px 16px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}
.asin-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-100);
  font-size: 13px;
}
.asin-table tr:last-child td { border-bottom: none; }
.asin-table tr:hover { background: var(--cream); }
.asin-row { cursor: pointer; }

.score-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
}
.score-badge.score-excellent { background: #dcfce7; color: #166534; }
.score-badge.score-good { background: #dcfce7; color: #166534; }
.score-badge.score-needs_improvement { background: #fef9c3; color: #854d0e; }
.score-badge.score-critical { background: #ffedd5; color: #9a3412; }
.score-badge.score-severe { background: #fee2e2; color: #991b1b; }

.status-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 600;
}

/* ── Detail page ── */
.detail-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  grid-template-areas:
    "score breakdown"
    "issues issues"
    "proposal proposal";
  gap: 20px;
}
.score-card { grid-area: score; text-align: center; padding: 28px 20px; }
.breakdown-card { grid-area: breakdown; }
.issues-card { grid-area: issues; }
.proposal-card { grid-area: proposal; }

.score-num {
  font-family: 'DM Sans', sans-serif;
  font-size: 64px;
  font-weight: 800;
  color: var(--navy);
  line-height: 1;
}
.score-num small { font-size: 24px; opacity: .5; font-weight: 600; }
.score-status {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .15em;
  color: var(--gray-500);
  margin-top: 8px;
  font-weight: 600;
}
.score-bar {
  height: 6px; background: var(--gray-200);
  border-radius: 3px; margin: 16px 0 8px;
  overflow: hidden;
}
.score-bar-fill { height: 100%; background: var(--orange); transition: width .5s; }
.score-meta { font-size: 12px; color: var(--gray-500); }

.breakdown-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.bd-item {
  padding: 10px 12px;
  background: var(--cream);
  border-radius: 6px;
  border-left: 3px solid var(--gold);
}
.bd-name { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--gray-500); font-weight: 600; }
.bd-value { font-size: 18px; font-weight: 700; color: var(--navy); margin-top: 2px; }
.bd-value small { font-size: 12px; opacity: .5; font-weight: 500; }
.bd-bar { height: 4px; background: var(--gray-200); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.bd-bar-fill { height: 100%; background: var(--orange); }

/* Issues */
.issues-list { display: flex; flex-direction: column; gap: 8px; }
.issue {
  padding: 10px 14px;
  border-left: 3px solid;
  border-radius: 6px;
  font-size: 13px;
  display: flex; align-items: flex-start; gap: 8px;
}
.issue.error { border-color: var(--red); background: #fef2f2; }
.issue.warn { border-color: var(--yellow); background: #fefce8; }
.issue.info { border-color: #3b82f6; background: #eff6ff; }
.issue-cat {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  background: rgba(0,0,0,.05);
  padding: 1px 6px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* Proposal */
.proposal-section { margin-bottom: 20px; }
.proposal-section h4 {
  font-size: 12px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--gray-500); margin-bottom: 8px; font-weight: 600;
}
.proposal-content-block {
  background: var(--cream);
  padding: 14px 16px;
  border-radius: 8px;
  font-size: 13px;
  white-space: pre-wrap;
  line-height: 1.6;
  border: 1px solid var(--gray-200);
}
.proposal-bullet {
  background: var(--cream);
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 13px;
  border-left: 3px solid var(--gold);
}
.compliance-pass {
  background: #dcfce7; color: #166534;
  padding: 10px 14px; border-radius: 6px;
  font-size: 13px; font-weight: 600;
  margin-bottom: 16px;
}
.compliance-fail {
  background: #fee2e2; color: #991b1b;
  padding: 10px 14px; border-radius: 6px;
  font-size: 13px; font-weight: 600;
  margin-bottom: 16px;
}

.copy-btn {
  background: white; border: 1px solid var(--gray-300);
  padding: 4px 10px; border-radius: 4px;
  font-size: 11px; cursor: pointer;
  margin-left: 8px;
}
.copy-btn:hover { background: var(--gray-50); }

/* ── Bulk audit ── */
.bulk-progress-bar {
  height: 8px; background: var(--gray-200);
  border-radius: 4px; margin: 16px 0 8px;
  overflow: hidden;
}
#bulk-progress-fill {
  height: 100%; background: var(--orange);
  width: 0%; transition: width .3s;
}

/* ── Toast ── */
#toast-container {
  position: fixed; top: 20px; right: 20px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 9999;
}
.toast {
  background: var(--navy); color: white;
  padding: 12px 18px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  max-width: 360px;
  animation: slideIn .2s ease-out;
}
.toast.success { background: var(--green); }
.toast.error { background: var(--red); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ── Responsive ── */
@media (max-width: 900px) {
  #app-main { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; bottom: 0; left: 0; right: 0;
    flex-direction: row;
    padding: 8px;
    z-index: 100;
    border-top: 1px solid rgba(255,255,255,.1);
  }
  .sidebar-logo, .sidebar-footer, .nav-section { display: none; }
  .sidebar-nav { flex-direction: row; padding: 0; overflow-x: auto; }
  .nav-item { padding: 8px 12px; font-size: 12px; flex-direction: column; gap: 2px; }
  .main-content { padding: 16px; padding-bottom: 80px; }
  .detail-grid { grid-template-columns: 1fr; grid-template-areas: "score" "breakdown" "issues" "proposal"; }
  .breakdown-grid { grid-template-columns: 1fr; }
  .page-header { flex-wrap: wrap; }
  .page-actions { width: 100%; margin-left: 0; margin-top: 8px; }
  .asin-table th:nth-child(4), .asin-table td:nth-child(4),
  .asin-table th:nth-child(5), .asin-table td:nth-child(5) { display: none; }
}

/* ═══════════════ Push Modal ═══════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(11, 29, 58, .65);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-card {
  background: white;
  border-radius: var(--radius-lg);
  width: 100%; max-width: 720px;
  max-height: 85vh;
  display: flex; flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,.3);
}
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h2 {
  font-size: 18px; font-weight: 700; color: var(--navy);
}
.modal-close {
  background: none; border: none;
  font-size: 28px; line-height: 1;
  color: var(--gray-400); cursor: pointer;
  padding: 0 8px;
}
.modal-close:hover { color: var(--navy); }
.modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-200);
  display: flex; gap: 8px; justify-content: flex-end;
}
.modal-warning {
  background: #fef3c7; border-left: 4px solid var(--orange-w);
  padding: 12px 14px; border-radius: 6px; margin-top: 16px;
  font-size: 13px; color: #92400e;
}
.push-diff {
  display: flex; flex-direction: column; gap: 12px;
}
.diff-section { background: var(--cream); padding: 12px 14px; border-radius: 8px; border: 1px solid var(--gray-200); }
.diff-section h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--gray-500); font-weight: 700; margin-bottom: 8px; }
.diff-row { display: grid; grid-template-columns: 60px 1fr; gap: 8px; font-size: 12px; align-items: start; padding: 4px 0; }
.diff-label { font-weight: 700; font-size: 10px; padding: 2px 6px; border-radius: 3px; text-align: center; }
.diff-label.before { background: #fee2e2; color: #991b1b; }
.diff-label.after { background: #dcfce7; color: #166534; }
.diff-value { line-height: 1.5; word-break: break-word; }
.diff-value.empty { color: var(--gray-400); font-style: italic; }
.push-pass { background: #dcfce7; border-left: 4px solid var(--green); padding: 10px 14px; border-radius: 6px; font-size: 13px; color: #166534; font-weight: 600; margin-bottom: 16px; }
.push-fail { background: #fee2e2; border-left: 4px solid var(--red); padding: 10px 14px; border-radius: 6px; font-size: 13px; color: #991b1b; font-weight: 600; margin-bottom: 16px; }

/* SKU verify states */
.sku-verify-loading { padding: 10px 14px; background: var(--gray-100); border-radius: 6px; font-size: 13px; color: var(--gray-600); }
.sku-verify-pass { padding: 12px 14px; background: #dcfce7; border-left: 4px solid var(--green); border-radius: 6px; font-size: 13px; color: #166534; }
.sku-verify-fail { padding: 12px 14px; background: #fee2e2; border-left: 4px solid var(--red); border-radius: 6px; font-size: 13px; color: #991b1b; }
