:root {
  --bg:        #011c15;
  --surface:   #04342C;
  --surface2:  #0a4a3a;
  --border:    #1a6b52;
  --accent:    #1D9E75;
  --accent-dim:#137a59;
  --text:      #E1F5EE;
  --muted:     #7ab5a0;
  --danger:    #e05353;
  --warning:   #d97706;
  --info:      #2563eb;
  --purple:    #7c3aed;

  --stream-tools:      #1D9E75;
  --stream-seo:        #2563eb;
  --stream-datafix:    #d97706;
  --stream-engagement: #7c3aed;
  --stream-whitelabel: #dc2626;

  --radius: 8px;
  --shadow: 0 4px 16px rgba(0,0,0,.4);
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Header ─────────────────────────────────────────────────────────────── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.logo { display: flex; align-items: center; gap: 10px; }
.logo-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.logo-text { font-weight: 600; font-size: 15px; letter-spacing: .01em; }
.logo-sub  { font-size: 11px; color: var(--muted); margin-left: 4px; }
.header-meta { font-size: 12px; color: var(--muted); }

/* ── Main Tabs (Oracle / UGC / Leads / RRC / Trading) ───────────────────── */
.main-tabs {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  gap: 4px;
}
.main-tab {
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
.main-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.main-tab.disabled {
  opacity: .35;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Layout ──────────────────────────────────────────────────────────────── */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.oracle-layout {
  display: flex;
  height: calc(100vh - 56px - 45px);
}

/* ── Oracle Sidebar ──────────────────────────────────────────────────────── */
.oracle-sidebar {
  width: 180px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 16px 0;
}
.sidebar-item {
  display: block;
  width: 100%;
  padding: 10px 20px;
  font-size: 13px;
  color: var(--muted);
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: color .15s, background .15s, border-color .15s;
}
.sidebar-item:hover { background: var(--surface2); color: var(--text); }
.sidebar-item.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--surface2);
}

/* ── Oracle Panels ───────────────────────────────────────────────────────── */
.oracle-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}
.oracle-panel { display: none; }
.oracle-panel.active { display: block; }

/* ── Panel Headers ───────────────────────────────────────────────────────── */
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.panel-title { font-size: 18px; font-weight: 600; }
.panel-sub   { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ── Stream Badge ────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.badge-tools      { background: rgba(29,158,117,.15); color: var(--stream-tools); }
.badge-seo        { background: rgba(37,99,235,.15);  color: var(--stream-seo); }
.badge-datafix    { background: rgba(217,119,6,.15);  color: var(--stream-datafix); }
.badge-engagement { background: rgba(124,58,237,.15); color: var(--stream-engagement); }
.badge-whitelabel { background: rgba(220,38,38,.15);  color: var(--stream-whitelabel); }
.badge-pending    { background: rgba(122,181,160,.15);color: var(--muted); }
.badge-approved   { background: rgba(29,158,117,.15); color: var(--accent); }
.badge-skipped    { background: rgba(224,83,83,.15);  color: var(--danger); }
.badge-scheduled  { background: rgba(37,99,235,.15);  color: var(--info); }

/* ── Queue Card ──────────────────────────────────────────────────────────── */
.queue-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.queue-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.queue-date { font-size: 12px; color: var(--muted); margin-left: auto; }

.post-copy {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  margin-bottom: 14px;
  min-height: 80px;
}
.post-copy[contenteditable="true"] {
  outline: none;
  border-color: var(--accent);
  cursor: text;
}

.image-preview {
  margin-bottom: 14px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface2);
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.image-preview img {
  max-width: 100%;
  max-height: 280px;
  object-fit: contain;
  display: block;
}
.image-placeholder { color: var(--muted); font-size: 12px; padding: 24px; }

.queue-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  padding: 8px 18px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: opacity .15s, background .15s;
}
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary  { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover:not(:disabled)  { background: var(--accent-dim); }
.btn-ghost    { background: transparent; color: var(--muted); border-color: var(--border); }
.btn-ghost:hover:not(:disabled)    { background: var(--surface2); color: var(--text); }
.btn-danger   { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover:not(:disabled)   { background: rgba(224,83,83,.1); }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ── Empty State ─────────────────────────────────────────────────────────── */
.empty {
  text-align: center;
  padding: 60px 24px;
  color: var(--muted);
}
.empty-icon { font-size: 36px; margin-bottom: 12px; }
.empty-title { font-size: 16px; font-weight: 500; color: var(--text); margin-bottom: 6px; }
.empty-sub   { font-size: 13px; }

/* ── Loading ─────────────────────────────────────────────────────────────── */
.loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 40px;
  color: var(--muted);
  font-size: 13px;
}
.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast ───────────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 18px;
  font-size: 13px;
  box-shadow: var(--shadow);
  animation: slideIn .2s ease;
  max-width: 320px;
}
.toast.success { border-left: 3px solid var(--accent); }
.toast.error   { border-left: 3px solid var(--danger); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Calendar ────────────────────────────────────────────────────────────── */
.calendar-grid {
  display: grid;
  grid-template-columns: 80px repeat(7, 1fr);
  gap: 2px;
  font-size: 12px;
}
.cal-header { color: var(--muted); text-align: center; padding: 6px 2px; font-weight: 600; }
.cal-week   { color: var(--muted); display: flex; align-items: center; padding: 4px 8px; font-size: 11px; }
.cal-cell {
  padding: 6px 4px;
  border-radius: 4px;
  text-align: center;
  min-height: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
}
.cal-cell.today { background: var(--surface2); border: 1px solid var(--border); }
.cal-day-num { font-size: 11px; color: var(--muted); }
.cal-stream  { font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 3px; }

/* ── History Table ───────────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 10px 12px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border-bottom: 1px solid var(--border); }
td { padding: 12px; font-size: 13px; border-bottom: 1px solid rgba(26,107,82,.3); vertical-align: top; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(10,74,58,.3); }

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-dim); }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .oracle-sidebar { width: 140px; }
  .oracle-content { padding: 16px; }
  .main-tab { padding: 10px 12px; font-size: 12px; }
}
