:root {
  --bg:              #0f1117;
  --bg-card:         #161b27;
  --bg-card-hover:   #1c2235;
  --bg-sidebar:      #0d1120;
  --bg-input:        #111624;
  --border:          #1e2640;
  --border-subtle:   #181f32;

  --text-primary:    #dde3f0;
  --text-secondary:  #6b7aaa;
  --text-muted:      #3d4d72;

  --accent:          #4f7ef5;
  --accent-hover:    #6690f7;

  --amber:           #f0a030;
  --amber-bg:        rgba(240, 160, 48, 0.12);

  --badge-tg:        #2b62cc;
  --badge-tg-bg:     rgba(43, 98, 204, 0.18);
  --badge-dw:        #c0392b;
  --badge-dw-bg:     rgba(192, 57, 43, 0.18);
  --badge-rss:       #1e7e46;
  --badge-rss-bg:    rgba(30, 126, 70, 0.18);

  --sidebar-width:   240px;
  --topbar-height:   48px;
  --statusbar-height: 32px;
  --radius:          5px;
  --transition:      150ms ease;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input {
  font: inherit;
  color: inherit;
  border: none;
  background: none;
  outline: none;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
}

/* Layout */

.layout {
  display: flex;
  height: calc(100vh - var(--statusbar-height));
}

/* Sidebar */

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-brand {
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.brand-placeholder {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-name {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--text-primary);
}

.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.brand-logo {
  max-width: 100%;
  height: auto;
}

.source-nav {
  flex: 1;
  padding: 12px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 7px 16px;
  border-radius: 0;
  color: var(--text-secondary);
  font-size: 13px;
  text-align: left;
  transition: background var(--transition), color var(--transition);
}

.nav-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.nav-item.active {
  color: var(--text-primary);
  background: rgba(79, 126, 245, 0.1);
}

.nav-count {
  font-size: 11px;
  color: var(--text-muted);
  min-width: 24px;
  text-align: right;
}

.nav-item.active .nav-count {
  color: var(--text-secondary);
}

.nav-section {
  margin-top: 20px;
}

.nav-section-label {
  padding: 0 16px 6px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Main column */

.main-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Topbar */

.topbar {
  height: var(--topbar-height);
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  gap: 16px;
}

.topbar-live {
  display: flex;
  align-items: center;
  gap: 7px;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3db86a;
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

.live-label {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.topbar-pills {
  display: flex;
  gap: 8px;
}

.type-pill {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 12px;
  letter-spacing: 0.02em;
}

.pill-telegram {
  color: var(--badge-tg);
  background: var(--badge-tg-bg);
}

.pill-darkweb {
  color: var(--badge-dw);
  background: var(--badge-dw-bg);
}

.pill-rss {
  color: var(--badge-rss);
  background: var(--badge-rss-bg);
}

/* Filter bar */

.filter-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.filter-tabs {
  display: flex;
  gap: 2px;
}

.filter-tab {
  padding: 5px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
}

.filter-tab:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

.filter-tab.active {
  color: var(--text-primary);
  background: var(--bg-card);
}

.search-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 12px;
  font-size: 13px;
  color: var(--text-primary);
  transition: border-color var(--transition);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-input:focus {
  border-color: var(--accent);
}

/* Feed */

.feed {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px;
}

.feed-state {
  padding: 48px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* Cards */

.card {
  border-bottom: 1px solid var(--border-subtle);
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card:last-child {
  border-bottom: none;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.source-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 3px;
  letter-spacing: 0.02em;
}

.badge-telegram { color: var(--badge-tg);  background: var(--badge-tg-bg); }
.badge-darkweb  { color: var(--badge-dw);  background: var(--badge-dw-bg); }
.badge-rss      { color: var(--badge-rss); background: var(--badge-rss-bg); }

.source-name {
  font-size: 12px;
  color: var(--text-secondary);
}

.card-timestamp {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
}

.card-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
}

.card-snippet {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.tag {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 3px;
  background: var(--bg-card-hover);
  color: var(--text-muted);
}

.tag-india {
  color: var(--amber);
  background: var(--amber-bg);
  font-weight: 500;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 2px;
}

.bookmark-btn {
  font-size: 12px;
  color: var(--text-muted);
  padding: 3px 0;
  transition: color var(--transition);
  display: flex;
  align-items: center;
  gap: 5px;
}

.bookmark-btn:hover {
  color: var(--text-primary);
}

.bookmark-btn.saved {
  color: var(--amber);
}

.bookmark-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.read-more {
  font-size: 12px;
  color: var(--accent);
  transition: color var(--transition);
}

.read-more:hover {
  color: var(--accent-hover);
}

/* Load more */

.load-more-wrap {
  padding: 16px 20px;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
}

.load-more-btn {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 8px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: background var(--transition), color var(--transition);
}

.load-more-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

/* Status bar */

.statusbar {
  height: var(--statusbar-height);
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  overflow: hidden;
}

.status-segment {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.status-sep {
  width: 1px;
  height: 12px;
  background: var(--border);
  flex-shrink: 0;
}

/* Responsive */

@media (max-width: 720px) {
  .layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 200px;
  }

  .source-nav {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 8px 12px;
    gap: 4px;
  }

  .nav-section {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 0;
    flex-shrink: 0;
  }

  .nav-section-label {
    padding: 0 4px 0 0;
    white-space: nowrap;
  }

  .nav-item {
    flex-shrink: 0;
    border-radius: var(--radius);
    padding: 5px 10px;
    white-space: nowrap;
  }

  .nav-all {
    flex-shrink: 0;
  }

  .filter-bar {
    flex-wrap: wrap;
    gap: 8px;
  }

  .search-input {
    width: 100%;
    flex: none;
  }

  .statusbar {
    padding: 0 12px;
    gap: 8px;
  }
}
