/**
 * Stargazer Media Portal Stylesheet (portal.css)
 * Externalized for Strict Content Security Policy (CSP) compliance (eliminating 'unsafe-inline').
 * Provides dark/light theme variables, glassmorphic card containers, responsive grid, and badge states.
 */

:root {
  --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
  --card-bg: rgba(30, 41, 59, 0.7);
  --card-border: rgba(255, 255, 255, 0.1);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-calibre: #38bdf8;
  --accent-calibre-glow: rgba(56, 189, 248, 0.25);
  --accent-cweb: #0ea5e9;
  --accent-cweb-glow: rgba(14, 165, 233, 0.25);
  --accent-jellyfin: #a855f7;
  --accent-jellyfin-glow: rgba(168, 85, 247, 0.25);
  --accent-pyload: #f59e0b;
  --accent-pyload-glow: rgba(245, 158, 11, 0.25);
  --accent-qbittorrent: #2563eb;
  --accent-qbittorrent-glow: rgba(37, 99, 235, 0.25);
  --accent-aria2: #10b981;
  --accent-aria2-glow: rgba(16, 185, 129, 0.25);
  --accent-jdownloader: #0284c7;
  --accent-jdownloader-glow: rgba(2, 132, 199, 0.25);
  --accent-files: #f97316;
  --accent-files-glow: rgba(249, 115, 22, 0.25);
  --accent-filebrowserq: #0ea5e9;
  --accent-filebrowserq-glow: rgba(14, 165, 233, 0.25);
  --accent-programs: #f43f5e;
  --accent-programs-glow: rgba(244, 63, 94, 0.25);
  --accent-updates: #3b82f6;
  --accent-updates-glow: rgba(59, 130, 246, 0.25);
  --accent-calc: #06b6d4;
  --accent-calc-glow: rgba(6, 182, 212, 0.25);
  --accent-beszel: #8b5cf6;
  --accent-beszel-glow: rgba(139, 92, 246, 0.25);
  --accent-tapmap: #14b8a6;
  --accent-tapmap-glow: rgba(20, 184, 166, 0.25);
  --accent-gizi: #10b981;
  --accent-gizi-glow: rgba(16, 185, 129, 0.25);
  --accent-adguard: #10b981;
  --accent-adguard-glow: rgba(16, 185, 129, 0.25);
}

/* Light Theme Variables (Solar Slate Glassmorphism) */
html[data-theme="light"] {
  --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 50%, #eef2f6 100%);
  --card-bg: rgba(255, 255, 255, 0.85);
  --card-border: rgba(148, 163, 184, 0.35);
  --text-main: #0f172a;
  --text-muted: #475569;
}

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

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.25rem 1rem;
}

.container {
  max-width: 1200px;
  width: 100%;
  text-align: center;
}

.header {
  margin-bottom: 1.25rem;
  padding: 0 3.25rem;
  position: relative;
}

.header h1 {
  font-size: 2.15rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 0.25rem;
  background: linear-gradient(to right, #38bdf8, #c084fc, #fbbf24);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-wrap: balance;
}

.header p {
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* Offline Control Toolbar */
.controls {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  animation: fadeIn 0.4s ease;
}

.toggle-group {
  display: inline-flex;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--card-border);
  border-radius: 9999px;
  padding: 0.2rem;
}

.toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.toggle-btn.active {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-main);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  padding: 0 0.5rem;
}

.card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: 1rem;
  padding: 1.25rem 1.15rem;
  text-decoration: none;
  color: inherit;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow: hidden;
  flex: 1 1 230px;
  max-width: 270px;
  width: 100%;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  transition: opacity 0.3s ease;
}

.card.calibre::before {
  background: linear-gradient(90deg, #38bdf8, #818cf8);
}

.card.cweb::before {
  background: linear-gradient(90deg, #0ea5e9, #6366f1);
}

.card.jellyfin::before {
  background: linear-gradient(90deg, #a855f7, #ec4899);
}

.card.pyload::before {
  background: linear-gradient(90deg, #f59e0b, #eab308);
}

.card.qbittorrent::before {
  background: linear-gradient(90deg, #2563eb, #38bdf8);
}

.card.aria2::before {
  background: linear-gradient(90deg, #10b981, #06b6d4);
}

.card.jdownloader::before {
  background: linear-gradient(90deg, #0284c7, #38bdf8);
}

.card.files::before {
  background: linear-gradient(90deg, #f97316, #fb923c);
}

.card.filebrowserq::before {
  background: linear-gradient(90deg, #0ea5e9, #38bdf8);
}

.card.programs::before {
  background: linear-gradient(90deg, #f43f5e, #fb7185);
}

.card.beszel::before {
  background: linear-gradient(90deg, #8b5cf6, #6366f1);
}

.card.updates::before {
  background: linear-gradient(90deg, #3b82f6, #06b6d4);
}

.card.calc::before {
  background: linear-gradient(90deg, #06b6d4, #10b981);
}

.card.adguard::before {
  background: linear-gradient(90deg, #10b981, #059669);
}

.card.tapmap::before {
  background: linear-gradient(90deg, #14b8a6, #2dd4bf);
}

.card.gizi::before {
  background: linear-gradient(90deg, #059669, #10b981, #34d399);
}


.card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.2);
}

.card.calibre:hover {
  box-shadow: 0 15px 25px -8px var(--accent-calibre-glow);
}

.card.cweb:hover {
  box-shadow: 0 15px 25px -8px var(--accent-cweb-glow);
}

.card.jellyfin:hover {
  box-shadow: 0 15px 25px -8px var(--accent-jellyfin-glow);
}

.card.pyload:hover {
  box-shadow: 0 15px 25px -8px var(--accent-pyload-glow);
}

.card.qbittorrent:hover {
  box-shadow: 0 15px 25px -8px var(--accent-qbittorrent-glow);
}

.card.aria2:hover {
  box-shadow: 0 15px 25px -8px var(--accent-aria2-glow);
}

.card.jdownloader:hover {
  box-shadow: 0 15px 25px -8px var(--accent-jdownloader-glow);
}

.card.files:hover {
  box-shadow: 0 15px 25px -8px var(--accent-files-glow);
}

.card.filebrowserq:hover {
  box-shadow: 0 15px 25px -8px var(--accent-filebrowserq-glow);
}

.card.programs:hover {
  box-shadow: 0 15px 25px -8px var(--accent-programs-glow);
}

.card.beszel:hover {
  box-shadow: 0 15px 25px -8px var(--accent-beszel-glow);
}

.card.updates:hover {
  box-shadow: 0 15px 25px -8px var(--accent-updates-glow);
}

.card.calc:hover {
  box-shadow: 0 15px 25px -8px var(--accent-calc-glow);
}

.card.tapmap:hover {
  box-shadow: 0 15px 25px -8px var(--accent-tapmap-glow);
}

.card.gizi:hover {
  box-shadow: 0 15px 25px -8px var(--accent-gizi-glow);
}

.card.adguard:hover {
  box-shadow: 0 15px 25px -8px var(--accent-adguard-glow);
}

/* Offline Card Styling */
.card.offline-style {
  filter: grayscale(0.85) contrast(0.8);
  opacity: 0.5;
  pointer-events: none;
  cursor: not-allowed;
}

.card.offline-style:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--card-border);
}

.card.offline-hidden {
  display: none !important;
}

.icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
  font-size: 1.4rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: transform 0.3s ease;
}

.icon-wrapper img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.card:hover .icon-wrapper {
  transform: scale(1.08);
}

.card-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  text-wrap: balance;
}

.card-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 0.85rem;
  text-wrap: pretty;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.775rem;
  font-weight: 500;
  margin-top: auto;
  transition: all 0.2s ease;
}

.card.calibre .badge {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.card.cweb .badge {
  background: rgba(14, 165, 233, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(14, 165, 233, 0.25);
}

.card.jellyfin .badge {
  background: rgba(168, 85, 247, 0.12);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.25);
}

.card.pyload .badge {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.card.qbittorrent .badge {
  background: rgba(37, 99, 235, 0.12);
  color: #60a5fa;
  border: 1px solid rgba(37, 99, 235, 0.25);
}

.card.jdownloader .badge {
  background: rgba(2, 132, 199, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.card.files .badge {
  background: rgba(249, 115, 22, 0.12);
  color: #fb923c;
  border: 1px solid rgba(249, 115, 22, 0.25);
}

.card.filebrowserq .badge {
  background: rgba(14, 165, 233, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(14, 165, 233, 0.25);
}

.card.programs .badge {
  background: rgba(244, 63, 94, 0.12);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.25);
}

.card.beszel .badge {
  background: rgba(139, 92, 246, 0.12);
  color: #a78bfa;
  border: 1px solid rgba(139, 92, 246, 0.25);
}

.card.updates .badge {
  background: rgba(59, 130, 246, 0.12);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.card.calc .badge {
  background: rgba(6, 182, 212, 0.12);
  color: #22d3ee;
  border: 1px solid rgba(6, 182, 212, 0.25);
}

.card.tapmap .badge {
  background: rgba(20, 184, 166, 0.12);
  color: #2dd4bf;
  border: 1px solid rgba(20, 184, 166, 0.25);
}

.card.gizi .badge {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
}


.badge.badge-offline {
  background: rgba(239, 68, 68, 0.15) !important;
  color: #f87171 !important;
  border: 1px solid rgba(239, 68, 68, 0.3) !important;
}

.admin-link {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  color: var(--text-muted);
  opacity: 0.45;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 9999px;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 100;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(56, 189, 248, 0.2);
  cursor: pointer;
}

.admin-link svg {
  pointer-events: none;
  display: block;
}

.admin-link:hover {
  opacity: 0.95;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.25);
}

.admin-link:active {
  opacity: 1;
  transform: scale(0.92);
  background: rgba(56, 189, 248, 0.2);
  border-color: rgba(56, 189, 248, 0.4);
}

/* -------------------------------------------------------------
   Theme Cycler Bar — Media Portal Positioning
   (Floats top-left, symmetrically balancing the top-right .admin-link)
   ------------------------------------------------------------- */
.portal-theme-bar {
  position: absolute;
  top: 1rem;
  left: 1.25rem;
  z-index: 100;
}

.portal-theme-bar .theme-cycler {
  min-height: 40px;
}

/* Printing Service Capsule — hidden by default, shown only on LAN/Tailscale */
.printing-capsule {
  display: none;
  align-items: center;
  gap: 0.4em;
  margin-top: 2rem;
  padding: 0.3rem 1.1rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  font-size: 0.8rem;
  text-decoration: none;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  position: relative;
}

.printing-capsule:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: #94a3b8;
}

.printing-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  font-size: 0.75rem;
  white-space: nowrap;
  padding: 0.35rem 0.8rem;
  border-radius: 0.5rem;
  pointer-events: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.printing-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: rgba(255, 255, 255, 0.12);
}

.printing-capsule:hover .printing-tooltip {
  display: block;
}

.footer {
  margin-top: 1.5rem;
  color: #64748b;
  font-size: 0.8rem;
}

@media (max-width: 640px) {
  body {
    padding: 0.75rem 0.5rem;
  }
  .header {
    margin-top: 0.75rem;
    margin-bottom: 0.85rem;
    padding: 0 2.25rem;
  }
  .header h1 {
    font-size: 1.65rem;
    line-height: 1.25;
    margin-bottom: 0.2rem;
  }
  .header p {
    font-size: 0.875rem;
  }
  .admin-link {
    top: 0.65rem;
    right: 0.65rem;
    width: 44px;
    height: 44px;
    opacity: 0.55;
  }
  .admin-link svg {
    width: 20px;
    height: 20px;
  }

  /* Mobile: mirror .admin-link icon-only sizing */
  .portal-theme-bar {
    top: 0.65rem;
    left: 0.65rem;
  }

  .portal-theme-bar .theme-cycler {
    padding: 0;
    width: 44px;
    height: 44px;
    min-height: 44px;
    border-radius: 9999px;
    justify-content: center;
  }

  .portal-theme-bar .theme-cycler .theme-cycler-label {
    display: none; /* Icon-only on mobile, mirroring .admin-link */
  }

  .portal-theme-bar .theme-icon svg {
    width: 18px;
    height: 18px;
  }
}

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

/* -------------------------------------------------------------
   Solar Slate Light Theme Overrides (Media Portal)
   ------------------------------------------------------------- */
html[data-theme="light"] .header h1 {
  background: linear-gradient(to right, #0284c7, #7c3aed, #d97706);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

html[data-theme="light"] .card {
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
}

html[data-theme="light"] .card:hover {
  border-color: rgba(148, 163, 184, 0.5);
  box-shadow: 0 20px 30px -10px rgba(15, 23, 42, 0.14), 0 8px 12px -4px rgba(15, 23, 42, 0.06);
}

html[data-theme="light"] .icon-wrapper {
  background: rgba(15, 23, 42, 0.04);
  border-color: rgba(15, 23, 42, 0.08);
}

html[data-theme="light"] .toggle-group {
  background: rgba(226, 232, 240, 0.8);
  border-color: rgba(148, 163, 184, 0.35);
}

html[data-theme="light"] .toggle-btn.active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.12);
}

html[data-theme="light"] .admin-link {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(148, 163, 184, 0.35);
  color: #475569;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

html[data-theme="light"] .admin-link:hover {
  background: #ffffff;
  color: #0f172a;
  border-color: rgba(148, 163, 184, 0.6);
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.2);
}

html[data-theme="light"] .printing-capsule {
  background: rgba(255, 255, 255, 0.8);
  border-color: rgba(148, 163, 184, 0.3);
  color: #475569;
}

html[data-theme="light"] .printing-capsule:hover {
  background: #ffffff;
  border-color: rgba(148, 163, 184, 0.5);
  color: #0f172a;
}

html[data-theme="light"] .footer {
  color: #64748b;
}

/* Light Theme High-Contrast Badges */
html[data-theme="light"] .card.calibre .badge {
  background: rgba(14, 165, 233, 0.12);
  color: #0284c7;
  border: 1px solid rgba(14, 165, 233, 0.3);
}

html[data-theme="light"] .card.cweb .badge {
  background: rgba(14, 165, 233, 0.12);
  color: #0284c7;
  border: 1px solid rgba(14, 165, 233, 0.3);
}

html[data-theme="light"] .card.jellyfin .badge {
  background: rgba(147, 51, 234, 0.12);
  color: #7e22ce;
  border: 1px solid rgba(147, 51, 234, 0.3);
}

html[data-theme="light"] .card.pyload .badge {
  background: rgba(217, 119, 6, 0.12);
  color: #b45309;
  border: 1px solid rgba(217, 119, 6, 0.3);
}

html[data-theme="light"] .card.qbittorrent .badge {
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
  border: 1px solid rgba(37, 99, 235, 0.3);
}

html[data-theme="light"] .card.jdownloader .badge {
  background: rgba(2, 132, 199, 0.12);
  color: #0369a1;
  border: 1px solid rgba(2, 132, 199, 0.3);
}

html[data-theme="light"] .card.files .badge {
  background: rgba(234, 88, 12, 0.12);
  color: #c2410c;
  border: 1px solid rgba(234, 88, 12, 0.3);
}

html[data-theme="light"] .card.filebrowserq .badge {
  background: rgba(14, 165, 233, 0.12);
  color: #0284c7;
  border: 1px solid rgba(14, 165, 233, 0.3);
}

html[data-theme="light"] .card.programs .badge {
  background: rgba(225, 29, 72, 0.12);
  color: #be123c;
  border: 1px solid rgba(225, 29, 72, 0.3);
}

html[data-theme="light"] .card.beszel .badge {
  background: rgba(124, 58, 237, 0.12);
  color: #6d28d9;
  border: 1px solid rgba(124, 58, 237, 0.3);
}

html[data-theme="light"] .card.updates .badge {
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
  border: 1px solid rgba(37, 99, 235, 0.3);
}

html[data-theme="light"] .card.calc .badge {
  background: rgba(13, 148, 136, 0.12);
  color: #0f766e;
  border: 1px solid rgba(13, 148, 136, 0.3);
}

html[data-theme="light"] .card.adguard .badge {
  background: rgba(16, 185, 129, 0.12);
  color: #047857;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

html[data-theme="light"] .card.tapmap .badge {
  background: rgba(13, 148, 136, 0.12);
  color: #0f766e;
  border: 1px solid rgba(13, 148, 136, 0.3);
}

html[data-theme="light"] .card.gizi .badge {
  background: rgba(16, 185, 129, 0.12);
  color: #047857;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

html[data-theme="light"] .card.aria2 .badge {
  background: rgba(16, 185, 129, 0.12);
  color: #047857;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* -------------------------------------------------------------
   Modern Web Guidance: Accessible Motion Reduction
   ------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .card,
  .card:hover,
  .icon-wrapper,
  .card:hover .icon-wrapper {
    transform: none !important;
  }

  .controls {
    animation: none !important;
  }
}


/* =============================================================
   Stargazer Bento Grid & Modern Category Sections
   ============================================================= */

/* Search Bar Toolbar */
.portal-search-wrapper {
  max-width: 480px;
  width: 100%;
  margin: 1.25rem auto 1.5rem auto;
  position: relative;
  display: flex;
  align-items: center;
}

.portal-search-input {
  width: 100%;
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: 9999px;
  padding: 0.65rem 3rem 0.65rem 2.75rem;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text-main);
  outline: none;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.portal-search-input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2), 0 6px 16px rgba(0, 0, 0, 0.15);
}

.portal-search-icon {
  position: absolute;
  left: 1rem;
  color: var(--text-muted);
  pointer-events: none;
  display: flex;
  align-items: center;
}

.portal-search-kbd {
  position: absolute;
  right: 1rem;
  font-size: 0.75rem;
  font-family: inherit;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.1);
  padding: 0.15rem 0.45rem;
  border-radius: 0.35rem;
  border: 1px solid var(--card-border);
  pointer-events: none;
}

.portal-search-clear {
  position: absolute;
  right: 2.75rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: none;
  padding: 0.25rem;
  align-items: center;
}

.portal-search-clear:hover {
  color: var(--text-main);
}

/* Bento Categories Container */
.bento-container {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  width: 100%;
  margin-top: 1rem;
}

.bento-category {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  text-align: left;
}

.category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  border-radius: 0.75rem;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s ease;
}

.category-header:hover {
  background: rgba(255, 255, 255, 0.05);
}

.category-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.category-icon {
  display: flex;
  align-items: center;
  color: #38bdf8;
}

.category-title h2 {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-main);
  margin: 0;
}

.category-count {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.08);
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  border: 1px solid var(--card-border);
}

.category-toggle {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 0.25rem;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chevron-icon {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.bento-category.collapsed .chevron-icon {
  transform: rotate(-90deg);
}

.bento-category.collapsed .category-grid {
  display: none;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.1rem;
  width: 100%;
}

/* Card Search Hidden State */
.svc-card.search-hidden {
  display: none !important;
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .portal-search-wrapper {
    margin: 1rem 0;
  }
  .portal-search-kbd {
    display: none;
  }
  .category-grid {
    grid-template-columns: 1fr;
  }
}