/* =========================================================
   LexLegis News App — Styles
   ========================================================= */

/* ── Splash Screen ─────────────────────────────────────── */
#news-splash {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: var(--color-background, #fff);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

#news-splash.splash-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.splash-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  animation: splashPop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.splash-icon {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, var(--color-primary, #6366f1), var(--color-secondary, #8b5cf6));
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  box-shadow: 0 8px 32px rgba(48, 49, 59, 0.35);
}

.splash-wordmark {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--color-primary, #000000), var(--color-secondary, #000000));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.splash-tagline {
  font-size: 13px;
  color: var(--color-text-muted, #444546);
  font-weight: 400;
  letter-spacing: 0.3px;
  animation: splashFade 0.7s 0.3s ease both;
}

.splash-dots {
  display: flex;
  gap: 6px;
  animation: splashFade 0.5s 0.5s ease both;
}

.splash-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--lex-primary, #4b5565);
  animation: splashDot 1.2s ease-in-out infinite;
  opacity: 0.3;
}
.splash-dots span:nth-child(2) { animation-delay: 0.2s; }
.splash-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes splashPop {
  from { opacity: 0; transform: scale(0.7); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes splashFade {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes splashDot {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50%       { opacity: 1;   transform: scale(1.4); }
}

/* ── News Panel (left side nav) ────────────────────────── */
.news-panel .page-content {
  padding: 0 0 env(safe-area-inset-bottom) 0;
}

.news-panel-header {
  padding: 1px 20px 16px;
  background: linear-gradient(160deg, var(--color-primary, #000000) 0%, var(--color-secondary, #000000) 100%);
  color: #fff;
}

.news-panel-header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.news-panel-header-icon {
  width: 34px;
  height: 34px;
  background: rgba(255,255,255,0.2);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.news-panel-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: #fff;
}

.news-panel-header p {
  margin: 4px 0 0;
  font-size: 12px;
  opacity: 0.75;
  color: #fff;
}

/* LexLegis logo (swaps between light/dark variants) */
.lexlegis-logo {
  display: inline-flex;
  align-items: center;
  height: 40px;
  overflow: visible;
}
.lexlegis-logo-img {
  height: 100%;
  width: auto;
  flex-shrink: 0;
  display: block;
}
.lexlegis-logo .lexlegis-logo-dark { display: none; }
.dark-mode .lexlegis-logo .lexlegis-logo-light,
:root.dark .lexlegis-logo .lexlegis-logo-light { display: none; }
.dark-mode .lexlegis-logo .lexlegis-logo-dark,
:root.dark .lexlegis-logo .lexlegis-logo-dark { display: block; }

/* On the colored panel header, force the dark (light-on-dark) variant */
.news-panel-header .lexlegis-logo .lexlegis-logo-light { display: none; }
.news-panel-header .lexlegis-logo .lexlegis-logo-dark  { display: block; }

/* Splash uses a larger logo */
#news-splash .lexlegis-logo { height: 56px; }

.news-nav-section {
  padding: 8px 0;
  border-bottom: 1px solid var(--f7-list-item-border-color, rgba(0,0,0,0.06));
}

.news-nav-section:last-child { border-bottom: none; }

.news-nav-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--color-text-muted, #94a3b8);
  padding: 10px 20px 4px;
}

.news-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  text-decoration: none;
  color: var(--color-text-primary, #1e293b);
  border-radius: 0;
  transition: background 0.15s;
  position: relative;
}

.news-nav-item:active,
.news-nav-item.active {
  background: rgba(99, 102, 241, 0.08);
  color: var(--color-primary, #6366f1);
}

.news-nav-item .nav-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  background: var(--color-surface, #f8fafc);
  flex-shrink: 0;
}

/* Lucide icons used directly inside nav items behave like .nav-icon */
.news-nav-item > [data-lucide],
.news-nav-item > svg.lucide {
  width: 20px;
  height: 20px;
  stroke-width: 2;
  flex-shrink: 0;
  color: var(--color-text-secondary, #475569);
  margin-right: 4px;
}

.news-nav-item.nav-indent > [data-lucide],
.news-nav-item.nav-indent > svg.lucide {
  width: 18px;
  height: 18px;
}

/* Generic Lucide sizing fallback */
[data-lucide],
svg.lucide {
  width: 1em;
  height: 1em;
  stroke-width: 2;
  flex-shrink: 0;
}

.news-nav-item .nav-label {
  flex: 1;
  font-size: 15px;
  font-weight: 500;
}

.news-nav-item .nav-sub {
  font-size: 11px;
  color: var(--color-text-muted, #64748b);
  margin-top: 1px;
  display: block;
  opacity: 0.85;
}
html.dark .news-nav-item .nav-sub,
.dark .news-nav-item .nav-sub,
.dark-mode .news-nav-item .nav-sub {
  color: var(--color-text-muted, #9ca3af);
  opacity: 0.9;
}

.news-nav-item .nav-lock {
  font-size: 12px;
  background: var(--color-surface, #f1f5f9);
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: 20px;
  padding: 2px 8px;
  color: var(--color-text-muted, #94a3b8);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.3px;
}

/* Reusable button loader for non-auth pages */
.news-feed-page .button.is-loading,
.news-feed-page .list-button.is-loading,
.news-feed-page .news-source-goto-btn.is-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.9;
}

.news-feed-page .button.is-loading::after,
.news-feed-page .list-button.is-loading::after,
.news-feed-page .news-source-goto-btn.is-loading::after {
  content: '';
  position: absolute;
  right: 10px;
  top: 50%;
  width: 13px;
  height: 13px;
  margin-top: -6px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  animation: news-btn-spin 0.7s linear infinite;
}

@keyframes news-btn-spin {
  to { transform: rotate(360deg); }
}

.news-nav-item.nav-indent {
  padding-left: 36px;
}

.news-nav-item.nav-indent .nav-icon {
  width: 26px;
  height: 26px;
  font-size: 14px;
}

:root {
  --navbar-height: 56px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --navbar-total: calc(var(--navbar-height) + var(--safe-top));
  --lex-primary: #4b5565;
  --lex-select-light: #fafafa;
  --lex-select-dark: #222630;
  --lex-select-text-light: #0b0b0d;
  --lex-select-text-dark: #ffffff;
}

/* ── News Feed ─────────────────────────────────────────── */
.news-feed-page .navbar {
  --f7-navbar-bg-color: transparent;
  --f7-navbar-border-color: transparent;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--navbar-height);
  padding-top: var(--safe-top);
  z-index: 1000;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.news-feed-page .navbar-bg {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(0, 0, 0, 0.94);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.news-feed-page .navbar .link,
.news-feed-page .navbar .icon,
.news-feed-page .navbar .f7-icons {
  color: #fff;
}

.bookmarks-page .navbar .title {
  color: #fff;
}

.bookmarks-page .page-content {
  scroll-snap-type: none;
}

.bookmarks-page .news-articles-container {
  height: auto;
  min-height: 100%;
}

.bm-list {
  display: flex;
  flex-direction: column;
  padding: 10px 10px calc(12px + var(--safe-bottom));
  gap: 10px;
}

.bm-row {
  display: grid;
  grid-template-columns: 84px 1fr auto;
  gap: 12px;
  align-items: center;
  background: var(--color-background, #fff);
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: 16px;
  padding: 9px;
  box-shadow: 0 6px 14px rgba(2, 6, 23, 0.05);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.bm-row:active {
  transform: scale(0.992);
  box-shadow: 0 4px 10px rgba(2, 6, 23, 0.08);
}

.bm-row-thumb {
  width: 84px;
  height: 84px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--color-surface, #f1f5f9);
}

.bm-row-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.bm-row-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bm-row-open {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 0;
  margin: 0;
  text-align: left;
}

.bm-row-title {
  color: var(--color-text-primary, #1e293b);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  text-decoration: none;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.bm-row-open .icon,
.bm-row-open .icon.f7-icons {
  color: var(--color-text-muted, #94a3b8);
  font-size: 15px;
  margin-top: 1px;
}

.bm-row-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--color-text-muted, #64748b);
  font-size: 11px;
}

.bm-row-saved {
  font-weight: 700;
}

.bm-row-source {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bm-row-source-text {
  font-size: 11px;
  color: var(--color-text-secondary, #64748b);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bm-row-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bm-mini-btn {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid var(--color-border, #dbe2ea);
  background: var(--color-surface, #f8fafc);
  color: var(--color-text-primary, #1e293b);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.bm-mini-btn .icon,
.bm-mini-btn .icon.f7-icons {
  font-size: 16px;
}

.bm-mini-danger {
  color: #4B5565;
}

.bm-mini-btn:active {
  transform: scale(0.96);
}

html.dark .bm-row,
.dark .bm-row,
.dark-mode .bm-row {
  background: #0f172a;
  border-color: #334155;
  box-shadow: 0 8px 18px rgba(2, 6, 23, 0.35);
}

html.dark .bm-row-title,
.dark .bm-row-title,
.dark-mode .bm-row-title {
  color: #f8fafc;
}

html.dark .bm-row-open .icon,
.dark .bm-row-open .icon,
.dark-mode .bm-row-open .icon,
html.dark .bm-row-open .icon.f7-icons,
.dark .bm-row-open .icon.f7-icons,
.dark-mode .bm-row-open .icon.f7-icons {
  color: #94a3b8;
}

html.dark .bm-mini-btn,
.dark .bm-mini-btn,
.dark-mode .bm-mini-btn {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
}

/* inner flex: no overflow clipping so pills can scroll */
.news-feed-page .navbar-inner {
  overflow: visible;
  gap: 0;
}

/* ── In-Navbar Category Scroller ───────────────────────── */
.news-nav-cats {
  flex: 1;
  min-width: 0;
  padding: 0 4px;
  display: flex;
  align-items: center;
}

.news-nav-cats-swiper {
  width: 100%;
  overflow: hidden;
}

.news-nav-cats-swiper .swiper-wrapper {
  align-items: center;
}

.news-nav-cats-swiper .swiper-slide {
  width: auto;
  flex-shrink: 0;
}

.news-nav-cat-icon {
  font-size: 13px;
  line-height: 1;
}

.news-nav-cat-pill {
  --f7-button-bg-color: rgba(225, 225, 225, 0.08);
  --f7-button-text-color: #ffffff;
  --f7-button-border-radius: 20px;
  --f7-button-height: 30px;
  --f7-button-font-size: 12px;
  --f7-button-font-weight: 600;
  --f7-button-padding-horizontal: 11px;
  border: none;
  box-shadow: none;
  min-width: 0;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
  letter-spacing: 0.1px;
}

.news-nav-cat-pill.active {
  --f7-button-bg-color: #000000;
  --f7-button-text-color: #fff;
  background: #000000;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(55, 48, 163, 0.38);
  border: #ffffff 2px solid;
}

/* ── Inline Search Overlay ─────────────────────────────── */
.news-search-overlay {
  position: absolute;
  /* covers everything right of the hamburger */
  left: calc(var(--f7-navbar-link-height, 44px) + 4px);
  right: 0;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px 0 4px;
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  /* slide in from the right */
  transform: translateX(calc(100% + 8px));
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 30;
  border-radius: 0;
  pointer-events: none;
}

.news-feed-page.news-search-open .news-search-overlay {
  transform: translateX(0);
  pointer-events: auto;
}

.news-search-overlay input {
  flex: 1;
  height: 34px;
  border: none;
  border-radius: 10px;
  background: rgba(30, 27, 75, 0.07);
  padding: 0 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--color-text-primary, #1e293b);
  outline: none;
  min-width: 0;
}

.news-search-overlay input::placeholder {
  color: var(--color-text-muted, #94a3b8);
}

.news-search-cancel {
  flex-shrink: 0;
  background: none;
  border: none;
  font-size: 13px;
  font-weight: 600;
  color: #3730a3;
  padding: 4px 4px 4px 2px;
  cursor: pointer;
  white-space: nowrap;
}

/* Dropdown results list below navbar */
.news-search-results-dropdown {
  position: absolute;
  top: var(--f7-navbar-height, 44px);
  left: 0;
  right: 0;
  background: rgba(255,255,255,0.98);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border, #e2e8f0);
  max-height: 60svh;
  overflow-y: auto;
  z-index: 200;
  display: none;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

.news-feed-page.news-search-open .news-search-results-dropdown {
  display: block;
}

.news-search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border, #f1f5f9);
  cursor: pointer;
  transition: background 0.12s;
}

.news-search-result-item:active { background: var(--color-surface, #f8fafc); }

.news-search-result-item:last-child { border-bottom: none; }

.news-search-result-img {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--color-surface, #f1f5f9);
}

.news-search-result-body { flex: 1; min-width: 0; }

.news-search-result-cat {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #000000;
  margin-bottom: 2px;
}

.news-search-result-headline {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-primary, #1e293b);
  line-height: 1.3;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Article Cards — full-screen snap ─────────────────── */
.news-feed-page {
  --f7-page-navbar-offset: var(--navbar-total);
  --f7-page-toolbar-bottom-offset: 0px;
  height: 100dvh;
  overflow: hidden;
}

.news-feed-page .page-content {
  height: 100%;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  padding-top: var(--navbar-total) !important;
  padding-bottom: var(--safe-bottom) !important;
  box-sizing: border-box;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  overscroll-behavior-x: none;
  scroll-padding-top: var(--navbar-total);
  touch-action: pan-y;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
}

.news-articles-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.news-article-card {
  --news-image-height: clamp(190px, 48%, 52svh);
  --news-image-pos-x: 50%;
  --news-image-pos-y: 35%;
  /* Exactly one card per page-content viewport */
  height: calc(100dvh - var(--navbar-total));
  min-height: calc(100svh - var(--navbar-total));
  box-sizing: border-box;
  flex-shrink: 0;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  flex-direction: column;
  background: var(--color-background, #fff);
  border-bottom: 4px solid var(--color-surface, #f1f5f9);
  position: relative;
  overflow: hidden;
}

.news-article-card.news-card-focused {
  border-bottom-color: #0ea5e9;
  box-shadow: inset 0 0 0 2px rgba(14, 165, 233, 0.25);
  animation: newsCardFocusPulse 0.9s ease-out 1;
}

@keyframes newsCardFocusPulse {
  0% {
    box-shadow: inset 0 0 0 0 rgba(14, 165, 233, 0);
  }
  35% {
    box-shadow: inset 0 0 0 3px rgba(14, 165, 233, 0.28);
  }
  100% {
    box-shadow: inset 0 0 0 2px rgba(14, 165, 233, 0.25);
  }
}

.news-card-image {
  position: relative;
  width: 100%;
  height: var(--news-image-height);
  min-height: 180px;
  max-height: 52svh;
  background: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.news-card-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: var(--news-image-pos-x) var(--news-image-pos-y);
  display: block;
}

.news-article-card.media-landscape {
  --news-image-pos-y: 42%;
}

.news-article-card.media-ultra-landscape {
  --news-image-pos-y: 45%;
}

.news-article-card.media-portrait {
  --news-image-pos-y: 28%;
}

.news-article-card.media-ultra-portrait {
  --news-image-pos-y: 22%;
}

.news-card-image-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.03) 0%,
    rgba(0, 0, 0, 0.18) 58%,
    rgba(0, 0, 0, 0.5) 100%
  );
  mix-blend-mode: multiply;
}

.news-card-category-pills {
  position: absolute;
  bottom: 12px;
  left: 12px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.news-card-cat-badge {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-primary, #000000);
  letter-spacing: 0.2px;
}

.news-card-body {
  flex: 1;
  padding: 30px 16px 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.news-card-headline-link {
  display: block;
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.news-card-headline-link:active .news-card-headline {
  opacity: 0.7;
}

.news-card-headline {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--color-text-primary, #1e293b);
  margin: 0 0 10px;
  letter-spacing: -0.2px;
  /* clear space for the floating action buttons that hang into the body */
  padding-right: 108px;
}

.news-card-summary {
  font-size: 14px;
  line-height: 1.65;
  color: var(--color-text-secondary, #64748b);
  margin: 0 0 12px;
}

.news-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0 14px;
  margin-top: auto;
  font-size: 11px;
  color: var(--color-text-muted, #94a3b8);
}

.news-card-meta .news-card-cat-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(0, 0, 0, 0.2);
  color: #000000;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.25px;
  line-height: 1.15;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.news-card-meta-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--color-text-muted, #94a3b8);
}

/* ── Source Bar ────────────────────────────────────────── */
.news-source-bar {
  margin-top: auto;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--color-surface, #000000);
  border-top: 1px solid var(--color-border, #f9f9f9);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

.news-source-bar:active {
  background: var(--color-surface-hover, #ffffff);
}

.news-source-more {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted, #94a3b8);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
  margin-left: 4px;
  padding: 0;
}
.news-source-more:active { background: rgba(255,255,255,0.08); }
.news-source-more .icon.f7-icons { font-size: 18px; }

.news-source-avatars {
  display: flex;
  margin-right: 2px;
}

.news-source-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-primary, #000000);
  border: 2px solid #ffffff;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: -6px;
  overflow: hidden;
}

.news-source-avatar:first-child { margin-left: 0; }

.news-source-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}

.news-source-text {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-white, #ffffff);
}

.news-source-chevron {
  font-size: 13px;
  color: var(--color-text-muted, #94a3b8);
}

/* ── Source Sheet ──────────────────────────────────────── */
.news-source-sheet .sheet-modal-inner {
  border-radius: 20px 20px 0 0;
  background: var(--color-background, #ffffff);
  overflow: hidden;
}

.news-source-sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--color-border, #e2e8f0);
  margin: 12px auto 0;
}

.news-source-sheet-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text-primary, #3b1e21);
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--color-border, #e2e8f0);
}

.news-source-item {
  background: transparent;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border, #e2e8f0);
}

.news-source-item:last-child { border-bottom: none; }

.news-source-item-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.news-source-item-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--color-primary, #000000);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  overflow: hidden;
  flex-shrink: 0;
}

.news-source-item-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}

.news-source-item-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text-primary, #1e293b);
}

.news-source-item-summary {
  font-size: 13px;
  line-height: 1.6;
  color: var(--color-text-secondary, #64748b);
  margin-bottom: 12px;
}

html.dark .news-source-sheet .sheet-modal-inner,
.dark .news-source-sheet .sheet-modal-inner,
.dark-mode .news-source-sheet .sheet-modal-inner {
  background: #0f172a;
}

html.dark .news-source-sheet-handle,
.dark .news-source-sheet-handle,
.dark-mode .news-source-sheet-handle {
  background: #334155;
}

html.dark .news-source-sheet-title,
.dark .news-source-sheet-title,
.dark-mode .news-source-sheet-title {
  color: #f8fafc;
  border-bottom-color: #334155;
}

html.dark .news-source-item,
.dark .news-source-item,
.dark-mode .news-source-item {
  border-bottom-color: #334155;
}

html.dark .news-source-item-name,
.dark .news-source-item-name,
.dark-mode .news-source-item-name {
  color: #f8fafc;
}

html.dark .news-source-item-summary,
.dark .news-source-item-summary,
.dark-mode .news-source-item-summary {
  color: #cbd5e1;
}

html.dark .news-source-item-logo,
.dark .news-source-item-logo,
.dark-mode .news-source-item-logo {
  background: var(--lex-primary);
}

.news-source-goto-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-primary, #000000);
  background: rgba(99, 102, 241, 0.08);
  border-radius: 20px;
  padding: 6px 14px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}

.news-source-goto-btn:active {
  background: rgba(99, 102, 241, 0.16);
}

/* ── Feature Gate Page ─────────────────────────────────── */
.feature-gate-page .page-content {
  display: flex;
  flex-direction: column;
}

.feature-gate-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 28px 24px;
  text-align: center;
}

.feature-gate-icon {
  width: 80px;
  height: 80px;
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  margin-bottom: 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}

.feature-gate-name {
  font-size: 26px;
  font-weight: 800;
  color: var(--color-text-primary, #1e293b);
  letter-spacing: -0.5px;
  margin: 0 0 6px;
}

.feature-gate-tagline {
  font-size: 15px;
  color: var(--color-text-secondary, #64748b);
  margin: 0 0 24px;
  line-height: 1.5;
}

.feature-gate-description {
  font-size: 14px;
  line-height: 1.7;
  color: var(--color-text-secondary, #64748b);
  max-width: 320px;
  margin: 0 0 24px;
}

.feature-gate-bullets {
  list-style: none;
  padding: 0;
  margin: 0 0 32px;
  text-align: left;
  width: 100%;
  max-width: 320px;
}

.feature-gate-bullets li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  font-size: 14px;
  color: var(--color-text-secondary, #64748b);
  border-bottom: 1px solid var(--color-border, #f1f5f9);
}

.feature-gate-bullets li:last-child { border-bottom: none; }

.feature-gate-bullets li::before {
  content: '✓';
  color: var(--color-primary, #6366f1);
  font-weight: 800;
  font-size: 13px;
  margin-top: 1px;
  flex-shrink: 0;
}

.feature-gate-actions {
  padding: 20px 24px calc(20px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Search Page ───────────────────────────────────────── */
.news-search-page .page-content {
  padding-top: 0;
}

.news-search-results {
  padding: 8px 16px;
}

.news-search-card {
  background: var(--color-surface, #f8fafc);
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 12px;
  display: flex;
  align-items: stretch;
  min-height: 90px;
  cursor: pointer;
  border: 1px solid var(--color-border, #e2e8f0);
  transition: transform 0.15s;
}

.news-search-card:active { transform: scale(0.98); }

.news-search-card-img {
  width: 90px;
  flex-shrink: 0;
  background: var(--color-border, #e2e8f0);
  overflow: hidden;
}

.news-search-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.news-search-card-body {
  padding: 12px 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.news-search-card-cat {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--color-primary, #6366f1);
  margin-bottom: 4px;
}

.news-search-card-headline {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-primary, #1e293b);
  line-height: 1.35;
  margin: 0 0 6px;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-search-card-meta {
  font-size: 11px;
  color: var(--color-text-muted, #94a3b8);
}

/* ── Customise Page ────────────────────────────────────── */
.news-customise-page .item-input {
  --f7-list-item-min-height: 48px;
}

.cat-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-start;
}

.cat-pill {
  display: inline-flex !important;
  width: auto !important;
  flex: 0 0 auto !important;

  padding: 8px 14px;
  border-radius: 999px;

  background: #f1f5f9;
  color: #334155;

  font-size: 13px;
  cursor: pointer;
}

.cat-pill.active {
  background: #364152;
  color: #fff;
}

/* ── Profile Page ──────────────────────────────────────── */
.news-profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary, #6366f1), var(--color-secondary, #8b5cf6));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  color: #fff;
  font-weight: 700;
  margin: 0 auto;
}

.news-profile-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 20px 20px;
  gap: 8px;
}

.news-profile-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text-primary, #1e293b);
  margin: 0;
}

.news-profile-email {
  font-size: 13px;
  color: var(--color-text-muted, #94a3b8);
  margin: 0;
}

/* ── Empty State ───────────────────────────────────────── */
.news-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
  gap: 12px;
}

.news-empty-icon { font-size: 48px; }
.news-empty-title { font-size: 17px; font-weight: 700; color: var(--color-text-primary, #1e293b); margin: 0; }
.news-empty-sub   { font-size: 14px; color: var(--color-text-muted, #94a3b8); margin: 0; }

/* ── Dark mode overrides ───────────────────────────────── */
.dark .news-feed-page .navbar-bg {
  background: rgba(15, 23, 42, 0.92);
}
.dark .news-search-overlay {
  background: rgba(15, 23, 42, 0.97);
}
.dark .news-search-results-dropdown {
  background: rgba(15, 23, 42, 0.98);
  border-bottom-color: #334155;
}
.dark .news-nav-cat-pill {
  --f7-button-bg-color: rgba(199, 210, 254, 0.1);
  --f7-button-text-color: #c7d2fe;
  background: rgba(199, 210, 254, 0.1);
  color: #ffffff;
}
.dark .news-nav-cat-pill.active {
  --f7-button-bg-color: #4338ca;
  --f7-button-text-color: #fff;
  background: #364152;
  color: #fff;
}
.dark #news-splash {
  background: var(--color-background, #0f172a);
}
.dark .news-article-card {
  background: #0f172a;
  border-bottom-color: #1e293b;
}
.dark .news-source-bar {
  background: #1e293b;
  border-top-color: #334155;
}
.dark .news-card-meta .news-card-cat-badge {
  background: rgba(0, 0, 0, 0.16);
  border-color: rgba(0, 0, 0, 0.3);
  color: #fcfcfc;
}
.dark .news-search-card {
  background: #000000;
  border-color: #000000;
}

/* ── Practice Areas page ─────────────────────────────── */
.news-practice-page .news-practice-content {
  padding-bottom: calc(80px + env(safe-area-inset-bottom));
}

.news-practice-intro p {
  margin: 0;
  font-size: 14px;
  color: var(--color-text-secondary, #475569);
  line-height: 1.45;
}
.news-practice-intro .news-practice-count {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--f7-theme-color, #364152);
  letter-spacing: 0.2px;
}

.practice-area-list .item-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}
.practice-area-list .item-subtitle {
  font-size: 12px;
  color: var(--color-text-tertiary, #64748b);
  margin-top: 2px;
}
.practice-area-list .practice-area-icon,
.practice-area-list svg.lucide {
  width: 18px;
  height: 18px;
  stroke-width: 2;
  color: var(--color-text-secondary, #475569);
  flex-shrink: 0;
}

.news-practice-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--f7-page-bg-color, #fff) 60%, rgba(255,255,255,0));
  z-index: 5500;
}
.news-practice-footer .news-practice-continue {
  background: var(--f7-theme-color, #364152);
  color: #fff;
  border-radius: 10px;
  font-weight: 600;
}
.news-practice-footer .news-practice-continue:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ── MIRA chat (ChatGPT-style) ───────────────────────── */
.mira-page {
  /* Light defaults */
  --mira-bg: #ffffff;
  --mira-bg-elev: #f4f4f5;
  --mira-bubble-user: #ececf1;
  --mira-bubble-user-text: #0f172a;
  --mira-text: #0f172a;
  --mira-text-dim: #6b7280;
  --mira-border: #e4e4e7;
  --mira-accent: #0f172a;
  --mira-accent-text: #ffffff;
  --mira-send-disabled-bg: #e4e4e7;
  --mira-send-disabled-fg: #a1a1aa;
  --mira-press-bg: rgba(0, 0, 0, 0.05);
  background: var(--mira-bg);
  color: var(--mira-text);
}
.dark .mira-page,
.dark-mode .mira-page {
  --mira-bg: #0b0b0d;
  --mira-bg-elev: #1a1a1d;
  --mira-bubble-user: #2f2f33;
  --mira-bubble-user-text: #ececf1;
  --mira-text: #ececf1;
  --mira-text-dim: #9b9ba4;
  --mira-border: #2a2a30;
  --mira-accent: #ffffff;
  --mira-accent-text: #1a1a1d;
  --mira-send-disabled-bg: #3a3a40;
  --mira-send-disabled-fg: #6a6a72;
  --mira-press-bg: rgba(255, 255, 255, 0.06);
}
.mira-page .page-content { background: var(--mira-bg); }

/* Navbar */
.mira-navbar .navbar-bg { background: var(--mira-bg) !important; }
.mira-navbar .navbar-bg::after { background: var(--mira-border) !important; }
.mira-navbar .navbar-inner { color: var(--mira-text); }
.mira-navbar a.link { color: var(--mira-text) !important; }
.mira-navbar [data-lucide], .mira-navbar svg.lucide {
  width: 22px; height: 22px; stroke-width: 2; color: var(--mira-text);
}
.mira-navbar .title {
  display: flex; flex-direction: column; align-items: center;
  line-height: 1.1;
}
.mira-title-name { font-weight: 700; font-size: 16px; letter-spacing: 0.2px; }
.mira-title-sub { font-size: 11px; color: var(--mira-text-dim); margin-top: 1px; }

/* Content layout */
.mira-content { padding: 16px 0 140px; }

/* Empty state */
.mira-empty {
  min-height: calc(100vh - 240px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px 20px; text-align: center;
}
.mira-empty h1 { margin: 14px 0 22px; font-size: 22px; font-weight: 600; color: var(--mira-text); }
.mira-empty-orb {
  width: 56px; height: 56px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--mira-bg-elev), var(--mira-text-dim));
  box-shadow: 0 8px 32px rgba(0,0,0,0.08);
}
.mira-suggestions {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  width: 100%; max-width: 520px;
}
.mira-suggestion {
  display: flex; align-items: center; gap: 10px;
  background: var(--mira-bg-elev); color: var(--mira-text);
  border: 1px solid var(--mira-border); border-radius: 14px;
  padding: 12px 12px; font-size: 13px; font-weight: 500;
  text-align: left; cursor: pointer; line-height: 1.3;
  transition: background 0.15s, transform 0.05s;
}
.mira-suggestion:active { transform: scale(0.98); background: var(--mira-press-bg); }
.mira-suggestion [data-lucide], .mira-suggestion svg.lucide {
  width: 18px; height: 18px; stroke-width: 2;
  color: var(--mira-text-dim); flex-shrink: 0;
}
@media (max-width: 380px) { .mira-suggestions { grid-template-columns: 1fr; } }

/* Messages */
.mira-messages {
  padding: 4px 14px 8px;
  display: flex; flex-direction: column; gap: 14px;
}
.mira-msg { display: flex; align-items: flex-start; gap: 10px; max-width: 100%; }
.mira-msg-user { justify-content: flex-end; }
.mira-msg-user .mira-bubble {
  background: var(--mira-bubble-user); color: var(--mira-bubble-user-text);
  border-radius: 18px 18px 4px 18px; padding: 10px 14px;
  font-size: 14.5px; line-height: 1.45; max-width: 80%;
  word-wrap: break-word;
}
.mira-msg-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--mira-accent);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.mira-msg-avatar [data-lucide], .mira-msg-avatar svg.lucide {
  width: 16px; height: 16px; stroke-width: 2.2; color: var(--mira-accent-text);
}
.mira-msg-body {
  flex: 1; color: var(--mira-text); font-size: 14.5px; line-height: 1.55;
  white-space: pre-wrap; word-wrap: break-word; padding-top: 3px;
}

/* Typing dots */
.mira-msg-typing .mira-msg-body { display: flex; gap: 4px; padding-top: 12px; }
.mira-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--mira-text-dim);
  animation: miraDot 1.2s infinite ease-in-out;
}
.mira-dot:nth-child(2) { animation-delay: 0.15s; }
.mira-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes miraDot {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

/* Composer */
.mira-composer {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: var(--mira-bg);
  border-top: 1px solid var(--mira-border);
  padding: 10px 12px calc(8px + env(safe-area-inset-bottom));
  z-index: 1500;
}
.mira-composer-inner {
  display: flex; align-items: flex-end; gap: 6px;
  background: var(--mira-bg-elev); border: 1px solid var(--mira-border);
  border-radius: 24px; padding: 6px 6px 6px 8px;
}
.mira-input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--mira-text); font-family: inherit; font-size: 15px;
  line-height: 1.4; padding: 9px 6px; resize: none; max-height: 160px;
}
.mira-input::placeholder { color: var(--mira-text-dim); }
.mira-composer-btn {
  width: 34px; height: 34px; border-radius: 50%; border: none;
  background: transparent; color: var(--mira-text-dim);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; transition: background 0.15s, color 0.15s;
}
.mira-composer-btn:active { background: var(--mira-press-bg); }
.mira-composer-btn [data-lucide], .mira-composer-btn svg.lucide {
  width: 20px; height: 20px; stroke-width: 2.2;
}
.mira-send-btn { background: var(--mira-accent); color: var(--mira-accent-text); }
.mira-send-btn:disabled { background: var(--mira-send-disabled-bg); color: var(--mira-send-disabled-fg); cursor: not-allowed; }
.mira-send-btn:not(:disabled):active { opacity: 0.85; }
.mira-disclaimer {
  text-align: center; font-size: 11px; color: var(--mira-text-dim);
  margin: 6px 0 0;
}

/* ── MIRA chat history popup ─────────────────────────── */
.mira-history-popup {
  --mira-bg: #ffffff;
  --mira-bg-elev: #f4f4f5;
  --mira-text: #0f172a;
  --mira-text-dim: #6b7280;
  --mira-border: #e4e4e7;
  background: var(--mira-bg);
}
.dark .mira-history-popup,
.dark-mode .mira-history-popup {
  --mira-bg: #0b0b0d;
  --mira-bg-elev: #1a1a1d;
  --mira-text: #ececf1;
  --mira-text-dim: #9b9ba4;
  --mira-border: #2a2a30;
}
.mira-history-popup .view,
.mira-history-popup .mira-history-page,
.mira-history-popup .mira-history-content {
  background: var(--mira-bg);
  color: var(--mira-text);
}
.mira-history-popup .navbar-bg { background: var(--mira-bg) !important; }
.mira-history-popup .navbar .title,
.mira-history-popup .navbar a.link { color: var(--mira-text) !important; }

.mira-history-search {
  position: relative;
  margin: 12px 14px 6px;
}
.mira-history-search [data-lucide],
.mira-history-search svg.lucide {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--mira-text-dim, #9b9ba4);
}
.mira-history-search input {
  width: 100%; box-sizing: border-box;
  background: var(--mira-bg-elev, #1a1a1d);
  border: 1px solid var(--mira-border, #2a2a30);
  border-radius: 12px;
  color: var(--mira-text, #ececf1);
  padding: 10px 12px 10px 36px; font-size: 14px; outline: none;
}
.mira-history-search input::placeholder { color: var(--mira-text-dim, #9b9ba4); }

.mira-history-list { padding: 4px 8px 24px; }
.mira-history-group {
  font-size: 11px; font-weight: 600; letter-spacing: 0.4px;
  color: var(--mira-text-dim, #9b9ba4);
  text-transform: uppercase;
  padding: 14px 10px 6px;
}
.mira-history-item {
  display: flex; align-items: flex-start; gap: 10px;
  width: 100%; text-align: left;
  background: transparent; border: none;
  color: var(--mira-text, #ececf1);
  padding: 10px 10px; border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s;
}
.mira-history-item:active,
.mira-history-item.is-active { background: var(--mira-bg-elev, #1a1a1d); }
.mira-history-item-main { flex: 1; min-width: 0; }
.mira-history-item-title {
  font-size: 14px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mira-history-item-preview {
  font-size: 12.5px; color: var(--mira-text-dim, #9b9ba4);
  margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mira-history-item-meta {
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0; padding-top: 2px;
}
.mira-history-item-time {
  font-size: 11px; color: var(--mira-text-dim, #9b9ba4);
}
.mira-history-item-delete {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  color: var(--mira-text-dim, #9b9ba4);
}
.mira-history-item-delete:active { background: var(--mira-bg-elev); color: #ef4444; }
.mira-history-item-delete [data-lucide],
.mira-history-item-delete svg.lucide { width: 16px; height: 16px; }

.mira-history-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 24px; text-align: center;
  color: var(--mira-text-dim, #9b9ba4);
}
.mira-history-empty [data-lucide],
.mira-history-empty svg.lucide {
  width: 36px; height: 36px; margin-bottom: 12px;
  color: var(--mira-text-dim, #9b9ba4);
}
.mira-history-empty p { margin: 0; font-size: 15px; color: var(--mira-text, #ececf1); font-weight: 500; }
.mira-history-empty span { font-size: 13px; margin-top: 4px; }

/* ── Appearance toggle (Auto / Light / Dark) ─────────── */
.appearance-toggle {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  margin: 4px 16px 0;
  background: var(--color-bg-secondary, #f4f4f5);
  border: 1px solid var(--color-border-secondary, #e4e4e7);
  border-radius: 12px;
  padding: 4px;
}
.appearance-btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  background: transparent; border: none; cursor: pointer;
  padding: 8px 4px;
  border-radius: 8px;
  font-size: 12px; font-weight: 500;
  color: var(--color-text-secondary, #475569);
  transition: background 0.15s, color 0.15s;
}
.appearance-btn [data-lucide],
.appearance-btn svg.lucide { width: 14px; height: 14px; }
.appearance-btn:active { background: rgba(0,0,0,0.05); }
.appearance-btn.is-active {
  background: var(--color-bg-primary, #fff);
  color: var(--color-text-primary, #0f172a);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.dark .appearance-btn:active,
.dark-mode .appearance-btn:active { background: rgba(255,255,255,0.06); }

/* ── News card actions (bookmark / share / feedback) ─── */
/* Inshorts-style: anchor to the card and straddle the image/body boundary
   so they sit half over the image and half over the headline area. */
.news-card-actions {
  position: absolute;
  top: calc(var(--news-image-height) - 20px);
  right: 14px;
  transform: none;
  display: flex;
  flex-direction: row;
  gap: 10px;
  z-index: 4;
  pointer-events: auto;
}
.news-card-action-btn {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(15, 23, 42, 0.55);
  color: #fff;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  backdrop-filter: blur(10px) saturate(140%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.news-card-action-btn:active {
  transform: scale(0.92);
  background: rgba(15, 23, 42, 0.75);
}
.news-card-action-btn .icon,
.news-card-action-btn .icon.f7-icons { font-size: 20px; line-height: 1; }

/* ── Profile avatar ─────────────────────────────────── */
.profile-avatar {
  width: 88px;
  height: 88px;
  border-radius: 999px;
  background: var(--color-text-primary, #0f172a);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin: 0 auto;
}
html.dark .profile-avatar, .dark .profile-avatar {
  background: #fff;
  color: #0b0b0d;
}

/* Empty state CTA polish */
.news-empty .button-fill {
  background: var(--color-text-primary, #0f172a);
  color: #fff;
}
html.dark .news-empty .button-fill, .dark .news-empty .button-fill {
  background: #fff;
  color: #0b0b0d;
}

/* ── Theme Unification (Light / Dark) ─────────────────── */
.news-feed-page,
.bookmarks-page,
.customise-page,
.feature-gate-page,
.news-search-page,
.news-practice-page,
.mira-page,
.auth-page {
  --f7-theme-color: var(--lex-primary);
  --f7-theme-color-rgb: 75, 85, 101;
  --f7-theme-color-shade: #3f4754;
  --f7-theme-color-tint: #5b6473;
  --lex-select-bg: var(--lex-select-light);
  --lex-select-text: var(--lex-select-text-light);
}

html.dark .news-feed-page,
html.dark .bookmarks-page,
html.dark .customise-page,
html.dark .feature-gate-page,
html.dark .news-search-page,
html.dark .news-practice-page,
html.dark .mira-page,
html.dark .auth-page,
.dark .news-feed-page,
.dark .bookmarks-page,
.dark .customise-page,
.dark .feature-gate-page,
.dark .news-search-page,
.dark .news-practice-page,
.dark .mira-page,
.dark .auth-page,
.dark-mode .news-feed-page,
.dark-mode .bookmarks-page,
.dark-mode .customise-page,
.dark-mode .feature-gate-page,
.dark-mode .news-search-page,
.dark-mode .news-practice-page,
.dark-mode .mira-page,
.dark-mode .auth-page {
  --lex-select-bg: var(--lex-select-dark);
  --lex-select-text: var(--lex-select-text-dark);
}

.news-nav-item:active,
.news-nav-item.active {
  background: var(--lex-select-bg);
  color: var(--lex-select-text);
}

.news-nav-cat-pill.active {
  --f7-button-bg-color: var(--lex-primary);
  --f7-button-text-color: #fff;
  background: var(--lex-primary);
  color: #fff;
  border: 1px solid transparent;
  box-shadow: 0 2px 8px rgba(75, 85, 101, 0.35);
}

.dark .news-nav-cat-pill,
html.dark .news-nav-cat-pill,
.dark-mode .news-nav-cat-pill {
  --f7-button-bg-color: var(--lex-select-bg);
  --f7-button-text-color: var(--lex-select-text);
  background: var(--lex-select-bg);
  color: var(--lex-select-text);
}

.dark .news-nav-cat-pill.active,
html.dark .news-nav-cat-pill.active,
.dark-mode .news-nav-cat-pill.active {
  --f7-button-bg-color: var(--lex-primary);
  --f7-button-text-color: #fff;
  background: var(--lex-primary);
  color: #fff;
}

.cat-pill {
  background: var(--lex-select-bg);
  color: var(--lex-select-text);
  border-color: rgba(75, 85, 101, 0.18);
}

.cat-pill.active {
  background: var(--lex-primary);
  color: #fff;
  box-shadow: 0 2px 6px rgba(75, 85, 101, 0.35);
}

.appearance-btn.is-active {
  background: var(--lex-select-bg);
  color: var(--lex-select-text);
  box-shadow: none;
}

.news-source-goto-btn {
  background: var(--lex-select-bg);
  color: var(--lex-select-text);
}

.news-source-goto-btn:active {
  background: var(--lex-primary);
  color: #fff;
}

/* Customise controls: keep selected/on states on lex-primary in all themes */
.customise-page {
  --f7-checkbox-active-color: var(--lex-primary);
  --f7-toggle-active-bg-color: var(--lex-primary);
}

.customise-page #rt-seg .button {
  background: var(--lex-select-bg);
  color: var(--lex-select-text);
}

.customise-page #rt-seg .button.button-active {
  background: var(--lex-primary);
  color: #fff;
}

.customise-page .toggle input:checked + .toggle-icon {
  background: var(--lex-primary);
  border-color: var(--lex-primary);
}

.customise-page .item-checkbox input:checked ~ .icon-checkbox {
  background: var(--lex-primary);
  border-color: var(--lex-primary);
}

html.dark .customise-page .item-checkbox input:checked ~ .icon-checkbox,
.dark .customise-page .item-checkbox input:checked ~ .icon-checkbox,
.dark-mode .customise-page .item-checkbox input:checked ~ .icon-checkbox {
  background: var(--lex-primary);
  border-color: var(--lex-primary);
}

.feature-gate-bullets li::before,
.news-search-card-cat {
  color: var(--lex-primary);
}

.news-empty .button-fill,
.news-practice-footer .news-practice-continue {
  background: var(--lex-primary);
  color: #fff;
}

@supports (-webkit-touch-callout: none) {
  .news-feed-page .page-content {
    scroll-snap-type: y proximity;
  }

  .news-article-card {
    scroll-snap-stop: normal;
  }
}
