:root {
  --bg-main: #0f172a;
  --bg-sidebar: #1e293b;
  --bg-card: #1e293b;
  --bg-hover: #334155;
  --border-color: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent: #38bdf8;
  --accent-hover: #0284c7;
  --danger: #ef4444;
  --success: #22c55e;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background: var(--bg-main);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
}

.app-layout {
  display: flex;
  height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 320px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.brand h2 { font-size: 1.25rem; font-weight: 700; color: #fff; }
.logo-icon {
  background: var(--accent);
  color: #000;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.section-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  font-weight: 600;
}

.control-group, .platform-selector {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

select, input[type="text"], input[type="number"] {
  background: #0f172a;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.9rem;
  outline: none;
}
select:focus, input:focus { border-color: var(--accent); }

/* Stats Card */
.stats-card {
  background: #0f172a;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.stat-item { display: flex; flex-direction: column; }
.stat-label { font-size: 0.75rem; color: var(--text-muted); }
.stat-value { font-size: 1.25rem; font-weight: 700; color: var(--accent); }

/* Instructions Box */
.bridge-instructions {
  background: rgba(56, 189, 248, 0.05);
  border: 1px dashed var(--accent);
  padding: 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: auto;
}
.bridge-instructions h4 { color: var(--accent); margin-bottom: 6px; }

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-main);
  overflow: hidden;
}

/* Top Bar */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
}
.action-buttons { display: flex; gap: 8px; align-items: center; }

/* Buttons */
.btn {
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}
.btn-primary { background: var(--accent); color: #000; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-outline { background: transparent; border-color: var(--border-color); color: var(--text-main); }
.btn-outline:hover { background: var(--bg-hover); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text-main); }
.btn-danger:hover { color: var(--danger); }
.btn-sm { padding: 4px 8px; font-size: 0.75rem; width: 100%; margin-top: 8px; }

/* Status Dot */
.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #64748b;
}
.status-indicator.active .status-dot { background: var(--success); box-shadow: 0 0 8px var(--success); }
.status-indicator.active { color: var(--text-main); }

/* Filter Bar */
.filter-bar {
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--border-color);
}
.filter-bar input { flex: 1; max-width: 450px; }
.counter-badge { font-size: 0.85rem; color: var(--text-muted); }

/* Table Container */
.table-container {
  flex: 1;
  overflow: auto;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}
.data-table th {
  background: var(--bg-sidebar);
  color: var(--text-muted);
  padding: 12px 16px;
  font-weight: 600;
  position: sticky;
  top: 0;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  user-select: none;
}
.data-table th:hover { color: var(--text-main); }
.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  max-width: 320px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.data-table tr:hover td { background: rgba(255, 255, 255, 0.02); }

.badge-source {
  padding: 2px 6px;
  background: #334155;
  border-radius: 4px;
  font-size: 0.75rem;
  text-transform: uppercase;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-backdrop.open { display: flex; }
.modal-window {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  width: 90%;
  max-width: 720px;
  max-height: 85vh;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.close-btn { background: none; border: none; font-size: 1.5rem; color: var(--text-muted); cursor: pointer; }
.modal-meta { padding: 10px 20px; background: #0f172a; font-size: 0.8rem; color: var(--text-muted); border-bottom: 1px solid var(--border-color); }
.modal-body { padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.message-bubble { padding: 12px; border-radius: 6px; font-size: 0.9rem; line-height: 1.5; white-space: pre-wrap; }
.bubble-user { background: #1e3a8a; border-left: 4px solid var(--accent); }
.bubble-assistant { background: #0f172a; border-left: 4px solid #a855f7; }