/* ============================================================
   Vibe RSS Reader — Design System & Global Styles
   Dark theme + Glassmorphism + Micro-animations
   ============================================================ */

/* --- Design Tokens --- */
:root {
  /* Color Palette - Light Mode (High-end Grey) */
  --bg-primary: #f2f2f3;
  --bg-secondary: #e6e6e8;
  --bg-tertiary: #dcdcdc;
  --bg-surface: #ffffff;
  --bg-hover: #eaeaea;
  --bg-active: #d5d5d5;

  --text-primary: #2d2d30;
  --text-secondary: #5e5e62;
  --text-muted: #8e8e93;
  --text-inverse: #ffffff;

  --accent: #3b3b40;
  --accent-hover: #1e1e22;
  --accent-dim: rgba(59, 59, 64, 0.1);
  --accent-glow: rgba(59, 59, 64, 0.15);

  --success: #22c55e;
  --danger: #ef4444;
  --warning: #eab308;
  --info: #3b82f6;

  --border: rgba(0, 0, 0, 0.08);
  --border-hover: rgba(0, 0, 0, 0.15);

  /* Glass */
  --glass-bg: rgba(242, 242, 243, 0.85);
  --glass-blur: 20px;
  --glass-border: rgba(0, 0, 0, 0.05);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;




  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-base: 0.9375rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-2xl: 1.75rem;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 0.75rem;
  --space-lg: 1rem;
  --space-xl: 1.5rem;
  --space-2xl: 2rem;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 20px var(--accent-glow);

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Layout */
  --header-height: 56px;
  --sidebar-width: 260px;
  --feed-col-width: 380px;
  --mobile-tab-height: 44px;
}

[data-theme="dark"] {
  /* Color Palette - Dark Mode */
  --bg-primary: #0a0a12;
  --bg-secondary: #12121e;
  --bg-tertiary: #1a1a2e;
  --bg-surface: #16162a;
  --bg-hover: #1e1e38;
  --bg-active: #262650;

  --text-primary: #e8e8f0;
  --text-secondary: #9898b8;
  --text-muted: #6868a0;
  --text-inverse: #0a0a12;

  --accent: #f97316;
  --accent-hover: #fb923c;
  --accent-dim: rgba(249, 115, 22, 0.15);
  --accent-glow: rgba(249, 115, 22, 0.3);

  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);

  /* Glass */
  --glass-bg: rgba(22, 22, 42, 0.75);
  --glass-border: rgba(255, 255, 255, 0.08);
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--bg-primary);
  line-height: 1.6;
  min-height: 100dvh;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

ul, ol { list-style: none; }
img { max-width: 100%; height: auto; display: block; }
button { cursor: pointer; font: inherit; color: inherit; }
button:focus { outline: none; }
button:focus-visible { outline: 2px solid var(--accent-dim); outline-offset: 2px; }
input { font: inherit; color: inherit; }

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

/* --- Utility --- */
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap;
}

/* ============================================================
   HEADER
   ============================================================ */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-lg);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--glass-border);
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-weight: 700;
  font-size: var(--text-lg);
  color: var(--text-primary);
}
.logo:hover { color: var(--accent); }
.logo svg { flex-shrink: 0; }

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.user-area {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.user-name {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  border: none;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: var(--text-inverse);
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-glow);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { opacity: 0.9; }

.btn-sm { padding: var(--space-xs) var(--space-md); font-size: var(--text-xs); }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}
.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.icon-btn:focus {
  outline: none;
}
.icon-btn:focus-visible {
  outline: 2px solid var(--accent-dim);
  outline-offset: 2px;
}

/* ============================================================
   MOBILE TABS
   ============================================================ */
.mobile-tabs {
  position: fixed;
  top: var(--header-height);
  left: 0; right: 0;
  height: var(--mobile-tab-height);
  display: flex;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--glass-border);
  z-index: 90;
  overflow-x: auto;
}

.tab-btn {
  flex: 1;
  min-width: max-content;
  padding: var(--space-sm) var(--space-lg);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 500;
  position: relative;
  transition: color var(--transition-fast);
}
.tab-btn.active {
  color: var(--accent);
}
.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0; left: 20%; right: 20%;
  height: 2px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
}

/* ============================================================
   MAIN LAYOUT — Three-column (PC) / Single-column (Mobile)
   ============================================================ */
.app-main {
  position: fixed;
  top: var(--header-height);
  left: 0; right: 0; bottom: 0;
  display: grid;
  grid-template-columns: var(--sidebar-width) var(--feed-col-width) 1fr;
  overflow: hidden;
}

/* --- Sidebar --- */
.sidebar {
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  transition: transform var(--transition-base);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
  z-index: 1;
}

.sidebar-header h2 {
  font-size: var(--text-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.add-feed-form {
  padding: 0 var(--space-lg) var(--space-lg);
  animation: slideDown var(--transition-base) forwards;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.add-feed-form input {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: var(--text-sm);
  outline: none;
  transition: border-color var(--transition-fast);
}
.add-feed-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.add-feed-form input::placeholder { color: var(--text-muted); }

.add-feed-actions {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--danger);
  margin-top: var(--space-xs);
  min-height: 1lh;
}

/* --- Feed list --- */
.feed-list {
  flex: 1;
  padding: 0 var(--space-sm);
}

.feed-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: var(--text-sm);
  position: relative;
  list-style: none;
}
.feed-item::marker {
  display: none;
  content: "";
}
.feed-item:hover { background: var(--bg-hover); }
.feed-item.active {
  background: var(--accent-dim);
  color: var(--accent);
}

.feed-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  flex-shrink: 0;
  overflow: hidden;
}
.feed-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.feed-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.feed-unread {
  font-size: var(--text-xs);
  color: var(--accent);
  background: var(--accent-dim);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  min-width: 20px;
  text-align: center;
}

.feed-item .feed-remove,
.feed-item .feed-refresh {
  opacity: 0;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  margin-left: 2px;
}
.feed-item .feed-refresh { margin-left: auto; }

.feed-item:hover .feed-remove,
.feed-item:hover .feed-refresh { opacity: 1; }
.feed-item .feed-remove:hover { color: var(--danger); background: rgba(239,68,68,0.1); }
.feed-item .feed-refresh:hover { color: var(--accent); background: var(--bg-hover); }

.feed-refresh.is-spinning svg {
  animation: spin 1s linear infinite;
}

.sidebar-footer {
  padding: var(--space-lg);
  border-top: 1px solid var(--border);
  position: sticky;
  bottom: 0;
  background: var(--bg-secondary);
}

/* ============================================================
   FEED COLUMN (Article list)
   ============================================================ */
.feed-column {
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  border-right: 1px solid var(--border);
  overflow: hidden;
}

.feed-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border);
  min-height: 56px;
}

.feed-column-header h2 {
  font-size: var(--text-base);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.article-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-xs);
}

/* --- Article Row --- */
.article-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-md);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: opacity 0.3s ease, max-height 0.3s ease, padding 0.3s ease, margin 0.3s ease, transform 0.3s ease;
  border-bottom: 1px solid var(--border);
  content-visibility: auto;
  contain-intrinsic-block-size: auto 72px;
  max-height: 200px;
  overflow: hidden;
}
.article-row.is-hiding {
  opacity: 0;
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin-top: 0;
  margin-bottom: 0;
  border-width: 0;
  transform: translateX(-20px);
  content-visibility: visible;
}
.article-row:hover { background: var(--bg-hover); }
.article-row.active { background: var(--accent-dim); }
.article-row.is-read { opacity: 0.55; }
.article-row.is-read:hover { opacity: 0.8; }

.article-row-favicon {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
  overflow: hidden;
  margin-top: 2px;
}
.article-row-favicon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

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

.article-row-meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.article-row-source {
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.article-row-time { white-space: nowrap; }

/* Row actions (visible on hover / active buttons always visible) */
.article-row-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
  transition: opacity var(--transition-fast);
}

.row-action-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  opacity: 0; /* hidden by default */
}
.article-row:hover .row-action-btn { opacity: 1; }

.row-action-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.row-action-btn.is-active { 
  color: var(--accent); 
  opacity: 1 !important; /* always visible */
  background: var(--bg-active);
}
.row-action-btn.is-active svg {
  stroke-width: 2.2; /* bold */
}

/* --- Empty & Loading --- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl);
  color: var(--text-muted);
  text-align: center;
  min-height: 200px;
}
.empty-state p:first-child { font-size: var(--text-xl); margin-bottom: var(--space-sm); }

.loading-spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: var(--space-2xl) auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Pagination --- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.page-info {
  font-size: var(--text-sm);
  color: var(--text-muted);
  white-space: nowrap;
}

.mark-all-read {
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border);
}

/* ============================================================
   READER PANE
   ============================================================ */
.reader-pane {
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  overflow-y: auto;
}

.reader-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
.reader-empty-icon { font-size: 3rem; margin-bottom: var(--space-lg); opacity: 0.4; }

.reader-content {
  padding: var(--space-2xl);
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
  animation: fadeIn var(--transition-base) forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.reader-header { margin-bottom: var(--space-xl); }

.reader-header h1 {
  font-size: var(--text-2xl);
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: var(--space-md);
}

.reader-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
}

.reader-actions {
  display: flex;
  gap: var(--space-sm);
}

.action-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}
.action-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}
.action-btn.is-active {
  background: var(--accent);
  color: var(--text-inverse);
  border-color: var(--accent);
}

/* Reader body rich text */
.reader-body {
  font-size: var(--text-base);
  line-height: 1.8;
  color: var(--text-primary);
}
.reader-body h1, .reader-body h2, .reader-body h3 {
  margin: var(--space-xl) 0 var(--space-md);
  font-weight: 600;
  line-height: 1.3;
}
.reader-body h2 { font-size: var(--text-xl); }
.reader-body h3 { font-size: var(--text-lg); }
.reader-body p { margin-bottom: var(--space-lg); }
.reader-body img {
  border-radius: var(--radius-md);
  margin: var(--space-lg) 0;
}
.reader-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.reader-body pre {
  background: var(--bg-tertiary);
  padding: var(--space-lg);
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  margin: var(--space-lg) 0;
}
.reader-body code {
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.9em;
}
.reader-body pre code { background: none; padding: 0; }
.reader-body blockquote {
  border-left: 3px solid var(--accent);
  padding-left: var(--space-lg);
  margin: var(--space-lg) 0;
  color: var(--text-secondary);
  font-style: italic;
}
.reader-body ul, .reader-body ol {
  margin: var(--space-md) 0;
  padding-left: var(--space-xl);
}
.reader-body li { margin-bottom: var(--space-sm); list-style: disc; }
.reader-body ol li { list-style: decimal; }

/* ============================================================
   GUEST LANDING
   ============================================================ */
.guest-landing {
  position: fixed;
  top: var(--header-height);
  left: 0; right: 0; bottom: 0;
  overflow-y: auto;
  padding: var(--space-2xl);
}

.guest-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2xl);
  max-width: 1200px;
  margin: 0 auto;
}

.guest-col h2 {
  font-size: var(--text-base);
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
}

.guest-list { display: flex; flex-direction: column; gap: var(--space-sm); }

.guest-card {
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  cursor: pointer;
}
.guest-card:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.guest-card-title {
  font-size: var(--text-sm);
  font-weight: 500;
  margin-bottom: var(--space-xs);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.guest-card-meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
  display: flex;
  gap: var(--space-md);
}

/* ============================================================
   MODALS / DIALOGS
   ============================================================ */
.modal {
  border: none;
  background: transparent;
  max-width: min(90vw, 560px);
  width: 100%;
  padding: 0;
  margin: auto;
  color: var(--text-primary);
}
.modal::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}
.modal-lg { max-width: min(90vw, 720px); }
.modal-xl { max-width: min(90vw, 800px); }
.modal-sm { max-width: min(90vw, 400px); }
.modal-sharp .modal-content { border-radius: var(--radius-sm); }

.modal-content {
  background: var(--bg-tertiary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-lg);
  animation: modalIn var(--transition-base) forwards;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}
.modal-header h2 { font-size: var(--text-lg); font-weight: 600; }
.pool-modal-hint { font-size: var(--text-sm); color: var(--text-muted); font-weight: normal; margin-left: 8px; }

.modal-body {
  max-height: 60vh;
  overflow-y: auto;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}

/* Pool item */
.pool-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  border-bottom: 1px solid var(--border);
  gap: var(--space-md);
}
.pool-item:last-child { border-bottom: none; }
.pool-item-info { flex: 1; min-width: 0; }
.pool-item-title {
  font-size: var(--text-sm);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pool-item-url {
  font-size: var(--text-xs);
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pool-item-status {
  font-size: var(--text-xs);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}
.pool-item-status.pending { background: rgba(234,179,8,0.15); color: var(--warning); }
.pool-item-status.approved { background: rgba(34,197,94,0.15); color: var(--success); }
.pool-item-status.rejected { background: rgba(239,68,68,0.15); color: var(--danger); }

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
  position: fixed;
  inset: auto;
  top: calc(var(--header-height) + var(--space-lg));
  right: var(--space-lg);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  pointer-events: none;
  border: none;
  padding: 0;
  margin: 0;
  background: transparent;
}

.toast {
  position: relative;
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 0;
  box-shadow: none;
  font-size: var(--text-sm);
  pointer-events: auto;
  animation: toastFadeIn var(--transition-base) forwards;
  max-width: 360px;
  overflow: hidden;
}
.toast::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 4px;
}
.toast.toast-success::before { background: var(--success); }
.toast.toast-error::before { background: var(--danger); }
.toast.toast-info::before { background: var(--info); }

.toast.toast-out { animation: toastFadeOut var(--transition-base) forwards; }

@keyframes toastFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes toastFadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* ============================================================
   MOBILE RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  :root {
    --header-height: 52px;
  }

  .sidebar-toggle { display: flex; }
  #pc-categories { display: none !important; }

  .app-main {
    grid-template-columns: 1fr;
    top: calc(var(--header-height) + var(--mobile-tab-height));
  }

  .sidebar {
    position: fixed;
    top: calc(var(--header-height) + var(--mobile-tab-height));
    left: 0; bottom: 0;
    width: 280px;
    z-index: 80;
    transform: translateX(-100%);
    box-shadow: none; /* Removed --shadow-lg as per user request */
  }
  .sidebar.is-open { transform: translateX(0); }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 79;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-base);
  }
  .sidebar-overlay.is-visible {
    opacity: 1;
    pointer-events: auto;
  }

  .feed-column {
    border-right: none;
  }

  .reader-pane {
    position: fixed;
    top: var(--header-height);
    left: 0; right: 0; bottom: 0;
    z-index: 95;
    transform: translateX(100%);
    transition: transform var(--transition-base);
    background: var(--bg-primary);
  }
  .reader-pane.is-open { transform: translateX(0); }

  .feed-item .feed-remove,
  .feed-item .feed-refresh {
    opacity: 1; /* Always visible on mobile */
  }

  .reader-content { padding: var(--space-lg); }
  .reader-header h1 { font-size: var(--text-xl); }

  /* Mobile article row: always show actions inline */
  .article-row-actions {
    flex-direction: row;
    gap: 4px;
    margin-left: auto; /* push to right if needed, or let it flow naturally */
  }
  .row-action-btn { 
    opacity: 0.4; /* Faded when inactive so active ones stand out */
    width: 24px; 
    height: 24px; 
  }
  .row-action-btn.is-active {
    opacity: 1;
  }

  .mobile-tabs { display: flex; }

  .guest-columns {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
  }

  .guest-landing {
    top: var(--header-height);
    padding: var(--space-lg);
  }

  /* Back button in reader (injected by JS) */
  .reader-back-btn {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    margin-bottom: var(--space-lg);
    transition: all var(--transition-fast);
  }
  .reader-back-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
  }

  .toast-container {
    left: var(--space-md);
    right: var(--space-md);
  }
  .toast { max-width: 100%; }

  .pool-modal-hint {
    display: block;
    margin-left: 0;
    margin-top: 4px;
    font-size: 12px;
  }
}

/* Desktop: hide sidebar toggle */
@media (min-width: 769px) {
  .sidebar-toggle { display: none; }
  .mobile-tabs { display: none !important; }
}

/* ============================================================
   LOADING STATE — Skeleton
   ============================================================ */
.skeleton {
  background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-hover) 50%, var(--bg-tertiary) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-row {
  height: 64px;
  margin: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
}

/* ============================================================
   ADMIN REVIEW ITEMS
   ============================================================ */
.admin-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  border-bottom: 1px solid var(--border);
  gap: var(--space-md);
}
.admin-item:last-child { border-bottom: none; }
.admin-item-actions {
  display: flex;
  gap: var(--space-sm);
  flex-shrink: 0;
}

/* Refresh spin animation */
.icon-btn.is-spinning svg {
  animation: spin 0.8s linear infinite;
}
.pagination-input {
  width: 50px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
  background: var(--bg-primary);
  color: var(--text-primary);
}
.dropdown-menu {
  position: absolute; right: 0; top: 100%; margin-top: 8px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 140px;
  z-index: 1000;
  flex-direction: column;
  overflow: hidden;
  display: none;
}
.dropdown-item {
  width: 100%; text-align: left; padding: var(--space-sm) var(--space-lg);
  border: none; background: transparent;
  color: var(--text-primary); cursor: pointer;
  transition: all 0.2s ease;
  font-size: 13px;
  display: flex; align-items: center; gap: 8px;
}
.dropdown-item:hover {
  background: var(--bg-hover);
}
.dropdown-item.text-danger {
  color: var(--danger);
}
