/* ── DASHBOARD LAYOUT ── */
.dashboard-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 120px 40px 80px;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

/* ── HEADER ── */
.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
}

.dash-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--fg);
  margin-bottom: 8px;
}

.dash-subtitle {
  font-size: 0.95rem;
  color: var(--fg-muted);
}

.upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--fg);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.upload-btn:hover {
  border-color: rgba(180, 255, 0, 0.3);
  background: var(--bg-card-hover);
}

/* ── METRIC TILES ── */
.tiles-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.tile {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.2s;
}

.tile:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

.tile--channels {
  grid-column: span 1;
}

.tile-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tile-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.tile-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 100px;
  background: rgba(180, 255, 0, 0.1);
  color: var(--accent);
}

.tile-badge--down {
  background: rgba(255, 80, 80, 0.1);
  color: #ff7070;
}

.tile-value {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.tile-value--sku {
  font-size: 1.1rem;
  line-height: 1.4;
}

.tile-spark {
  height: 36px;
  margin-top: 4px;
}

.tile-period {
  font-size: 0.72rem;
  color: var(--fg-muted);
  margin-top: 2px;
}

/* ── CHANNEL BARS ── */
.channel-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.channel-bar-row {
  display: grid;
  grid-template-columns: 54px 1fr 36px;
  align-items: center;
  gap: 10px;
}

.channel-name {
  font-size: 0.72rem;
  color: var(--fg-muted);
  font-weight: 500;
}

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

.bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 100px;
  transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.channel-pct {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--fg);
  font-family: var(--font-display);
  text-align: right;
}

/* ── CHAT SECTION ── */
.chat-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 16px;
}

.chat-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--fg);
}

.chat-hint {
  font-size: 0.8rem;
  color: var(--fg-muted);
  font-style: italic;
}

/* Chat messages */
.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 120px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 8px;
}

.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.chat-msg {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.chat-msg--user { flex-direction: row-reverse; }

.msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
}

.chat-msg--ai .msg-avatar {
  background: var(--accent-dim);
  color: var(--accent);
}

.chat-msg--user .msg-avatar {
  background: rgba(255,255,255,0.08);
  color: var(--fg);
}

.msg-bubble {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 14px 14px 14px 4px;
  padding: 12px 16px;
  font-size: 0.9rem;
  color: var(--fg);
  line-height: 1.6;
  max-width: 560px;
}

.chat-msg--user .msg-bubble {
  background: rgba(180, 255, 0, 0.08);
  border-color: rgba(180, 255, 0, 0.15);
  border-radius: 14px 14px 4px 14px;
}

.msg-bubble--loading { color: var(--fg-muted); font-style: italic; }
.msg-bubble--error { color: #ff7070; border-color: rgba(255, 112, 112, 0.2); }

/* Chat input */
.chat-input-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.chat-input {
  flex: 1;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 0.9rem;
  font-family: var(--font-body);
  color: var(--fg);
  outline: none;
  transition: border-color 0.2s;
}

.chat-input::placeholder { color: var(--fg-muted); }
.chat-input:focus { border-color: rgba(180, 255, 0, 0.4); }

.chat-send {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent);
  border: none;
  color: #080C14;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s, transform 0.1s;
  flex-shrink: 0;
}

.chat-send:hover { opacity: 0.85; }
.chat-send:active { transform: scale(0.95); }

/* Upload notification */
.upload-notif {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid rgba(180, 255, 0, 0.3);
  border-radius: 12px;
  padding: 12px 20px;
  font-size: 0.88rem;
  color: var(--fg);
  z-index: 999;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .tiles-grid { grid-template-columns: repeat(2, 1fr); }
  .tile--channels { grid-column: span 2; }
}

@media (max-width: 600px) {
  .dashboard-wrap { padding: 100px 20px 60px; }
  .tiles-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .tile--channels { grid-column: span 2; }
  .chat-section { padding: 20px; }
}

@media (max-width: 400px) {
  .tiles-grid { grid-template-columns: 1fr; }
  .tile--channels { grid-column: span 1; }
}