:root {
  /* Light Theme (Default) */
  --bg-primary: #ffffff;
  --bg-secondary: #f0fdf4;
  /* Light forest green tint */
  --bg-glass: rgba(255, 255, 255, 0.8);
  --text-primary: #0f172a;
  --text-secondary: #475569;

  /* Matte Forest Green Palette */
  --accent-color: #3f7d37;
  --accent-hover: #4b9442;
  --accent-gradient: #3f7d37;

  --border-color: rgba(0, 0, 0, 0.1);
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --glass-blur: blur(12px);
}

[data-theme="dark"] {
  /* Dark Theme Palette */
  --bg-primary: #0f172a;
  --bg-secondary: #0b1c14;
  /* Very dark matte green tint */
  --bg-glass: rgba(15, 23, 42, 0.8);
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;

  /* Matte Forest Green Palette stays mostly the same but maybe tweaked for dark mode */
  --accent-color: #3f7d37;
  --accent-hover: #4b9442;
  --accent-gradient: #3f7d37;

  --border-color: rgba(255, 255, 255, 0.1);
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
}

/* --- Navigation --- */
header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 1.5em 3em;
  background: var(--bg-glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  justify-self: start;
  font-size: 1.75em;
  font-weight: 800;
  color: var(--accent-color);
  letter-spacing: -0.5px;
}

.header-nav {
  display: flex;
  gap: 1.2em;
  align-items: center;
  justify-self: center;
}

.nav-divider {
  color: var(--text-secondary);
  opacity: 0.5;
  font-weight: 300;
}

.header-actions {
  display: flex;
  justify-self: end;
  gap: 1.5em;
  align-items: center;
}

.theme-toggle {
  background: none;
  border: none;
  font-size: 1.4em;
  cursor: pointer;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.2em;
  border-radius: 50%;
  transition: transform 0.2s ease;
}

.theme-toggle:hover {
  transform: scale(1.1);
}

.nav-link {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95em;
  transition: color 0.3s ease;
}

.nav-link:hover {
  color: var(--accent-hover);
}

.btn-primary {
  padding: 0.6em 1.5em;
  border-radius: 9999px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95em;
  color: #ffffff;
  background: var(--accent-color);
  border: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  box-shadow: var(--shadow-sm);
  display: inline-block;
}

.btn-primary:hover {
  transform: translateY(-2px);
  background-color: var(--accent-hover);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
}

.btn-outline {
  padding: 0.6em 1.5em;
  border-radius: 9999px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95em;
  color: var(--text-primary);
  background: transparent;
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--text-secondary);
}

/* --- Hero Section & Grid --- */
.hero-container {
  flex-grow: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  padding: 4em 3em;
  gap: 4em;
  max-width: 1400px;
  margin: 0 auto;
}

.hero-text {
  max-width: 600px;
}

.hero-text h1 {
  font-size: 3.5em;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 0.5em;
  letter-spacing: -1px;
}

.hero-text p {
  font-size: 1.2em;
  color: var(--text-secondary);
  margin-bottom: 2em;
}

/* 2x2 Image Grid */
.image-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 1.5em;
  perspective: 1000px;
}

.grid-img-wrapper {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  aspect-ratio: 4/3;
  transform: rotateY(-5deg) rotateX(5deg);
  transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.grid-img-wrapper:hover {
  transform: rotateY(0deg) rotateX(0deg) scale(1.05);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.3);
  z-index: 10;
}

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

/* --- Featured Stories Section --- */
.featured-section {
  background: var(--bg-secondary);
  padding: 5em 3em;
  border-top: 1px solid var(--border-color);
}

.featured-container {
  max-width: 1200px;
  margin: 0 auto;
}

.featured-heading {
  font-size: 2.5em;
  font-weight: 800;
  text-align: center;
  margin-bottom: 0.2em;
  letter-spacing: -0.5px;
}

.featured-subheading {
  text-align: center;
  color: var(--text-secondary);
  font-size: 1.15em;
  margin-bottom: 2.5em;
}

.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 1.5em;
}

.featured-card {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 16px;
  overflow: hidden;
  background-color: #6b7280;
  background-size: cover;
  background-position: center;
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.featured-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.featured-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.05) 40%, rgba(0, 0, 0, 0.05) 55%, rgba(0, 0, 0, 0.75) 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.25em 1.5em;
}

.featured-card-top {
  display: flex;
  flex-direction: column;
  gap: 0.3em;
}

.featured-card-meta {
  display: flex;
  align-items: center;
  gap: 0.6em;
}

.featured-badge {
  display: inline-block;
  padding: 0.2em 0.7em;
  border-radius: 9999px;
  font-size: 0.75em;
  font-weight: 600;
  text-transform: capitalize;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  backdrop-filter: blur(4px);
}

.featured-region {
  display: inline-block;
  padding: 0.2em 0.7em;
  border-radius: 9999px;
  font-size: 0.75em;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  backdrop-filter: blur(4px);
}

.featured-card-content {
  display: flex;
  flex-direction: column;
  gap: 0.4em;
}

.featured-card-title {
  display: inline-block;
  width: fit-content;
  padding: 0.2em 0.7em;
  border-radius: 9999px;
  font-size: 1.3em;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(4px);
}

.featured-card-desc {
  font-size: 0.9em;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.5;
}

.featured-audio {
  width: 100%;
  border-radius: 8px;
  height: 36px;
  margin-top: 0.3em;
  filter: invert(1) hue-rotate(180deg);
  opacity: 0.85;
}

.featured-audio-unavailable {
  font-size: 0.85em;
  color: rgba(255, 255, 255, 0.5);
  font-style: italic;
}

@media (max-width: 600px) {
  .featured-section {
    padding: 3em 1.5em;
  }

  .featured-heading {
    font-size: 1.8em;
  }

  .featured-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Footer --- */
footer {
  text-align: center;
  padding: 2em;
  color: var(--text-secondary);
  font-size: 0.9em;
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}

/* --- Responsive --- */
@media (max-width: 968px) {
  .hero-container {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 3em 2em;
  }

  .hero-text {
    margin: 0 auto;
  }

  .image-grid {
    transform: none;
    max-width: 600px;
    margin: 0 auto;
  }

  .grid-img-wrapper {
    transform: none;
  }
}

@media (max-width: 600px) {
  header {
    display: flex;
    flex-direction: column;
    gap: 1.5em;
    padding: 1.5em;
  }

  .hero-text h1 {
    font-size: 2.5em;
  }

  .image-grid {
    grid-template-columns: 1fr;
    gap: 1em;
  }
}

/* --- Pricing Section --- */
.pricing-container {
  max-width: 1200px;
  margin: 4em auto;
  padding: 0 2em;
  flex-grow: 1;
}

.pricing-header {
  text-align: center;
  margin-bottom: 4em;
}

.pricing-header h1 {
  font-size: 3em;
  font-weight: 800;
  margin-bottom: 0.25em;
  letter-spacing: -1px;
}

.pricing-header p {
  font-size: 1.2em;
  color: var(--text-secondary);
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  /* Forced 3 columns */
  gap: 1.5em;
  /* Slightly smaller gap to fit */
  align-items: stretch;
}

.pricing-card {
  background: var(--bg-glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5em 1em;
  /* Reduced padding */
  text-align: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
  display: flex;
  flex-direction: column;
}

.pricing-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent-color);
}

.pricing-card.popular {
  background: var(--bg-glass);
  border-color: var(--accent-color);
  transform: scale(1.03);
  /* Scaled down slightly */
  box-shadow: 0 15px 25px -5px rgba(0, 0, 0, 0.1);
  z-index: 10;
}

.pricing-card.popular:hover {
  transform: scale(1.03) translateY(-8px);
  box-shadow: 0 20px 30px -5px rgba(22, 163, 74, 0.2);
}

.popular-badge {
  position: absolute;
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent-color);
  color: white;
  padding: 0.4em 1.2em;
  border-radius: 9999px;
  font-size: 0.8em;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  box-shadow: var(--shadow-sm);
}

.plan-name {
  font-size: 1.1em;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5em;
}

.plan-price {
  font-size: 2.2em;
  /* Made pricing smaller */
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.2em;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.plan-price .currency {
  font-size: 0.4em;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 0.5em;
}

.plan-desc {
  font-size: 0.9em;
  color: var(--text-secondary);
  margin-bottom: 1.5em;
}

.plan-features {
  list-style: none;
  text-align: left;
  margin-bottom: 2em;
  flex-grow: 1;
  /* Pushes button to bottom */
}

.plan-features li {
  padding: 0.4em 0;
  font-size: 0.85em;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: flex-start;
}

.plan-features li:last-child {
  border: none;
}

.plan-features li::before {
  content: '✓';
  color: var(--accent-hover);
  font-weight: bold;
  margin-right: 12px;
}

.plan-btn {
  display: block;
  width: 100%;
}

/* --- Auth Pages --- */
.auth-page {
  background-image: radial-gradient(circle at 50% 0%, var(--bg-secondary) 0%, var(--bg-primary) 70%);
}

.auth-container {
  flex-grow: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2em;
}

.auth-card {
  background: var(--bg-glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 3em;
  width: 100%;
  max-width: 450px;
  box-shadow: var(--shadow-lg);
}

.auth-card h1 {
  font-size: 2em;
  font-weight: 800;
  text-align: center;
  margin-bottom: 0.2em;
}

.auth-subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 2em;
}

.input-group {
  margin-bottom: 1.5em;
}

.input-group label {
  display: block;
  font-size: 0.9em;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.5em;
}

.input-hint {
  display: block;
  font-size: 0.8em;
  color: var(--text-secondary);
  margin-top: 0.4em;
  opacity: 0.7;
}

.input-group input {
  width: 100%;
  padding: 0.9em 1em;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 1em;
  transition: all 0.2s ease;
}

.input-group input:focus {
  outline: none;
  border-color: var(--accent-hover);
  background: rgba(0, 0, 0, 0.4);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.auth-submit {
  width: 100%;
  padding: 1em;
  font-size: 1em;
  margin-top: 0.5em;
}

.auth-footer {
  margin-top: 2em;
  text-align: center;
  font-size: 0.9em;
  color: var(--text-secondary);
}

.auth-footer a {
  color: var(--accent-hover);
  text-decoration: none;
  font-weight: 500;
}

.auth-footer a:hover {
  text-decoration: underline;
}

.message {
  margin-top: 1.5em;
  padding: 1em;
  border-radius: 10px;
  font-size: 0.9em;
  text-align: center;
}

.message.success {
  background: rgba(16, 185, 129, 0.1);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.message.error {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* --- Dashboard --- */
.dashboard-container {
  max-width: 900px;
  margin: 3em auto;
  padding: 0 2em;
  flex-grow: 1;
}

.dashboard-header {
  margin-bottom: 2.5em;
}

.dashboard-header h1 {
  font-size: 2.5em;
  font-weight: 800;
  margin-bottom: 0.2em;
  letter-spacing: -0.5px;
}

.dashboard-header p {
  font-size: 1.1em;
  color: var(--text-secondary);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5em;
}

.dashboard-card {
  background: var(--bg-glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 2em;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dashboard-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.dashboard-card h2 {
  font-size: 1.15em;
  font-weight: 700;
  margin-bottom: 1.2em;
  padding-bottom: 0.6em;
  border-bottom: 1px solid var(--border-color);
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6em 0;
  border-bottom: 1px solid var(--border-color);
}

.stat-row:last-child {
  border-bottom: none;
}

.stat-label {
  font-size: 0.9em;
  color: var(--text-secondary);
  font-weight: 500;
}

.stat-value {
  font-size: 0.95em;
  font-weight: 600;
  color: var(--text-primary);
}

/* --- Buttons --- */
.btn-danger {
  padding: 0.5em 1.2em;
  border-radius: 9999px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9em;
  color: #ef4444;
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.3);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: #ef4444;
}

@media (max-width: 700px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 968px) {
  .pricing-grid {
    grid-template-columns: 1fr;
    /* Stack on smaller screens */
  }

  .pricing-card.popular {
    transform: none;
    box-shadow: none;
  }

  .pricing-card.popular:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
  }
}

/* =============================================================================
   App Layout — Sidebar + Main (authenticated pages)
   ============================================================================= */

.app-layout {
  flex-direction: row;
  overflow: hidden;
  height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--bg-primary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 200;
  overflow-y: auto;
}

.sidebar-top {
  padding: 1.5em;
}

.sidebar-logo {
  margin-bottom: 1.75em;
}

.sidebar-logo a {
  font-size: 1.5em;
  font-weight: 800;
  color: var(--accent-color);
  text-decoration: none;
  letter-spacing: -0.5px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25em;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75em;
  padding: 0.65em 0.85em;
  border-radius: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95em;
  transition: all 0.15s ease;
  background: none;
  border: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
}

.sidebar-link:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-primary);
}

[data-theme="dark"] .sidebar-link:hover {
  background: rgba(255, 255, 255, 0.06);
}

.sidebar-link.active {
  background: rgba(63, 125, 55, 0.1);
  color: var(--accent-color);
  font-weight: 600;
}

[data-theme="dark"] .sidebar-link.active {
  background: rgba(63, 125, 55, 0.15);
}

.sidebar-link svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.sidebar-link.active svg {
  opacity: 1;
}

.sidebar-divider {
  height: 1px;
  background: var(--border-color);
  margin: 0.5em 0;
}

.sidebar-link-sub {
  padding-left: 1.5em;
  font-size: 0.9em;
}

/* --- Sidebar bottom / profile --- */
.sidebar-bottom {
  padding: 0.75em 1.5em 1.25em;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.25em;
}

.sidebar-profile {
  position: relative;
}

.sidebar-profile-btn {
  display: flex;
  align-items: center;
  gap: 0.75em;
  width: 100%;
  padding: 0.6em 0.5em;
  border: none;
  background: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
  color: var(--text-primary);
}

.sidebar-profile-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .sidebar-profile-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

.sidebar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-color);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85em;
  flex-shrink: 0;
}

.sidebar-profile-info {
  flex: 1;
  min-width: 0;
  text-align: left;
}

.sidebar-profile-name {
  display: block;
  font-weight: 600;
  font-size: 0.9em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-profile-plan {
  display: block;
  font-size: 0.75em;
  color: var(--text-secondary);
  text-transform: capitalize;
}

.sidebar-profile-chevron {
  flex-shrink: 0;
  opacity: 0.5;
  transition: transform 0.2s ease;
}

.sidebar-profile.open .sidebar-profile-chevron {
  transform: rotate(180deg);
}

/* --- Profile dropdown --- */
.profile-dropdown {
  display: none;
  position: absolute;
  bottom: calc(100% + 0.5em);
  left: 0;
  right: 0;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 0.4em;
  z-index: 300;
}

.sidebar-profile.open .profile-dropdown {
  display: block;
}

.profile-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.6em 0.75em;
  border-radius: 6px;
  font-size: 0.9em;
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background 0.15s ease;
}

.profile-dropdown-item:hover {
  background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .profile-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.profile-dropdown-item svg {
  opacity: 0.6;
  flex-shrink: 0;
}

/* --- Main content area --- */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  overflow-y: auto;
}

.app-topbar {
  display: flex;
  align-items: center;
  padding: 1em 2em;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-primary);
  position: sticky;
  top: 0;
  z-index: 100;
  /* Reset the grid layout from the public header */
  grid-template-columns: unset;
}

.app-search {
  display: flex;
  align-items: center;
  gap: 0.6em;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 0.6em 1em;
  width: 100%;
  max-width: 520px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.app-search:focus-within {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(63, 125, 55, 0.12);
}

.app-search svg {
  flex-shrink: 0;
  color: var(--text-secondary);
  opacity: 0.6;
}

.app-search input {
  flex: 1;
  border: none;
  background: none;
  outline: none;
  font-size: 0.95em;
  color: var(--text-primary);
  font-family: inherit;
}

.app-search input::placeholder {
  color: var(--text-secondary);
  opacity: 0.6;
}

.app-content {
  flex: 1;
  padding: 2em;
  max-width: 1100px;
  width: 100%;
}

.app-footer {
  text-align: center;
  padding: 1.5em 2em;
  color: var(--text-secondary);
  font-size: 0.85em;
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}

/* --- Mobile header (hidden on desktop) --- */
.app-mobile-header {
  display: none;
}

.sidebar-overlay {
  display: none;
}

/* --- Responsive: sidebar collapse on mobile --- */
@media (max-width: 768px) {
  .app-layout {
    flex-direction: column;
  }

  .sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    width: 260px;
    height: 100vh;
    transition: left 0.25s ease;
    z-index: 1000;
  }

  .sidebar.open {
    left: 0;
  }

  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  .sidebar-overlay.visible {
    opacity: 1;
    pointer-events: auto;
  }

  .app-mobile-header {
    display: flex;
    align-items: center;
    gap: 1em;
    padding: 0.85em 1.25em;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-primary);
    position: sticky;
    top: 0;
    z-index: 100;
  }

  .mobile-menu-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-primary);
    padding: 0.2em;
    display: flex;
    align-items: center;
  }

  .app-main {
    height: auto;
    overflow-y: visible;
  }

  .app-topbar {
    position: static;
    padding: 0.85em 1.25em;
  }

  .app-content {
    padding: 1.25em;
  }
}