/* LlamaThatOS — Vendor Central Dashboard */
:root {
  --bg-primary: #0b0b11;
  --bg-secondary: #111118;
  --bg-card: #15151e;
  --bg-card-hover: #1a1a25;
  --accent: #00e5a0;
  --accent-dim: rgba(0, 229, 160, 0.12);
  --accent-hover: #00cc8e;
  --red: #ff4757;
  --red-dim: rgba(255, 71, 87, 0.12);
  --orange: #ff9f43;
  --orange-dim: rgba(255, 159, 67, 0.12);
  --blue: #54a0ff;
  --blue-dim: rgba(84, 160, 255, 0.12);
  --purple: #a78bfa;
  --purple-dim: rgba(167, 139, 250, 0.12);
  --yellow: #feca57;
  --yellow-dim: rgba(254, 202, 87, 0.12);
  --text-primary: #eeeef2;
  --text-secondary: #8888a0;
  --text-muted: #555568;
  --border: rgba(255,255,255,0.06);
  --border-hover: rgba(255,255,255,0.12);
  --sidebar-width: 240px;
  --radius: 10px;
  --radius-sm: 6px;
}

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

body {
  font-family: 'Space Grotesk', -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  height: 100vh;
}

#app {
  display: flex;
  height: 100vh;
}

/* ========== SIDEBAR ========== */
#sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.logo-icon { font-size: 22px; }

.logo-text {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.logo-text .accent { color: var(--accent); }

.logo-tag {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
  font-weight: 500;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s ease;
}

.nav-item:hover {
  background: rgba(255,255,255,0.04);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.seed-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  background: transparent;
  border: 1px dashed var(--border-hover);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
}

.seed-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

/* ========== MAIN CONTENT ========== */
#main-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0;
}

.view { display: none; padding: 32px 36px; }
.view.active { display: block; }

.view-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
}

.view-header h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.view-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 4px;
}

.back-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  display: inline-block;
  margin-bottom: 8px;
  transition: color 0.15s;
}

.back-link:hover { color: var(--accent); }

/* ========== CARDS ========== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.card h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 18px;
}

/* ========== STATS GRID ========== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color 0.15s;
}

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

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 500;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -1px;
  font-family: 'JetBrains Mono', monospace;
}

.stat-value.negative { color: var(--red); }
.stat-value.positive { color: var(--accent); }

.stat-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ========== GRID LAYOUTS ========== */
.grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* ========== BAR CHART ========== */
.bar-chart .bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.bar-label {
  min-width: 100px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.bar-track {
  flex: 1;
  height: 28px;
  background: rgba(255,255,255,0.03);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 4px;
  display: flex;
  align-items: center;
  padding-left: 10px;
  font-size: 12px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  color: var(--bg-primary);
  transition: width 0.6s ease;
  min-width: 40px;
}

.bar-amount {
  min-width: 90px;
  text-align: right;
  font-size: 13px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  color: var(--text-primary);
}

/* ========== DATA TABLE ========== */
.data-table-container { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  white-space: nowrap;
}

.data-table tr:hover td {
  background: rgba(255,255,255,0.02);
  color: var(--text-primary);
}

.data-table .amount {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  text-align: right;
  color: var(--red);
}

/* ========== BADGES ========== */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-shortage { background: var(--red-dim); color: var(--red); }
.badge-chargeback { background: var(--orange-dim); color: var(--orange); }
.badge-price_claim, .badge-price-claim { background: var(--purple-dim); color: var(--purple); }
.badge-coop { background: var(--yellow-dim); color: var(--yellow); }
.badge-other { background: rgba(255,255,255,0.06); color: var(--text-secondary); }

.badge-new { background: var(--blue-dim); color: var(--blue); }
.badge-filed { background: var(--orange-dim); color: var(--orange); }
.badge-in_review, .badge-in-review { background: var(--yellow-dim); color: var(--yellow); }
.badge-won { background: var(--accent-dim); color: var(--accent); }
.badge-lost { background: var(--red-dim); color: var(--red); }

/* ========== CLIENTS GRID ========== */
.clients-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.client-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.client-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,229,160,0.06);
}

.client-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.client-card-name {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.3px;
}

.client-card-code {
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-muted);
  background: rgba(255,255,255,0.04);
  padding: 2px 8px;
  border-radius: 4px;
}

.client-card-amount {
  font-size: 24px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: var(--red);
  margin-bottom: 14px;
  letter-spacing: -0.5px;
}

.client-card-breakdown {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.client-card-breakdown .mini-stat {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(255,255,255,0.03);
  padding: 3px 8px;
  border-radius: 4px;
}

.mini-stat .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ========== HEATMAP ========== */
.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}

.heatmap-cell {
  padding: 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  overflow: hidden;
}

.heatmap-cell:hover {
  transform: scale(1.02);
}

.heatmap-cell .hm-name {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.heatmap-cell .hm-amount {
  font-size: 16px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: -0.5px;
}

.heatmap-cell .hm-count {
  font-size: 11px;
  opacity: 0.7;
  margin-top: 2px;
}

/* ========== TREND CHART ========== */
.trend-chart {
  height: 200px;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding-top: 20px;
}

.trend-bar-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.trend-bar {
  width: 100%;
  border-radius: 4px 4px 0 0;
  transition: height 0.5s ease;
  position: relative;
  min-height: 4px;
}

.trend-bar:hover { opacity: 0.85; }

.trend-label {
  font-size: 10px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  text-align: center;
}

/* ========== FC TABLE ========== */
.fc-table-inner {
  max-height: 300px;
  overflow-y: auto;
}

.fc-row {
  display: flex;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

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

.fc-name {
  font-size: 13px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-primary);
  min-width: 60px;
}

.fc-bar-wrap {
  flex: 1;
  height: 8px;
  background: rgba(255,255,255,0.03);
  border-radius: 4px;
  overflow: hidden;
}

.fc-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--red);
  transition: width 0.5s ease;
}

.fc-amount {
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-secondary);
  min-width: 80px;
  text-align: right;
}

.fc-clients {
  font-size: 11px;
  color: var(--text-muted);
  min-width: 60px;
  text-align: right;
}

/* ========== FILTERS BAR ========== */
.filters-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.input {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  transition: border-color 0.15s;
  outline: none;
}

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

.filters-bar .input { flex: 1; min-width: 160px; }
.filters-bar .input:first-child { flex: 2; }

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23555568'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

select.input option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* ========== BUTTONS ========== */
.btn-primary {
  background: var(--accent);
  color: var(--bg-primary);
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

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

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-secondary:hover { border-color: var(--text-muted); color: var(--text-primary); }

/* ========== UPLOAD ========== */
.upload-card { max-width: 640px; }

.upload-form .form-row {
  margin-bottom: 16px;
}

.upload-form label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.upload-form .input { width: 100%; }

.upload-zone {
  border: 2px dashed var(--border-hover);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 8px;
}

.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.upload-zone p {
  color: var(--text-secondary);
  margin-top: 12px;
  font-size: 14px;
}

.upload-hint {
  font-size: 12px !important;
  color: var(--text-muted) !important;
}

.upload-progress {
  margin-top: 16px;
}

.progress-bar {
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.3s ease;
  width: 0%;
}

.upload-progress p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 8px;
}

.upload-result {
  margin-top: 16px;
  padding: 16px;
  border-radius: var(--radius-sm);
  background: var(--accent-dim);
  border: 1px solid rgba(0,229,160,0.2);
}

.upload-result.error {
  background: var(--red-dim);
  border-color: rgba(255,71,87,0.2);
}

.upload-result h4 {
  font-size: 14px;
  margin-bottom: 8px;
}

.upload-result p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ========== MODAL ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  width: 440px;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 24px;
}

.modal .form-row {
  margin-bottom: 16px;
}

.modal label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.modal .input { width: 100%; }
.modal textarea.input { resize: vertical; }

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
}

/* ========== PAGINATION ========== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 0;
}

.pagination button {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  color: var(--text-secondary);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}

.pagination button:hover { border-color: var(--accent); color: var(--accent); }
.pagination button:disabled { opacity: 0.3; cursor: not-allowed; }

.pagination .page-info {
  font-size: 13px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

/* ========== KNOWLEDGE BASE ========== */
.knowledge-content {
  display: grid;
  gap: 20px;
}

.kb-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}

.kb-section h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.kb-section h2 .kb-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.kb-section p, .kb-section li {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-secondary);
}

.kb-section ul {
  list-style: none;
  padding: 0;
}

.kb-section ul li {
  padding: 6px 0;
  padding-left: 16px;
  position: relative;
}

.kb-section ul li::before {
  content: '›';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
}

.kb-section strong { color: var(--text-primary); }

.kb-section .kb-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.kb-section .kb-table th,
.kb-section .kb-table td {
  padding: 10px 14px;
  font-size: 13px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.kb-section .kb-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 500;
}

.kb-section .kb-table td { color: var(--text-secondary); }

/* ========== EMPTY STATE ========== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state svg {
  margin-bottom: 16px;
  opacity: 0.3;
}

.empty-state h3 {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: none;
  letter-spacing: 0;
}

.empty-state p {
  font-size: 14px;
  max-width: 400px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ========== STATUS DOT INDICATOR ========== */
.status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.14); }

/* ========== TOAST ========== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  font-size: 14px;
  z-index: 2000;
  animation: slideUp 0.3s ease;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.toast.success { border-color: rgba(0,229,160,0.3); }
.toast.error { border-color: rgba(255,71,87,0.3); }

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 900px) {
  .grid-2col { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .heatmap-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

@media (max-width: 680px) {
  #sidebar { display: none; }
  .view { padding: 20px 16px; }
  .filters-bar { flex-direction: column; }
  .filters-bar .input { min-width: unset; }
  .clients-grid { grid-template-columns: 1fr; }
}
