/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: #0a0f1e;
  color: #e2e8f0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 13px;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ===== Header ===== */
.header {
  background: #111827;
  border-bottom: 1px solid #1f2937;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 100;
}
.logo { font-weight: 700; color: #f8fafc; font-size: 15px; }
.logo span { color: #3b82f6; }

/* ===== Tabs ===== */
.tabs { display: flex; gap: 4px; }
.tab {
  padding: 5px 14px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 12px;
  border: 1px solid #1f2937;
  background: transparent;
  color: #94a3b8;
  transition: all 0.15s;
}
.tab:hover { border-color: #374151; color: #e2e8f0; }
.tab.active { background: #3b82f6; color: #fff; border-color: #3b82f6; }

/* ===== Header right ===== */
.header-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.date-label { font-size: 11px; color: #4b5563; }
.btn-secondary {
  background: #1f2937;
  border: 1px solid #374151;
  color: #94a3b8;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
}
.btn-secondary:hover { color: #e2e8f0; border-color: #4b5563; }

/* ===== Pages ===== */
main { flex: 1; overflow: hidden; display: flex; }
.page { display: none; flex: 1; overflow: hidden; }
.page.active { display: flex; }

/* ===== Master-Detail Layout ===== */
.master {
  width: 300px;
  flex-shrink: 0;
  background: #111827;
  border-right: 1px solid #1f2937;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.master-header { padding: 12px 14px; border-bottom: 1px solid #1f2937; }
.master-header h3 {
  font-size: 10px;
  text-transform: uppercase;
  color: #6b7280;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.master-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}
.master-list::-webkit-scrollbar { width: 4px; }
.master-list::-webkit-scrollbar-thumb { background: #374151; border-radius: 2px; }

/* ===== Stats Row ===== */
.stats-row { display: flex; gap: 6px; }
.stat {
  flex: 1;
  background: #0f172a;
  border-radius: 6px;
  padding: 6px 4px;
  text-align: center;
}
.stat-val { font-size: 17px; font-weight: 700; }
.stat-val.blue { color: #3b82f6; }
.stat-val.green { color: #22c55e; }
.stat-val.amber { color: #f59e0b; }
.stat-val.slate { color: #94a3b8; }
.stat-label { font-size: 9px; color: #4b5563; margin-top: 1px; }

/* ===== List Items ===== */
.list-item {
  padding: 9px 10px;
  border-radius: 6px;
  cursor: pointer;
  margin-bottom: 4px;
  border: 1px solid transparent;
  transition: background 0.12s, border-color 0.12s;
}
.list-item:hover { background: #1f2937; }
.list-item.selected { background: #1e3a5f; border-color: #3b82f6; }
.view-toggle-row { display: flex; gap: 6px; margin-top: 10px; }
.view-btn { flex: 1; padding: 5px 8px; font-size: 11px; border-radius: 6px; border: 1px solid #1f2937; background: transparent; color: #6b7280; cursor: pointer; transition: all 0.15s; }
.view-btn.active { border-color: #3b82f6; background: #1e3a5f; color: #93c5fd; }
.rc-preview { font-size: 10px; color: #4b5563; margin-top: 2px; line-height: 1.4; }
.list-item.disabled { opacity: 0.45; }
.list-item.past { opacity: 0.4; }
.list-item.past .match-teams,
.list-item.past .match-league,
.list-item.past .match-time { color: #4b5563; }
.list-item.past .match-status-badge { color: #374151; }
.list-item-all {
  border-bottom: 1px solid #1f2937;
  margin-bottom: 8px;
  padding-bottom: 11px;
  border-radius: 6px 6px 0 0;
}

.item-top { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.item-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.item-dot.on { background: #22c55e; }
.item-dot.off { background: #374151; }
.item-name {
  font-size: 12px;
  color: #e2e8f0;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.item-bottom { display: flex; padding-left: 12px; font-size: 10px; color: #4b5563; }
.item-count { margin-left: auto; color: #6b7280; }

/* ===== Detail Panel ===== */
.detail {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.detail-header {
  padding: 14px 18px;
  border-bottom: 1px solid #1f2937;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-shrink: 0;
}
.detail-title { flex: 1; }
.detail-title h2 { font-size: 15px; color: #f1f5f9; margin-bottom: 4px; }
.detail-meta { font-size: 11px; color: #6b7280; display: flex; gap: 12px; flex-wrap: wrap; }

/* ===== Toggle Switch ===== */
.toggle { display: flex; align-items: center; gap: 6px; font-size: 11px; color: #94a3b8; cursor: pointer; }
.toggle-track {
  width: 32px;
  height: 18px;
  border-radius: 9px;
  background: #374151;
  position: relative;
  transition: background 0.2s;
}
.toggle-track.on { background: #22c55e; }
.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}
.toggle-track.on .toggle-thumb { transform: translateX(14px); }

/* ===== Detail Body ===== */
.detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px;
}
.detail-body::-webkit-scrollbar { width: 4px; }
.detail-body::-webkit-scrollbar-thumb { background: #374151; border-radius: 2px; }

/* ===== Section Label ===== */
.section-label {
  font-size: 10px;
  text-transform: uppercase;
  color: #4b5563;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

/* ===== Timeline ===== */
.timeline-row { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.tl-time { font-size: 10px; color: #4b5563; width: 38px; flex-shrink: 0; }
.tl-bar-wrap { flex: 1; height: 6px; background: #1f2937; border-radius: 3px; overflow: hidden; }
.tl-bar { height: 100%; border-radius: 3px; }
.tl-bar.done { background: #22c55e; width: 100%; }
.tl-bar.running { background: #f59e0b; width: 55%; }
.tl-bar.pending { width: 0; }
.tl-status { font-size: 11px; width: 14px; text-align: center; }

/* ===== Response Cards ===== */
.response-card {
  background: #111827;
  border: 1px solid #1f2937;
  border-radius: 8px;
  padding: 11px 13px;
  margin-bottom: 6px;
}
.rc-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.rc-question-label {
  font-size: 10px;
  color: #3b82f6;
  background: #1e3a5f;
  padding: 1px 7px;
  border-radius: 10px;
  font-weight: 600;
  white-space: nowrap;
}
.rc-date { font-size: 11px; color: #6b7280; }
.rc-duration {
  font-size: 10px;
  color: #374151;
  margin-left: 8px;
  background: #1f2937;
  padding: 1px 6px;
  border-radius: 4px;
}
.rc-del {
  margin-left: auto;
  cursor: pointer;
  color: #374151;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 4px;
  border: none;
  background: transparent;
}
.rc-del:hover { color: #ef4444; background: #1c0a0a; }

/* ===== Date Selector ===== */
.date-selector {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.date-btn {
  padding: 4px 12px;
  border-radius: 16px;
  border: 1px solid #374151;
  background: transparent;
  color: #6b7280;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
}
.date-btn:hover { border-color: #4b5563; color: #e2e8f0; }
.date-btn.active { background: #3b82f6; border-color: #3b82f6; color: #fff; }

/* Responses section header with date selector */
.responses-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.rc-question { font-size: 11px; color: #6b7280; margin-bottom: 6px; font-style: italic; }
.rc-short { font-size: 12px; color: #94a3b8; line-height: 1.5; margin-bottom: 6px; }
.rc-expand { font-size: 10px; color: #3b82f6; cursor: pointer; background: none; border: none; padding: 0; }
.rc-full { font-size: 12px; color: #64748b; line-height: 1.5; margin-top: 6px; display: none; }
.rc-full.visible { display: block; }

/* ===== Match items ===== */
.match-league {
  font-size: 9px;
  color: #6b7280;
  background: #1f2937;
  padding: 1px 5px;
  border-radius: 3px;
}
.match-time { font-size: 9px; color: #4b5563; margin-left: auto; }
.match-teams { font-size: 12px; color: #e2e8f0; font-weight: 500; margin: 3px 0; }
.match-bottom { display: flex; gap: 6px; align-items: center; }
.match-status-badge { font-size: 9px; color: #4b5563; margin-left: auto; }
.match-status-badge.done { color: #22c55e; }
.match-status-badge.queued { color: #f59e0b; }
.priority-badge { font-size: 9px; font-weight: 600; padding: 1px 5px; border-radius: 3px; letter-spacing: 0.3px; }
.priority-badge.p1 { background: #1e3a2a; color: #4ade80; }
.priority-badge.p2 { background: #1e2e4a; color: #60a5fa; }
.priority-badge.p3 { background: #2a2a1e; color: #facc15; }
.priority-badge.p0 { background: #1f2937; color: #4b5563; }
.priority-badge.pnull { background: #1f2937; color: #374151; }

/* ===== Trending items ===== */
.trending-item {
  background: #111827;
  border: 1px solid #1f2937;
  border-radius: 8px;
  padding: 11px 13px;
  margin-bottom: 6px;
}
.trending-date-group { font-size: 10px; text-transform: uppercase; color: #4b5563; margin: 12px 0 6px; letter-spacing: 0.05em; }

/* ===== Badge ===== */
.badge {
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 10px;
  background: #1e3a5f;
  color: #60a5fa;
}

/* ===== Empty state ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  color: #374151;
  text-align: center;
  height: 100%;
}
.empty-icon { font-size: 32px; margin-bottom: 10px; }
.empty-text { font-size: 12px; line-height: 1.5; }

/* ===== Loading ===== */
.loading { padding: 24px; color: #4b5563; font-size: 12px; }

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 12px;
  z-index: 1000;
}
.toast.hidden { display: none; }
.toast-info { background: #1e3a5f; color: #60a5fa; border: 1px solid #3b82f6; }
.toast-error { background: #1c0a0a; color: #ef4444; border: 1px solid #ef4444; }
.toast-success { background: #0a1c0a; color: #22c55e; border: 1px solid #22c55e; }

/* ===== Config Form ===== */
.cfg-section {
  background: #111827;
  border: 1px solid #1f2937;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.cfg-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}
.cfg-section-header:hover .section-label { color: #94a3b8; }
.cfg-chevron { font-size: 9px; color: #4b5563; }
.cfg-row { margin-bottom: 10px; }
.cfg-label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  color: #4b5563;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.cfg-input, .cfg-textarea {
  width: 100%;
  background: #0a0f1e;
  border: 1px solid #1f2937;
  border-radius: 5px;
  color: #e2e8f0;
  font-size: 12px;
  padding: 6px 8px;
  font-family: inherit;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
}
.cfg-input:focus, .cfg-textarea:focus { border-color: #3b82f6; }
.cfg-actions { display: flex; justify-content: flex-end; margin-top: 4px; }
.btn-save {
  background: #3b82f6;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 16px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-save:hover { background: #2563eb; }
.btn-save:disabled { background: #1f2937; color: #4b5563; cursor: default; }

/* ===== Embeddings page ===== */
:root {
  --cat-blue: #3b82f6;
  --cat-green: #22c55e;
  --cat-amber: #f59e0b;
}
.embed-category-label {
  font-size: 9px;
  text-transform: uppercase;
  color: #4b5563;
  letter-spacing: .06em;
  padding: 10px 10px 4px;
}
.embed-cat-badge {
  font-size: 8px;
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 600;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.embed-cat-badge.blue  { background: #1e3a5f; color: #60a5fa; }
.embed-cat-badge.green { background: #1a2e1a; color: #4ade80; }
.embed-cat-badge.amber { background: #2a1e0a; color: #fbbf24; }

.badge.blue-badge  { background: #1e3a5f; color: #60a5fa; }
.badge.green-badge { background: #1a2e1a; color: #4ade80; }
.badge.amber-badge { background: #2a1e0a; color: #fbbf24; }

.embed-preview-box {
  background: #0a0f1e;
  border: 1px solid #1f2937;
  border-radius: 10px;
  padding: 20px;
  overflow-x: auto;
}

.embed-code-box {
  background: #050a14;
  border: 1px solid #1f2937;
  border-radius: 8px;
  padding: 14px 16px;
  overflow-x: auto;
}
.embed-code {
  font-family: 'SF Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 11px;
  color: #64748b;
  line-height: 1.7;
  white-space: pre;
  margin: 0;
}

.btn-copy {
  background: #1f2937;
  border: 1px solid #374151;
  color: #94a3b8;
  padding: 4px 14px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-copy:hover { border-color: #3b82f6; color: #60a5fa; }
.btn-copy.copied { background: #0a1c0a; border-color: #22c55e; color: #22c55e; }

/* Clickable embed items */
.embed-item-clickable {
  cursor: pointer;
  border-radius: 8px;
  transition: filter 0.15s;
}
.embed-item-clickable:hover { filter: brightness(1.12); }
.embed-item-clickable:active { filter: brightness(0.95); }

/* Embed modal */
.embed-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  transition: opacity 0.18s;
}
.embed-modal-overlay.visible { opacity: 1; }
.embed-modal-card {
  background: #111827;
  border: 1px solid #1f2937;
  border-radius: 12px;
  width: 100%;
  max-width: 640px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px rgba(0,0,0,.6);
  transform: translateY(8px);
  transition: transform 0.18s;
}
.embed-modal-overlay.visible .embed-modal-card { transform: translateY(0); }
.embed-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid #1f2937;
  flex-shrink: 0;
}
.embed-modal-title {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: #f1f5f9;
  line-height: 1.4;
}
.embed-modal-close {
  background: none;
  border: none;
  color: #4b5563;
  font-size: 14px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  flex-shrink: 0;
}
.embed-modal-close:hover { color: #ef4444; background: #1c0a0a; }
.embed-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.7;
}
.embed-modal-body::-webkit-scrollbar { width: 4px; }
.embed-modal-body::-webkit-scrollbar-thumb { background: #374151; border-radius: 2px; }

/* Markdown rendered inside embed previews */
.embed-md p          { margin: 0 0 6px; }
.embed-md p:last-child { margin-bottom: 0; }
.embed-md strong     { color: #e2e8f0; font-weight: 600; }
.embed-md em         { font-style: italic; color: inherit; }
.embed-md ul, .embed-md ol { margin: 4px 0 6px 14px; padding: 0; }
.embed-md li         { margin-bottom: 2px; }
.embed-md h1, .embed-md h2, .embed-md h3 { color: #f1f5f9; font-weight: 600; margin: 8px 0 4px; line-height: 1.3; }
.embed-md h1 { font-size: 14px; }
.embed-md h2 { font-size: 13px; }
.embed-md h3 { font-size: 12px; }
.embed-md code { background: #1f2937; color: #93c5fd; padding: 1px 5px; border-radius: 3px; font-size: 11px; font-family: 'SF Mono', monospace; }
.embed-md pre  { background: #0a0f1e; border: 1px solid #1f2937; border-radius: 5px; padding: 8px 10px; overflow-x: auto; margin: 6px 0; }
.embed-md pre code { background: none; padding: 0; }
.embed-md blockquote { border-left: 2px solid #3b82f6; margin: 6px 0; padding: 2px 10px; color: #6b7280; }
.embed-md hr { border: none; border-top: 1px solid #1f2937; margin: 8px 0; }
.embed-md a  { color: #60a5fa; text-decoration: none; }

/* Compact variant — tighter spacing for small widgets */
.embed-md-sm p    { margin-bottom: 3px; }
.embed-md-sm ul, .embed-md-sm ol { margin: 2px 0 3px 12px; }
.embed-md-sm li   { margin-bottom: 1px; }
.embed-md-sm h1, .embed-md-sm h2, .embed-md-sm h3 { margin: 4px 0 2px; font-size: 11px; }

/* ===== Single panel (Trending) ===== */
.single-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.single-panel-header {
  padding: 14px 18px;
  border-bottom: 1px solid #1f2937;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.single-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px;
}
.single-panel-body::-webkit-scrollbar { width: 4px; }
.single-panel-body::-webkit-scrollbar-thumb { background: #374151; border-radius: 2px; }
