/* Pulse RAOS Preview Panel — Dark Theme */
:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #21262d;
  --bg-card: #1c2128;
  --border: #30363d;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --accent: #58a6ff;
  --accent-dim: #1f6feb;
  --green: #3fb950;
  --yellow: #d29922;
  --red: #f85149;
  --orange: #db6d28;
  --purple: #bc8cff;
  --sidebar-width: 220px;
  --topbar-height: 44px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
}

/* Layout */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: var(--topbar-height) 1fr;
  height: 100vh;
}

/* Top Bar */
.top-bar {
  grid-column: 1 / -1;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 16px;
  z-index: 10;
}
.top-bar .brand {
  font-weight: 700;
  font-size: 14px;
  color: var(--accent);
  white-space: nowrap;
}
.top-bar .status-pills {
  display: flex;
  gap: 12px;
  margin-left: auto;
}
.status-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  background: var(--bg-tertiary);
  border-radius: 12px;
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.status-pill .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  display: inline-block;
}
.dot-green { background: var(--green); }
.dot-yellow { background: var(--yellow); }
.dot-red { background: var(--red); }
.dot-grey { background: var(--text-muted); }

/* Sidebar */
.sidebar {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 8px 0;
}
.sidebar a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  transition: background 0.15s, color 0.15s;
  border-left: 3px solid transparent;
}
.sidebar a:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}
.sidebar a.active {
  color: var(--text-primary);
  background: var(--bg-tertiary);
  border-left-color: var(--accent);
}
.sidebar .nav-icon {
  width: 16px;
  text-align: center;
  font-size: 14px;
}

/* Main Content */
.main-content {
  overflow-y: auto;
  padding: 20px;
}

/* Section Headers */
.screen-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 4px;
}
.screen-subtitle {
  color: var(--text-secondary);
  margin-bottom: 20px;
  font-size: 12px;
}

/* Cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.card-title {
  font-weight: 600;
  font-size: 13px;
}
.card-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
}
.card-label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Badge */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}
.badge-green { background: rgba(63,185,80,0.15); color: var(--green); }
.badge-yellow { background: rgba(210,153,34,0.15); color: var(--yellow); }
.badge-red { background: rgba(248,81,73,0.15); color: var(--red); }
.badge-blue { background: rgba(88,166,255,0.15); color: var(--accent); }
.badge-grey { background: var(--bg-tertiary); color: var(--text-secondary); }
.badge-purple { background: rgba(188,140,255,0.15); color: var(--purple); }

/* Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
}
.data-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  letter-spacing: 0.5px;
}
.data-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.data-table tr:hover td {
  background: var(--bg-tertiary);
}

/* Section */
.section {
  margin-bottom: 24px;
}
.section-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title .count {
  background: var(--bg-tertiary);
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 400;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state .empty-icon {
  font-size: 36px;
  margin-bottom: 12px;
  opacity: 0.4;
}
.empty-state .empty-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.empty-state .empty-desc {
  font-size: 12px;
}

/* Tabs */
.tab-bar {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  gap: 0;
}
.tab-bar button {
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 8px 16px;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.tab-bar button:hover {
  color: var(--text-primary);
}
.tab-bar button.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Kanban */
.kanban {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.kanban-column {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 200px;
}
.kanban-column-header {
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.kanban-column-body {
  padding: 8px;
}
.kanban-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 6px;
  font-size: 12px;
}

/* Bar Chart (CSS) */
.bar-chart {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  margin-bottom: 20px;
}
.bar-item {
  flex: 1;
  text-align: center;
}
.bar-fill {
  background: var(--accent-dim);
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  transition: height 0.3s;
}
.bar-label {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar-value {
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 4px;
}

/* Queue Summary Bars */
.queue-bars {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin-bottom: 20px;
}
.queue-bar-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.queue-bar-item:hover {
  border-color: var(--accent);
}
.queue-bar-name {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.queue-bar-depth {
  font-size: 22px;
  font-weight: 700;
}

/* File Tree */
.file-tree {
  font-size: 13px;
}
.file-tree-item {
  padding: 4px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  border-radius: 4px;
}
.file-tree-item:hover {
  background: var(--bg-tertiary);
}
.file-tree-item .tree-icon {
  color: var(--text-muted);
  width: 16px;
  text-align: center;
}
.file-tree-indent {
  padding-left: 20px;
}

/* Command Group */
.command-group {
  margin-bottom: 16px;
}
.command-group-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 0;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.command-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}
.command-item:hover {
  background: var(--bg-tertiary);
}
.command-name {
  font-weight: 500;
  color: var(--accent);
}
.command-meta {
  font-size: 11px;
  color: var(--text-muted);
}

/* Chart Container */
.chart-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  position: relative;
  height: 240px;
}
.chart-container canvas {
  width: 100% !important;
  height: 100% !important;
}

/* Decision Card */
.decision-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--yellow);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
}
.decision-card .dc-title {
  font-weight: 600;
  margin-bottom: 6px;
}
.decision-card .dc-context {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}
.decision-card .dc-actions {
  display: flex;
  gap: 8px;
}
.btn {
  padding: 5px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn:hover { background: var(--border); }
.btn-primary {
  background: var(--accent-dim);
  border-color: var(--accent-dim);
  color: #fff;
}
.btn-primary:hover { background: var(--accent); }

/* Health Panel */
.health-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.health-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
}
.health-item .health-icon {
  font-size: 24px;
  margin-bottom: 8px;
}
.health-item .health-label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.health-item .health-value {
  font-weight: 600;
}

/* Gallery Grid */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.gallery-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s;
}
.gallery-card:hover { border-color: var(--accent); }
.gallery-card .thumb {
  height: 100px;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 24px;
}
.gallery-card .gallery-info {
  padding: 10px;
}
.gallery-card .gallery-info .gallery-title {
  font-weight: 600;
  font-size: 13px;
}
.gallery-card .gallery-info .gallery-desc {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Integration Cards */
.integration-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.integration-icon {
  width: 40px;
  height: 40px;
  background: var(--bg-tertiary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.integration-info { flex: 1; }
.integration-name { font-weight: 600; }
.integration-desc { font-size: 11px; color: var(--text-secondary); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Activity Feed */
.activity-feed { margin-bottom: 20px; }
.activity-item {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.activity-time {
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 70px;
}
.activity-text { color: var(--text-secondary); }

/* Topology Placeholder */
.topology-placeholder {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 16px;
  text-align: center;
}
.topology-nodes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 12px;
}
.topology-node {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 11px;
  color: var(--accent);
  cursor: pointer;
  transition: border-color 0.15s;
}
.topology-node:hover { border-color: var(--accent); }

/* Two-col layout */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 800px) {
  .two-col { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: repeat(3, 1fr); }
  .health-grid { grid-template-columns: 1fr; }
}
