/* ============================================================
   CC News Portal — Google News / Material Design 3 Theme
   ============================================================ */

/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Google+Sans:wght@400;500;700;800&family=Roboto:wght@400;500;700&display=swap');

/* ---------- Design Tokens ---------- */
:root {
  --bg: #f8f9fa;
  --surface: #ffffff;
  --surface-alt: #1f1f1f;
  --primary: #1a73e8;
  --primary-hover: #1557b0;
  --primary-container: #d3e3fd;
  --accent: #ea4335;
  --text: #202124;
  --text-secondary: #5f6368;
  --muted: #5f6368;
  --border: #dadce0;
  --border-light: #e8eaed;
  --success: #1e8e3e;
  --warning: #f9ab00;
  --danger: #d93025;
  --shadow-1: 0 1px 2px 0 rgba(60,64,67,0.3), 0 1px 3px 1px rgba(60,64,67,0.15);
  --shadow-2: 0 1px 2px 0 rgba(60,64,67,0.3), 0 2px 6px 2px rgba(60,64,67,0.15);
  --shadow-3: 0 4px 8px 3px rgba(60,64,67,0.15), 0 1px 3px rgba(60,64,67,0.3);
  --shadow-4: 0 6px 10px 4px rgba(60,64,67,0.15), 0 2px 3px rgba(60,64,67,0.3);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-full: 9999px;
  --motion: cubic-bezier(0.4, 0, 0.2, 1);
  --font-sans: 'Google Sans', 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; }

/* ---------- Shell ---------- */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar, .page, .footer { width: min(1200px, calc(100% - 32px)); margin: 0 auto; }

/* ============================================================
   TOPBAR — Google News-style header
   ============================================================ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-light);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  flex-shrink: 0;
  text-decoration: none;
}
.brand.has-logo .brand-mark {
  background: transparent;
  border: none;
  padding: 0;
}
.brand-mark {
  width: 40px; height: 40px; border-radius: var(--radius);
  display: grid; place-items: center;
  background: var(--primary);
  color: #fff;
  overflow: hidden;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 1.1rem;
}
.brand-mark img {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
}
.brand-copy { display: grid; gap: 1px; }
.brand-text {
  font-family: var(--font-sans);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--text);
}
.brand-main { color: var(--text); }
.brand-online { color: var(--primary); }
.brand-tagline {
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* Nav Tabs — Google News underline style */
.main-nav {
  display: flex;
  gap: 4px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.main-nav::-webkit-scrollbar { display: none; }
.main-nav a {
  padding: 8px 16px;
  border-radius: var(--radius-full);
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  transition: color 0.2s var(--motion), background 0.2s var(--motion);
  position: relative;
}
.main-nav a:hover { color: var(--primary); background: var(--primary-container); }
.main-nav a.active {
  color: var(--primary);
  background: var(--primary-container);
  font-weight: 700;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.user-chip, .metric-chip {
  background: var(--primary-container);
  border: none;
  border-radius: var(--radius-full);
  padding: 6px 14px;
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 500;
  font-family: var(--font-sans);
  white-space: nowrap;
}

/* ============================================================
   BUTTONS — Material 3 style
   ============================================================ */
.btn {
  border-radius: var(--radius-full);
  padding: 10px 20px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  font: inherit;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.875rem;
  min-height: 40px;
  transition: all 0.2s var(--motion);
  letter-spacing: 0.01em;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); box-shadow: var(--shadow-1); }
.btn-ghost {
  background: var(--surface);
  border-color: var(--border);
  color: var(--primary);
}
.btn-ghost:hover { background: #f1f3f4; }

/* ============================================================
   FLASH MESSAGES
   ============================================================ */
.flash {
  width: min(1200px, calc(100% - 32px));
  margin: 12px auto;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}
.flash-success { background: #e6f4ea; color: var(--success); border: 1px solid #ceead6; }
.flash-warning { background: #fef7e0; color: #e37400; border: 1px solid #fde293; }
.flash-error { background: #fce8e6; color: var(--danger); border: 1px solid #f5c6c2; }

/* ============================================================
   PAGE
   ============================================================ */
.page { flex: 1; padding-bottom: 48px; }

/* ============================================================
   CARDS & PANELS — Material elevation
   ============================================================ */
.hero, .panel, .auth-card, .stat-card, .list-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: none;
  transition: box-shadow 0.2s var(--motion), transform 0.2s var(--motion);
}

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
  padding: 24px;
  margin-bottom: 20px;
}
.hero-band {
  display: inline-flex;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: #fce8e6;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  font-family: var(--font-sans);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.hero h1, .section-head h2, .auth-card h1 {
  margin: 0 0 8px;
  font-family: var(--font-sans);
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
}
.hero p, .lede, .muted {
  color: var(--muted);
  line-height: 1.6;
  font-size: 0.875rem;
}
.hero-aside {
  background: var(--surface-alt);
  color: #fff;
  border-radius: var(--radius);
  padding: 20px;
  display: grid;
  gap: 14px;
}
.hero-aside .muted { color: rgba(255,255,255,0.7); }

/* ---------- Grids ---------- */
.grid-3, .grid-2, .stats-grid, .auth-grid, .cards-grid {
  display: grid;
  gap: 16px;
}
.grid-3, .stats-grid, .cards-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2, .auth-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.admin-stats { margin-bottom: 24px; }
.stat-card, .list-card, .panel { padding: 20px; }

/* ---------- Stat Card ---------- */
.stat-value {
  font-family: var(--font-sans);
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 4px;
  color: var(--primary);
  line-height: 1.1;
}

/* ---------- Section Head ---------- */
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 24px 0 12px;
}

/* ---------- List Card ---------- */
.list-card h3, .panel h3, .stat-card h3 {
  margin-top: 0;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 1rem;
}
.list-card-media {
  margin: -20px -20px 14px;
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #f1f3f4;
  display: grid;
  place-items: center;
  color: var(--muted);
}
.list-card-media img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}

/* ============================================================
   HOME PAGE — Google News-inspired layout
   ============================================================ */

/* Breaking Ribbon */
.home-ribbon {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  overflow: hidden;
  border-left: 4px solid var(--accent);
}
.home-ribbon-label {
  padding: 10px 16px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.home-ribbon-text {
  padding: 10px 16px;
  color: var(--text);
  font-weight: 500;
  font-size: 0.9rem;
  line-height: 1.4;
}

/* Toolbar & Search */
.home-toolbar {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}
.home-search {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}
.home-search input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 12px 20px;
  font: inherit;
  font-size: 0.9rem;
  background: var(--bg);
  transition: border-color 0.2s var(--motion), box-shadow 0.2s var(--motion);
  outline: none;
}
.home-search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-container);
  background: var(--surface);
}

/* Category Chips */
.home-category-strip {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 4px;
}
.home-category-strip::-webkit-scrollbar { display: none; }
.home-category-chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 16px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.2s var(--motion);
  flex: 0 0 auto;
}
.home-category-chip:hover { background: #f1f3f4; color: var(--text); }
.home-category-chip.active {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}
.home-under-tag {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Main Layout */
.home-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(300px, 0.95fr);
  gap: 20px;
}
.home-frontpage {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.9fr);
  gap: 20px;
  margin-bottom: 20px;
}
.home-main, .home-sidebar {
  display: grid;
  gap: 16px;
  align-content: start;
}

/* Lead Story */
.lead-story {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow 0.2s var(--motion);
}
.lead-story:hover { box-shadow: var(--shadow-2); }
.lead-story-media {
  aspect-ratio: 16 / 9;
  overflow: hidden;
}
.lead-story-media img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s var(--motion);
}
.lead-story:hover .lead-story-media img { transform: scale(1.03); }
.lead-story-body { padding: 20px; }
.lead-story-body h1 {
  margin: 10px 0 8px;
  font-family: var(--font-sans);
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
}
.lead-story-featured .lead-story-media { min-height: 360px; }

/* Kicker Row */
.home-kicker-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.home-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  background: #e8f0fe;
  color: var(--primary);
  font-family: var(--font-sans);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.home-meta-line {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.8rem;
}

/* Stats Bar */
.home-stats-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  overflow: hidden;
}
.home-stats-bar-blue { margin-bottom: 24px; }
.home-stat {
  display: grid;
  gap: 4px;
  padding: 16px 20px;
  border-right: 1px solid var(--border-light);
  transition: background 0.2s var(--motion);
}
.home-stat:hover { background: #f8f9fa; }
.home-stat:last-child { border-right: none; }
.home-stat-value {
  font-family: var(--font-sans);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.1;
}
.home-stat-label {
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.7rem;
}

/* Story Cards */
.home-story-card {
  transition: box-shadow 0.2s var(--motion), transform 0.2s var(--motion);
  border: 1px solid var(--border-light);
}
.home-story-card:hover {
  box-shadow: var(--shadow-2);
  transform: translateY(-2px);
}

/* Sidebar Blocks */
.sidebar-block {
  background: var(--surface);
  padding: 20px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
}
.sidebar-dark {
  background: var(--surface-alt);
  color: #fff;
  border-color: transparent;
}
.sidebar-dark .muted { color: rgba(255,255,255,0.7); }
.sidebar-heading {
  margin-bottom: 12px;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
}
.sidebar-story {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}
.sidebar-story:last-child { border-bottom: none; padding-bottom: 0; }
.sidebar-story-media {
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.sidebar-story-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sidebar-story h3 {
  margin: 4px 0 6px;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.3;
}

/* Priority Rail */
.home-priority-rail {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 20px;
  display: grid;
  gap: 12px;
}
.priority-story {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}
.priority-story:last-child { border-bottom: none; padding-bottom: 0; }
.priority-story-media {
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.priority-story-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.priority-story h3 {
  margin: 4px 0 6px;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.25;
}

/* Desk Grid */
.home-desk-grid,
.home-category-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.home-desk-card,
.home-category-card {
  display: grid;
  align-content: start;
}

/* Latest Layout */
.home-latest-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.7fr);
  gap: 20px;
  margin-top: 8px;
  margin-bottom: 20px;
}
.home-latest-column {
  display: grid;
  align-content: start;
}
.home-latest-list {
  display: grid;
  gap: 12px;
}
.latest-story {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 14px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  transition: box-shadow 0.2s var(--motion), transform 0.2s var(--motion);
}
.latest-story:hover {
  box-shadow: var(--shadow-2);
  transform: translateY(-1px);
}
.latest-story-media {
  border-radius: var(--radius-sm);
  overflow: hidden;
  aspect-ratio: 16 / 10;
}
.latest-story-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.latest-story-body h3 {
  margin: 4px 0 6px;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
}

/* Categories Panel */
.home-categories-panel {
  background: var(--surface-alt);
  color: #fff;
  padding: 20px;
  border-radius: var(--radius);
  display: grid;
  gap: 14px;
  align-content: start;
}
.home-category-tally { display: grid; gap: 8px; }
.home-category-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  font-size: 0.875rem;
}
.home-category-row:last-child { border-bottom: none; padding-bottom: 0; }
.home-category-row span,
.home-category-note { color: rgba(255,255,255,0.7); }
.sidebar-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  color: var(--primary);
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.85rem;
  transition: color 0.2s var(--motion);
}
.sidebar-link:hover { color: var(--primary-hover); }
.sidebar-dark .sidebar-link { color: #8ab4f8; }
.snippet-note {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}
.source-credit {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-light);
  display: grid;
  gap: 8px;
}
.source-line {
  color: var(--muted);
  font-size: 0.8rem;
}
.source-line strong { color: var(--text); }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  background: #e8f0fe;
  color: var(--primary);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
}
.risk-high { background: #fce8e6; color: var(--danger); }
.risk-medium { background: #fef7e0; color: #e37400; }
.risk-low { background: #e6f4ea; color: var(--success); }

/* ============================================================
   AUTH PAGES
   ============================================================ */
.auth-wrap {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 160px);
}
.auth-card {
  width: min(880px, 100%);
  padding: 24px;
}
.auth-grid { align-items: start; }
.auth-side {
  background: var(--surface-alt);
  color: #fff;
  border-radius: var(--radius);
  padding: 24px;
}

/* ============================================================
   FORMS — Material Outlined
   ============================================================ */
.form-stack { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field label {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.8rem;
  color: var(--muted);
}
.field input, .field textarea, .field select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font: inherit;
  font-size: 0.9rem;
  background: var(--surface);
  min-height: 48px;
  transition: border-color 0.2s var(--motion), box-shadow 0.2s var(--motion);
  outline: none;
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-container);
}
.field textarea { min-height: 100px; resize: vertical; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.2s var(--motion);
}
.check-row:hover { background: #f1f3f4; }
.admin-user-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

/* ============================================================
   RSS & ADMIN
   ============================================================ */
.rss-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rss-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  background: var(--surface);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.rss-card.is-deleting {
  opacity: 0.4;
  transform: scale(0.98);
  pointer-events: none;
}
.logo-preview {
  margin-top: 8px;
  width: 64px; height: 64px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-light);
  background: #f1f3f4;
}
.logo-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.admin-user-row select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font: inherit;
  font-size: 0.875rem;
  background: var(--surface);
  outline: none;
  transition: border-color 0.2s var(--motion);
}
.admin-user-row select:focus { border-color: var(--primary); }

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 0 24px;
  color: var(--muted);
  font-size: 0.8rem;
}

/* ============================================================
   MOBILE BOTTOM NAV — Material 3 Navigation Bar
   ============================================================ */
.mobile-bottom-nav { display: none; }
.mobile-bottom-link {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 56px;
  border-radius: 0;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-decoration: none;
  position: relative;
  transition: color 0.2s var(--motion);
}
.mobile-bottom-link svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: all 0.2s var(--motion);
}
.mobile-bottom-link.active {
  color: var(--primary);
}
.mobile-bottom-link.active::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 56px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--primary-container);
  z-index: -1;
}
.mobile-bottom-link.active svg {
  stroke: var(--primary);
  fill: var(--primary-container);
}

/* ============================================================
   TABLE-LIKE
   ============================================================ */
.table-like { display: grid; gap: 10px; }
.table-row {
  display: grid;
  grid-template-columns: 1.5fr 0.7fr 0.8fr;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
  align-items: center;
}
.table-row:last-child { border-bottom: none; }

/* ============================================================
   CHANGELOG
   ============================================================ */
.changelog-list { display: grid; gap: 12px; }
.changelog-item {
  padding: 16px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  background: var(--surface);
}
.changelog-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

/* ============================================================
   RESPONSIVE — Tablet (≤1024px)
   ============================================================ */
@media (max-width: 1024px) {
  .home-desk-grid,
  .home-category-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .grid-3, .stats-grid, .cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ============================================================
   RESPONSIVE — Mobile (≤768px)
   ============================================================ */
@media (max-width: 768px) {
  .topbar {
    width: 100%;
    margin: 0;
    padding: 8px 16px;
    gap: 8px;
    background: var(--surface);
    border-bottom: 1px solid var(--border-light);
    border-radius: 0;
    flex-wrap: wrap;
  }
  .brand { flex: 1; min-width: 0; }
  .brand-mark { width: 36px; height: 36px; border-radius: var(--radius-sm); }
  .brand-text { font-size: 1.05rem; }
  .brand-tagline { font-size: 0.6rem; }
  .topbar-actions { flex-shrink: 0; }
  .topbar-actions .btn { padding: 8px 14px; min-height: 36px; font-size: 0.8rem; }

  .main-nav {
    order: 3;
    width: 100%;
    gap: 6px;
    padding-bottom: 2px;
  }
  .main-nav a {
    flex: 0 0 auto;
    padding: 6px 14px;
    min-height: 32px;
    font-size: 0.8rem;
    background: var(--surface);
    border: 1px solid var(--border-light);
  }
  .main-nav a.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
  }

  .page, .footer { width: calc(100% - 16px); }
  .page { padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }

  .user-chip, .metric-chip {
    padding: 4px 10px;
    font-size: 0.72rem;
  }

  /* Cards go edge-to-edge */
  .hero, .panel, .auth-card, .stat-card, .list-card,
  .lead-story, .sidebar-block, .home-stats-bar,
  .home-priority-rail, .home-categories-panel,
  .latest-story, .home-ribbon {
    border-radius: var(--radius-sm);
  }

  .hero, .grid-3, .grid-2, .stats-grid, .auth-grid, .cards-grid,
  .table-row, .home-frontpage, .home-desk-grid, .home-category-grid,
  .home-latest-layout, .home-layout, .rss-list {
    grid-template-columns: 1fr;
  }

  .home-ribbon {
    flex-direction: column;
    align-items: stretch;
  }
  .home-ribbon-label { text-align: center; }

  .home-stats-bar {
    grid-template-columns: 1fr 1fr;
  }
  .home-stat {
    border-right: none;
    border-bottom: 1px solid var(--border-light);
    padding: 12px 16px;
  }
  .home-stat:last-child { border-bottom: none; }

  .sidebar-story, .priority-story {
    grid-template-columns: 80px 1fr;
    gap: 10px;
  }
  .sidebar-story h3 { font-size: 0.85rem; margin: 2px 0 4px; }
  .priority-story h3 { font-size: 0.88rem; margin: 2px 0 4px; }

  .latest-story {
    grid-template-columns: 100px 1fr;
    gap: 10px;
    padding: 12px;
  }
  .latest-story-body h3 { font-size: 0.9rem; }

  .lead-story-body { padding: 16px; }
  .lead-story-body h1 {
    font-size: clamp(1.3rem, 5.5vw, 1.8rem);
    line-height: 1.2;
  }
  .lead-story-featured .lead-story-media { min-height: 220px; }

  .section-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin: 20px 0 10px;
  }
  .section-head h2 { font-size: 1.15rem; }

  .topbar, .footer { flex-direction: column; align-items: flex-start; }
  .admin-user-actions { flex-direction: column; justify-content: stretch; }

  .list-card-media {
    margin: -20px -20px 12px;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  }

  .home-search { grid-template-columns: 1fr; }
  .home-search input { min-height: 44px; }

  .field label { font-size: 0.78rem; }
  .field input, .field textarea, .field select { min-height: 44px; padding: 10px 12px; }
  .check-row { padding: 10px 12px; }

  .actions .btn { flex: 1 1 100%; }

  /* Mobile Bottom Nav */
  .mobile-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 80;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    padding: 4px 8px;
    padding-bottom: calc(4px + env(safe-area-inset-bottom, 0px));
    background: var(--surface);
    border-top: 1px solid var(--border-light);
    box-shadow: 0 -2px 8px rgba(60,64,67,0.1);
  }
  .mobile-bottom-link { min-height: 52px; }
  .mobile-bottom-link.active::before {
    top: 4px;
    width: 48px;
    height: 24px;
  }

  .footer {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    font-size: 0.75rem;
  }
}

/* ============================================================
   RESPONSIVE — Small phone (≤480px)
   ============================================================ */
@media (max-width: 480px) {
  .topbar { padding: 6px 12px; }
  .brand-mark { width: 32px; height: 32px; }
  .brand-text { font-size: 0.95rem; }
  .brand-tagline { display: none; }

  .page, .footer { width: calc(100% - 12px); }

  .main-nav a { padding: 5px 10px; font-size: 0.75rem; min-height: 28px; }

  .home-ribbon-label { font-size: 0.68rem; padding: 8px 12px; }
  .home-ribbon-text { font-size: 0.82rem; padding: 8px 12px; }

  .lead-story-body h1 { font-size: 1.2rem; }
  .lead-story-body { padding: 12px; }

  .home-stat-value { font-size: 1.4rem; }
  .home-stats-bar { grid-template-columns: 1fr; }

  .stat-card, .list-card, .panel { padding: 14px; }
  .list-card-media { margin: -14px -14px 10px; }

  .sidebar-story, .priority-story { grid-template-columns: 72px 1fr; }

  .latest-story { grid-template-columns: 80px 1fr; gap: 8px; padding: 10px; }
  .latest-story-body h3 { font-size: 0.85rem; }

  .mobile-bottom-link { font-size: 0.62rem; min-height: 48px; }
  .mobile-bottom-link svg { width: 20px; height: 20px; }
  .mobile-bottom-link.active::before { width: 40px; height: 22px; top: 2px; }

  .btn { padding: 8px 16px; font-size: 0.8rem; min-height: 36px; }
  .source-line, .muted { font-size: 0.78rem; }
  .metric-chip { font-size: 0.68rem; padding: 3px 8px; }
}
