/* ============================================================
   RahuFeed — Dark Intelligence Feed Theme
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg:           #0d0f14;
  --bg-2:         #111520;
  --bg-card:      #161b27;
  --bg-card-h:    #1c2235;
  --bg-input:     #1a1f2e;
  --bg-chip:      #1e2536;

  /* Borders */
  --border:       #242c40;
  --border-dim:   #1c2234;

  /* Brand */
  --accent:       #4f8ef7;
  --accent-dim:   #1e3a70;
  --accent-glow:  rgba(79, 142, 247, 0.18);

  /* Text */
  --text:         #e4e8f2;
  --text-2:       #9aa3bc;
  --text-3:       #55607a;

  /* Semantic */
  --red:          #e05c5c;
  --red-dim:      #3a1a1a;
  --green:        #3ecf8e;
  --green-dim:    #0f3026;
  --orange:       #f5a623;
  --orange-dim:   #3a2408;
  --blue:         #4f8ef7;
  --blue-dim:     #1e3a70;

  /* Perplexity teal */
  --pplx:         #2ec4b6;
  --pplx-dim:     #0d2f2c;

  /* Spacing */
  --r:            10px;
  --r-sm:         6px;
  --r-lg:         14px;

  /* Layout */
  --header-h:     52px;
  --status-h:     24px;
  --sidebar-w:    220px;
  --bnav-h:       60px;

  /* Typography */
  --font:         'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; background: none; border: none; font: inherit; color: inherit; }
input, textarea, select { font: inherit; color: inherit; }
svg { display: block; flex-shrink: 0; }

/* ── Scrollbars ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ── Header ─────────────────────────────────────────────────── */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(13, 15, 20, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-dim);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--header-h);
  padding: 0 16px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.header-center {
  flex: 1;
  min-width: 0;
  max-width: 480px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  margin-left: auto;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.3px;
  color: var(--text);
  white-space: nowrap;
}

/* Hamburger */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 32px;
  height: 32px;
  padding: 6px;
  border-radius: var(--r-sm);
  transition: background 0.15s;
}
.menu-toggle:hover { background: var(--bg-chip); }
.menu-toggle span {
  display: block;
  height: 1.5px;
  background: var(--text-2);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}
.menu-toggle.open span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.menu-toggle.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.menu-toggle.open span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

/* Search */
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.search-input {
  width: 100%;
  height: 34px;
  padding: 0 36px 0 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  transition: border-color 0.15s, background 0.15s;
  outline: none;
}
.search-input::placeholder { color: var(--text-3); }
.search-input:focus {
  border-color: var(--accent);
  background: var(--bg-card);
}
.search-submit {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
}
.search-submit:hover { color: var(--accent); }

/* Icon buttons */
.icon-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--bg-chip); color: var(--text); }
.icon-btn.active { color: var(--accent); }

.hdr-badge {
  position: absolute;
  top: 4px; right: 4px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  background: var(--red);
  color: #fff;
  font-size: 9px;
  font-weight: 600;
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

/* Refresh spin animation */
.refresh-btn.spinning svg {
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Status bar */
.status-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  height: var(--status-h);
  padding: 0 16px;
  font-size: 11px;
  color: var(--text-3);
  border-top: 1px solid var(--border-dim);
}
.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-3);
  transition: background 0.3s;
}
.live-dot.live { background: var(--green); box-shadow: 0 0 6px var(--green); }
.live-dot.live { animation: pulse-dot 2s ease-in-out infinite; }
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ── App Layout ─────────────────────────────────────────────── */
.app-layout {
  display: flex;
  margin-top: calc(var(--header-h) + var(--status-h));
  min-height: calc(100vh - var(--header-h) - var(--status-h));
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: sticky;
  top: calc(var(--header-h) + var(--status-h));
  height: calc(100vh - var(--header-h) - var(--status-h));
  overflow: hidden;
  border-right: 1px solid var(--border-dim);
  background: var(--bg-2);
}

.sidebar-scroll {
  height: 100%;
  overflow-y: auto;
  padding: 16px 8px 80px;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 89;
}

.nav-group {
  margin-bottom: 4px;
}

.nav-group-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 8px 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}

.add-topic-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  color: var(--text-3);
  transition: background 0.15s, color 0.15s;
}
.add-topic-btn:hover { background: var(--bg-card-h); color: var(--accent); }

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--text-2);
  transition: background 0.12s, color 0.12s;
  text-align: left;
}
.nav-item:hover { background: var(--bg-chip); color: var(--text); }
.nav-item.active { background: var(--accent-dim); color: var(--accent); font-weight: 500; }

.flag-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 14px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: var(--bg-chip);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-3);
  flex-shrink: 0;
}

.nav-pill {
  margin-left: auto;
  min-width: 18px;
  height: 16px;
  padding: 0 5px;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.watchlist-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--text-2);
  transition: background 0.12s, color 0.12s;
  text-align: left;
}
.watchlist-nav-item:hover { background: var(--bg-chip); color: var(--text); }
.watchlist-nav-item.active { background: var(--accent-dim); color: var(--accent); }
.watchlist-del {
  opacity: 0;
  color: var(--text-3);
  transition: opacity 0.15s, color 0.15s;
  padding: 2px;
  border-radius: 3px;
}
.watchlist-nav-item:hover .watchlist-del { opacity: 1; }
.watchlist-del:hover { color: var(--red); }

/* ── Main Content ───────────────────────────────────────────── */
.main {
  flex: 1;
  min-width: 0;
  padding: 24px 24px 100px;
  max-width: 900px;
}

/* ── Views ──────────────────────────────────────────────────── */
.view { display: none; }
.view.active { display: block; }

.page-header { margin-bottom: 20px; }
.page-title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.5px;
  line-height: 1.2;
}
.page-sub {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-3);
}
.count-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: var(--bg-chip);
  border: 1px solid var(--border);
  border-radius: 99px;
  font-size: 11px;
  color: var(--text-3);
  margin-top: 6px;
}

/* ── Hero Grid ──────────────────────────────────────────────── */
.hero-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin-bottom: 32px;
}

.hero-card {
  display: flex;
  flex-direction: column;
  padding: 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.hero-card:hover {
  background: var(--bg-card-h);
  border-color: var(--accent-dim);
  transform: translateY(-1px);
}
.hero-card:first-child {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, #0e1a2e 0%, #121b28 100%);
  border-color: var(--accent-dim);
}

.hero-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.hero-card-source {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.hero-card-time { font-size: 11px; color: var(--text-3); }

.hero-card-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.2px;
  flex: 1;
  margin-bottom: 10px;
}
.hero-card:first-child .hero-card-title { font-size: 18px; }

.hero-card-summary {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.5;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}

/* ── Feed Section ───────────────────────────────────────────── */
.feed-section-header {
  margin-bottom: 4px;
}
.section-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 10px;
}

/* Tabs */
.tabs-row {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 2px;
  margin-bottom: 12px;
  scrollbar-width: none;
}
.tabs-row::-webkit-scrollbar { display: none; }

.tab {
  flex-shrink: 0;
  padding: 5px 11px;
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  background: var(--bg-chip);
  border: 1px solid var(--border-dim);
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  white-space: nowrap;
}
.tab:hover { background: var(--bg-card-h); color: var(--text); }
.tab.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: rgba(79,142,247,0.3);
}

/* ── Article List ───────────────────────────────────────────── */
.article-list { display: flex; flex-direction: column; gap: 1px; }

.article-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  background: var(--bg-card);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 0.12s;
  border: 1px solid transparent;
}
.article-row:hover {
  background: var(--bg-card-h);
  border-color: var(--border-dim);
}
.article-row + .article-row { margin-top: 2px; }

.article-row-main { flex: 1; min-width: 0; }

.article-row-title {
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text);
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-row-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.article-row-source {
  font-size: 11px;
  color: var(--text-3);
  font-weight: 500;
}
.article-row-time { font-size: 11px; color: var(--text-3); }
.article-row-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s;
}
.article-row:hover .article-row-actions { opacity: 1; }

.row-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: var(--text-3);
  transition: background 0.12s, color 0.12s;
}
.row-action-btn:hover { background: var(--bg-chip); color: var(--accent); }
.row-action-btn.followed { color: var(--orange); }

/* ── Classification Badges ──────────────────────────────────── */
.clf {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.clf-breaking  { background: rgba(224,92,92,0.15); color: var(--red); border: 1px solid rgba(224,92,92,0.3); }
.clf-political { background: rgba(79,142,247,0.12); color: var(--accent); border: 1px solid rgba(79,142,247,0.25); }
.clf-financial { background: rgba(245,166,35,0.12); color: var(--orange); border: 1px solid rgba(245,166,35,0.25); }
.clf-supply_chain { background: rgba(62,207,142,0.12); color: var(--green); border: 1px solid rgba(62,207,142,0.25); }
.clf-watchlist { background: rgba(46,196,182,0.12); color: var(--pplx); border: 1px solid rgba(46,196,182,0.25); }
.clf-search    { background: var(--bg-chip); color: var(--text-2); border: 1px solid var(--border); }
.clf-general   { background: var(--bg-chip); color: var(--text-3); border: 1px solid var(--border-dim); }

/* ── Premium indicator ──────────────────────────────────────── */
.premium-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--orange);
  flex-shrink: 0;
  title: "Premium source";
}

/* ── Developing Stories ─────────────────────────────────────── */
.developing-card {
  padding: 18px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  margin-bottom: 10px;
  transition: background 0.12s;
}
.developing-card:hover { background: var(--bg-card-h); }

.developing-headline {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
  line-height: 1.35;
  margin-bottom: 8px;
}
.developing-desc {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.55;
  margin-bottom: 12px;
}

.developing-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  background: var(--bg-chip);
  border: 1px solid var(--border);
  border-radius: 99px;
  font-size: 11px;
  color: var(--text-2);
}

.watch-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  margin-bottom: 4px;
}
.watch-text {
  font-size: 13px;
  color: var(--accent);
  font-style: italic;
}

/* ── Follow-Ups ─────────────────────────────────────────────── */
.followup-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  margin-bottom: 10px;
  overflow: hidden;
}
.followup-card-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
}
.followup-card-main { flex: 1; min-width: 0; }
.followup-headline {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 5px;
}
.followup-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-3);
  flex-wrap: wrap;
}
.followup-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.followup-actions .btn { font-size: 11px; padding: 4px 8px; }

.followup-updates {
  border-top: 1px solid var(--border-dim);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.update-item {
  padding: 10px 12px;
  background: rgba(79,142,247,0.05);
  border-left: 2px solid var(--accent-dim);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-2);
}
.update-item.unread {
  background: rgba(79,142,247,0.1);
  border-left-color: var(--accent);
  color: var(--text);
}
.update-time {
  display: block;
  font-size: 10px;
  color: var(--text-3);
  margin-top: 4px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  gap: 10px;
}
.empty-icon { color: var(--text-3); }
.empty-title { font-size: 15px; font-weight: 500; color: var(--text-2); }
.empty-sub { font-size: 13px; color: var(--text-3); max-width: 280px; }

/* ── Alerts ─────────────────────────────────────────────────── */
.alert-item {
  display: flex;
  gap: 12px;
  padding: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  margin-bottom: 8px;
}
.alert-item.severity-high {
  background: var(--red-dim);
  border-color: rgba(224,92,92,0.3);
}
.alert-item.severity-medium {
  background: rgba(245,166,35,0.06);
  border-color: rgba(245,166,35,0.2);
}
.alert-severity-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
}
.severity-high .alert-severity-dot { background: var(--red); }
.severity-medium .alert-severity-dot { background: var(--orange); }
.alert-main { flex: 1; min-width: 0; }
.alert-headline { font-size: 13.5px; font-weight: 600; margin-bottom: 4px; line-height: 1.35; }
.alert-reason { font-size: 13px; color: var(--text-2); line-height: 1.45; }
.alert-meta { font-size: 11px; color: var(--text-3); margin-top: 5px; }

/* ── Search ──────────────────────────────────────────────────── */
.briefing-card {
  padding: 16px 18px;
  background: linear-gradient(135deg, rgba(79,142,247,0.08) 0%, rgba(79,142,247,0.03) 100%);
  border: 1px solid rgba(79,142,247,0.2);
  border-radius: var(--r-lg);
  margin-bottom: 16px;
}
.briefing-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 6px;
}
.briefing-text {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text);
}

.pplx-card {
  padding: 16px 18px;
  background: linear-gradient(135deg, rgba(46,196,182,0.08) 0%, rgba(46,196,182,0.03) 100%);
  border: 1px solid rgba(46,196,182,0.2);
  border-radius: var(--r-lg);
  margin-bottom: 16px;
}
.pplx-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--pplx);
  margin-bottom: 6px;
}
.pplx-text {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-2);
  white-space: pre-wrap;
}

/* ── Article Drawer ─────────────────────────────────────────── */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 199;
  opacity: 0;
  transition: opacity 0.2s;
}
.drawer-overlay.visible { opacity: 1; }

.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(480px, 100vw);
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.drawer.open { transform: translateX(0); }

.drawer-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 16px;
  border-bottom: 1px solid var(--border-dim);
  flex-shrink: 0;
}
.drawer-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  color: var(--text-3);
  transition: background 0.12s, color 0.12s;
  flex-shrink: 0;
}
.drawer-close:hover { background: var(--bg-chip); color: var(--text); }
#drawer-chips { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; align-items: center; }

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}
.drawer-title {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.3px;
  margin-bottom: 10px;
}
.drawer-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.drawer-source { font-weight: 500; }
.drawer-divider {
  height: 1px;
  background: var(--border-dim);
  margin: 16px 0;
}
.drawer-summary-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-3);
  margin-bottom: 8px;
}
.drawer-summary-text {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-2);
}
.drawer-summary-text.loading { color: var(--text-3); font-style: italic; }

.drawer-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border-top: 1px solid var(--border-dim);
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.12s, color 0.12s, opacity 0.12s;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { background: #6aa0f8; }

.btn-secondary {
  background: var(--bg-chip);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) { background: var(--bg-card-h); }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) { background: var(--bg-chip); color: var(--text); }

.btn-danger {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid rgba(224,92,92,0.3);
}
.btn-danger:hover:not(:disabled) { background: rgba(224,92,92,0.2); }

.btn-sm { font-size: 11px; padding: 4px 9px; }

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: modal-in 0.18s ease;
}
@keyframes modal-in {
  from { transform: scale(0.95) translateY(8px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-dim);
  flex-shrink: 0;
}
.modal-header h3 { font-size: 15px; font-weight: 600; }
.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--r-sm);
  color: var(--text-3);
  transition: background 0.12s, color 0.12s;
}
.modal-close:hover { background: var(--bg-chip); color: var(--text); }

.modal-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 18px;
  border-top: 1px solid var(--border-dim);
  flex-shrink: 0;
}

.field-label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
}
.field-hint { font-weight: 400; color: var(--text-3); }
.field-input, .field-textarea {
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
  resize: vertical;
}
.field-input:focus, .field-textarea:focus {
  border-color: var(--accent);
}
.field-input::placeholder, .field-textarea::placeholder { color: var(--text-3); }

/* ── Toast ──────────────────────────────────────────────────── */
.toast-stack {
  position: fixed;
  bottom: calc(var(--bnav-h) + 12px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  z-index: 500;
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 32px);
}

.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg-card-h);
  border: 1px solid var(--border);
  border-radius: var(--r);
  font-size: 13px;
  color: var(--text);
  pointer-events: auto;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
  animation: toast-in 0.2s ease;
  white-space: nowrap;
}
.toast.success { border-color: rgba(62,207,142,0.3); color: var(--green); }
.toast.error   { border-color: rgba(224,92,92,0.3); color: var(--red); }
@keyframes toast-in {
  from { transform: translateY(10px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
@keyframes toast-out {
  from { transform: translateY(0); opacity: 1; }
  to   { transform: translateY(10px); opacity: 0; }
}
.toast.out { animation: toast-out 0.2s ease forwards; }

/* ── Skeletons ──────────────────────────────────────────────── */
@keyframes shimmer {
  from { background-position: -300px 0; }
  to   { background-position: 300px 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 0%, var(--bg-card-h) 50%, var(--bg-card) 100%);
  background-size: 600px 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: var(--r-sm);
}
.skeleton-hero {
  height: 130px;
  border-radius: var(--r-lg);
}
.skeleton-hero.skeleton { background: linear-gradient(90deg, var(--bg-card) 0%, var(--bg-card-h) 50%, var(--bg-card) 100%); background-size: 600px 100%; animation: shimmer 1.4s infinite linear; }
.skeleton-row {
  height: 56px;
  margin-bottom: 2px;
  border-radius: var(--r-sm);
}
.skeleton-row.skeleton { background: linear-gradient(90deg, var(--bg-card) 0%, var(--bg-card-h) 50%, var(--bg-card) 100%); background-size: 600px 100%; animation: shimmer 1.4s infinite linear; }

/* ── Bottom Nav ─────────────────────────────────────────────── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bnav-h);
  background: rgba(17, 21, 32, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-dim);
  z-index: 90;
  padding: 0 8px;
}
.bnav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex: 1;
  height: 100%;
  font-size: 10px;
  color: var(--text-3);
  transition: color 0.12s;
  position: relative;
}
.bnav-btn.active { color: var(--accent); }
.bnav-btn span:first-of-type { /* svg handled above */ }

.bnav-badge {
  position: absolute;
  top: 8px;
  right: calc(50% - 16px);
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--red);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Search loading ──────────────────────────────────────────── */
.search-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px;
  color: var(--text-3);
  font-size: 13px;
}
.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  flex-shrink: 0;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .menu-toggle { display: flex; }
  .header-center { max-width: none; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 90;
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100vh;
    border-right: 1px solid var(--border);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .sidebar-scroll { padding-top: calc(var(--header-h) + var(--status-h) + 8px); }

  .main { padding: 16px 16px 80px; }

  .bottom-nav {
    display: flex;
  }

  .hero-grid {
    grid-template-columns: 1fr;
  }
  .hero-card:first-child {
    grid-column: 1;
  }

  .app-layout {
    flex-direction: column;
  }

  .toast-stack {
    bottom: calc(var(--bnav-h) + 12px);
  }

  .drawer {
    width: 100vw;
  }
}

@media (min-width: 769px) {
  .bottom-nav { display: none; }
  .toast-stack { bottom: 20px; }
}

@media (max-width: 480px) {
  .header-inner { padding: 0 12px; gap: 8px; }
  .search-input { font-size: 14px; }
  .page-title { font-size: 19px; }
}

/* ── Utility ─────────────────────────────────────────────────── */
.hidden { display: none !important; }
.text-dim { color: var(--text-2); }
.text-muted { color: var(--text-3); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
