/* ============================================================
   PeopleGov — Social-Media Civic Platform
   Light Mode · Facebook-inspired layout · Civic Blue/Green
   Font: Inter  |  Mobile-first responsive
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg-body:        #f0f2f5;
  --bg-card:        #ffffff;
  --bg-card-hover:  #f8f9fa;
  --bg-input:       #f0f2f5;
  --bg-nav:         #ffffff;
  --bg-nav-dark:    #1a3a5c;

  /* Text */
  --text-primary:   #050c1a;
  --text-secondary: #4b5563;
  --text-muted:     #9ca3af;
  --text-link:      #1a56e8;

  /* Brand colors */
  --blue:           #1a56e8;
  --blue-light:     #dbeafe;
  --blue-dark:      #1240c0;
  --green:          #059669;
  --green-light:    #d1fae5;
  --orange:         #d97706;
  --orange-light:   #fef3c7;
  --red:            #dc2626;
  --red-light:      #fee2e2;
  --purple:         #7c3aed;
  --purple-light:   #ede9fe;
  --teal:           #0891b2;

  /* Borders */
  --border:         #e5e7eb;
  --border-focus:   #1a56e8;

  /* Shadows */
  --shadow-sm:      0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:      0 4px 16px rgba(0,0,0,0.1);
  --shadow-lg:      0 8px 32px rgba(0,0,0,0.12);
  --shadow-card:    0 1px 2px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.04);

  /* Radii */
  --r-sm:  6px;
  --r-md:  10px;
  --r-lg:  14px;
  --r-xl:  20px;
  --r-full: 9999px;

  /* Layout */
  --nav-h:     60px;
  --content-w: 1200px;
  --feed-w:    680px;
  --side-w:    320px;

  /* Transitions */
  --t: 0.18s cubic-bezier(.4,0,.2,1);
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img, video { display: block; max-width: 100%; }
input, textarea, select, button { font-family: inherit; }
ul { list-style: none; }

/* ── Navbar ─────────────────────────────────────────────────── */
.navbar {
  height: var(--nav-h);
  background: var(--bg-nav);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0; z-index: 500;
  box-shadow: var(--shadow-sm);
}
.nav-inner {
  max-width: var(--content-w);
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
}

/* Logo */
.nav-logo {
  display: flex; align-items: center; gap: 8px;
  font-size: 1.15rem; font-weight: 800;
  color: var(--blue);
  flex-shrink: 0;
  letter-spacing: -.02em;
}
.nav-logo-icon {
  width: 34px; height: 34px;
  background: var(--blue);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: .85rem;
  font-weight: 900;
  flex-shrink: 0;
}

/* Search */
.nav-search {
  flex: 1; max-width: 360px;
  position: relative;
}
.nav-search input {
  width: 100%;
  background: var(--bg-input);
  border: 1.5px solid transparent;
  border-radius: var(--r-full);
  padding: 8px 16px 8px 40px;
  font-size: .875rem;
  color: var(--text-primary);
  transition: all var(--t);
}
.nav-search input:focus {
  outline: none;
  border-color: var(--border-focus);
  background: white;
  box-shadow: 0 0 0 3px rgba(26,86,232,.1);
}
.nav-search input::placeholder { color: var(--text-muted); }
.nav-search-icon {
  position: absolute;
  left: 13px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  width: 16px; height: 16px;
}

/* Nav links */
.nav-links {
  display: flex; align-items: center; gap: 2px;
  margin-left: auto;
}
.nav-link {
  display: flex; flex-direction: column; align-items: center;
  padding: 6px 16px;
  border-radius: var(--r-md);
  color: var(--text-muted);
  font-size: .75rem; font-weight: 500;
  gap: 2px;
  transition: all var(--t);
  border-bottom: 3px solid transparent;
}
.nav-link svg { width: 22px; height: 22px; }
.nav-link:hover { color: var(--blue); background: var(--blue-light); }
.nav-link.active { color: var(--blue); border-bottom-color: var(--blue); }

/* Nav CTA */
.nav-cta {
  display: flex; align-items: center; gap: 8px; margin-left: 8px;
}
.nav-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--blue);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700;
  cursor: pointer;
  position: relative;
}
.nav-dropdown {
  position: absolute;
  top: calc(100% + 8px); right: 0;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  padding: 6px;
  display: none;
  z-index: 600;
}
.nav-avatar:hover .nav-dropdown,
.nav-avatar:focus-within .nav-dropdown { display: block; }
.nav-dropdown a, .nav-dropdown button {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r-md);
  font-size: .875rem;
  color: var(--text-primary);
  width: 100%;
  background: none; border: none; cursor: pointer;
  text-align: left;
  transition: background var(--t);
}
.nav-dropdown a:hover, .nav-dropdown button:hover { background: var(--bg-body); }
.nav-dropdown svg { width: 16px; height: 16px; color: var(--text-muted); }
.nav-dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* Mobile hamburger */
.nav-hamburger {
  display: none;
  background: none; border: none; cursor: pointer;
  padding: 6px; border-radius: var(--r-sm);
  color: var(--text-secondary);
}
.nav-hamburger svg { width: 22px; height: 22px; }

/* ── Page Layout ─────────────────────────────────────────────── */
.page-wrap {
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 20px;
  display: grid;
  grid-template-columns: 1fr var(--side-w);
  gap: 20px;
  align-items: start;
}
.page-wrap.full-width {
  grid-template-columns: 1fr;
  max-width: 860px;
}
.page-wrap.three-col {
  grid-template-columns: 220px 1fr 280px;
}

.main-feed { width: 100%; }
.sidebar-right { display: flex; flex-direction: column; gap: 14px; }

/* ── Hero Stats Strip ─────────────────────────────────────────── */
.hero-strip {
  background: linear-gradient(135deg, #1a3a5c 0%, #1a56e8 60%, #059669 100%);
  padding: 32px 20px;
  margin-bottom: 0;
}
.hero-inner {
  max-width: var(--content-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.hero-text h1 {
  font-size: 1.6rem;
  font-weight: 800;
  color: white;
  line-height: 1.2;
  margin-bottom: 6px;
}
.hero-text p {
  color: rgba(255,255,255,.75);
  font-size: .9rem;
}
.hero-stats {
  display: flex; gap: 24px; flex-wrap: wrap;
}
.hero-stat {
  text-align: center; color: white;
}
.hero-stat-num {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1;
  display: block;
}
.hero-stat-label {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  opacity: .75;
  margin-top: 2px;
  display: block;
}
.hero-cta {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
}

/* ── Category Pills ───────────────────────────────────────────── */
.category-bar {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  overflow-x: auto;
  scrollbar-width: none;
  position: sticky;
  top: var(--nav-h);
  z-index: 40;
  box-shadow: var(--shadow-sm);
}
.category-bar::-webkit-scrollbar { display: none; }
.category-pills {
  max-width: var(--content-w);
  margin: 0 auto;
  display: flex;
  gap: 4px;
  padding: 10px 0;
}
.cat-pill {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px;
  border-radius: var(--r-full);
  font-size: .8rem; font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  border: 1.5px solid transparent;
  background: var(--bg-input);
  color: var(--text-secondary);
  transition: all var(--t);
  text-decoration: none;
}
.cat-pill:hover { background: var(--blue-light); color: var(--blue); border-color: var(--blue); }
.cat-pill.active { background: var(--blue); color: white; }
.cat-pill-emoji { font-size: .85rem; }

/* ── Feed Sort Bar ────────────────────────────────────────────── */
.feed-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.sort-tabs {
  display: flex; gap: 2px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 4px;
}
.sort-tab {
  padding: 6px 14px;
  border-radius: var(--r-md);
  font-size: .8rem; font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--t);
  text-decoration: none;
  border: none; background: none;
}
.sort-tab.active, .sort-tab:hover {
  background: var(--blue);
  color: white;
}
.feed-count {
  font-size: .8rem;
  color: var(--text-muted);
}

/* ── Issue Card (Social Style) ───────────────────────────────── */
.issue-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  margin-bottom: 12px;
  box-shadow: var(--shadow-card);
  transition: all var(--t);
  overflow: hidden;
}
.issue-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); border-color: #d1d5db; }

/* Card header (author info) */
.ic-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px 0;
}
.ic-avatar {
  width: 42px; height: 42px; flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--teal));
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem; font-weight: 700; color: white;
  border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.ic-author-block { flex: 1; }
.ic-author-name {
  font-size: .875rem; font-weight: 700;
  color: var(--text-primary);
  display: flex; align-items: center; gap: 6px;
}
.ic-role-chip {
  font-size: .65rem; font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--r-full);
  text-transform: uppercase; letter-spacing: .05em;
}
.ic-meta-row {
  font-size: .75rem; color: var(--text-muted);
  display: flex; align-items: center; gap: 6px; margin-top: 1px;
}
.ic-meta-row svg { width: 12px; height: 12px; }
.ic-menu-btn {
  width: 32px; height: 32px;
  border-radius: 50%; border: none; background: none;
  cursor: pointer; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  transition: background var(--t); flex-shrink: 0;
}
.ic-menu-btn:hover { background: var(--bg-input); }
.ic-menu-btn svg { width: 18px; height: 18px; }

/* Card body */
.ic-body { padding: 10px 16px 0; }
.ic-status-row {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 8px; flex-wrap: wrap;
}
.ic-title {
  font-size: 1rem; font-weight: 700;
  color: var(--text-primary);
  line-height: 1.4; margin-bottom: 6px;
  text-decoration: none;
  display: block;
}
.ic-title:hover { color: var(--blue); }
.ic-desc {
  font-size: .875rem; color: var(--text-secondary);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 10px;
}

/* Card image */
.ic-image {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  display: block;
  background: var(--bg-input);
}
.ic-image-wrap {
  margin: 0 0 0;
  overflow: hidden;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

/* Engagement counts (above action bar) */
.ic-counts {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 16px;
  font-size: .78rem; color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.ic-counts-left { display: flex; align-items: center; gap: 4px; }
.ic-like-icon {
  width: 18px; height: 18px;
  background: var(--blue);
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: white; font-size: .55rem;
  margin-right: 2px;
}

/* Action bar */
.ic-actions {
  display: flex;
  padding: 2px 8px;
}
.ic-action-btn {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 4px;
  border: none; background: none; cursor: pointer;
  font-size: .83rem; font-weight: 600;
  color: var(--text-secondary);
  border-radius: var(--r-md);
  transition: all var(--t);
}
.ic-action-btn:hover { background: var(--bg-input); color: var(--blue); }
.ic-action-btn svg { width: 18px; height: 18px; }
.ic-action-btn.voted { color: var(--blue); }
.ic-action-btn.followed { color: var(--green); }

/* ── Sidebar Widgets ──────────────────────────────────────────── */
.widget {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.widget-header {
  padding: 14px 16px 10px;
  font-size: .875rem;
  font-weight: 800;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.widget-header a { font-size: .75rem; font-weight: 600; color: var(--blue); }
.widget-header a:hover { text-decoration: underline; }

/* Trending item */
.trend-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  transition: background var(--t);
  text-decoration: none;
  color: inherit;
}
.trend-item:last-child { border-bottom: none; }
.trend-item:hover { background: var(--bg-body); }
.trend-num {
  font-size: .75rem; font-weight: 800;
  color: var(--text-muted); min-width: 18px; padding-top: 2px;
}
.trend-content { flex: 1; }
.trend-title { font-size: .83rem; font-weight: 600; line-height: 1.3; color: var(--text-primary); margin-bottom: 2px; }
.trend-meta { font-size: .72rem; color: var(--text-muted); }

/* Leader item */
.leader-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--border);
  transition: background var(--t);
}
.leader-item:last-child { border-bottom: none; }
.leader-rank {
  font-size: .72rem; font-weight: 800;
  color: var(--text-muted); min-width: 20px; text-align: center;
}
.rank-1 { color: #f59e0b; }
.rank-2 { color: #9ca3af; }
.rank-3 { color: #cd7f32; }
.leader-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), var(--blue));
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700; color: white;
  flex-shrink: 0;
}
.leader-info { flex: 1; }
.leader-name { font-size: .83rem; font-weight: 600; }
.leader-role { font-size: .7rem; color: var(--text-muted); }
.leader-score {
  font-size: .83rem; font-weight: 700; color: var(--blue);
}

/* Petition widget */
.pet-item {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}
.pet-item:last-child { border-bottom: none; }
.pet-title { font-size: .83rem; font-weight: 600; margin-bottom: 4px; }
.pet-progress-wrap {
  height: 5px;
  background: var(--bg-input);
  border-radius: var(--r-full);
  overflow: hidden; margin-bottom: 4px;
}
.pet-progress-bar {
  height: 100%; background: var(--green);
  border-radius: var(--r-full);
  transition: width .6s ease;
}
.pet-meta { font-size: .7rem; color: var(--text-muted); }

/* ── Status / Priority Badges ─────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px;
  border-radius: var(--r-full);
  font-size: .7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  white-space: nowrap;
}
.badge-reported  { background: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0; }
.badge-review    { background: var(--orange-light); color: var(--orange); border: 1px solid #fcd34d; }
.badge-progress  { background: var(--blue-light); color: var(--blue); border: 1px solid #93c5fd; }
.badge-resolved  { background: var(--green-light); color: var(--green); border: 1px solid #6ee7b7; }
.badge-merged    { background: var(--purple-light); color: var(--purple); border: 1px solid #c4b5fd; }
.badge-closed    { background: #f1f5f9; color: #9ca3af; border: 1px solid #e2e8f0; }
.priority-critical { background: var(--red-light); color: var(--red); border: 1px solid #fca5a5; }
.priority-high    { background: var(--orange-light); color: var(--orange); border: 1px solid #fcd34d; }
.priority-medium  { background: var(--blue-light); color: var(--blue); border: 1px solid #93c5fd; }
.priority-low     { background: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0; }
.role-admin    { background: #fef3c7; color: #92400e; }
.role-moderator { background: #ede9fe; color: #5b21b6; }
.role-leader   { background: var(--green-light); color: #065f46; }
.role-trusted  { background: var(--blue-light); color: var(--blue-dark); }
.role-citizen  { background: #f1f5f9; color: #374151; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px;
  border-radius: var(--r-md);
  font-size: .875rem; font-weight: 700;
  cursor: pointer; border: none;
  transition: all var(--t);
  white-space: nowrap; text-decoration: none;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary {
  background: var(--blue);
  color: white;
  box-shadow: 0 2px 8px rgba(26,86,232,.3);
}
.btn-primary:hover { background: var(--blue-dark); box-shadow: 0 4px 12px rgba(26,86,232,.4); transform: translateY(-1px); }
.btn-secondary {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover { background: #e5e7eb; border-color: #9ca3af; }
.btn-ghost { background: none; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-input); color: var(--text-primary); }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--blue);
  color: var(--blue);
}
.btn-outline:hover { background: var(--blue); color: white; }
.btn-green { background: var(--green); color: white; }
.btn-green:hover { background: #047857; transform: translateY(-1px); }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 6px 12px; font-size: .8rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-xs { padding: 4px 10px; font-size: .75rem; }
.btn-block { width: 100%; justify-content: center; }
.btn-round { border-radius: var(--r-full); }

/* ── Forms ───────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.form-label {
  font-size: .8rem; font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: .05em;
}
.form-control {
  background: white;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-primary);
  padding: 10px 14px;
  font-size: .9rem;
  transition: all var(--t);
  width: 100%;
}
.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(26,86,232,.1);
}
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 90px; }
select.form-control { cursor: pointer; }
.form-hint { font-size: .75rem; color: var(--text-muted); }
.form-error { font-size: .75rem; color: var(--red); font-weight: 500; }

/* ── Alert Boxes ─────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--r-md);
  font-size: .875rem;
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px; font-weight: 500;
}
.alert svg { width: 18px; height: 18px; flex-shrink: 0; }
.alert-error   { background: var(--red-light);    color: var(--red);    border: 1px solid #fca5a5; }
.alert-success { background: var(--green-light);  color: var(--green);  border: 1px solid #6ee7b7; }
.alert-info    { background: var(--blue-light);   color: var(--blue);   border: 1px solid #93c5fd; }
.alert-warning { background: var(--orange-light); color: var(--orange); border: 1px solid #fcd34d; }

/* ── Auth pages ─────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  background: var(--bg-body);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.auth-card {
  width: 100%; max-width: 440px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 36px;
  box-shadow: var(--shadow-lg);
  animation: fadeUp .35s ease;
}
.auth-logo {
  display: flex; align-items: center; gap: 10px;
  justify-content: center; margin-bottom: 24px;
}
.auth-logo-icon {
  width: 42px; height: 42px;
  background: var(--blue);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; font-weight: 900; color: white;
}
.auth-logo-text { font-size: 1.3rem; font-weight: 800; color: var(--blue); }
.auth-title { font-size: 1.4rem; font-weight: 800; text-align: center; margin-bottom: 4px; }
.auth-sub { font-size: .875rem; color: var(--text-secondary); text-align: center; margin-bottom: 24px; }
.auth-link { color: var(--blue); font-weight: 600; }
.auth-link:hover { text-decoration: underline; }
.auth-footer { text-align: center; font-size: .875rem; color: var(--text-secondary); margin-top: 20px; }
.auth-divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--text-muted); font-size: .8rem; margin: 16px 0;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ── Auth Gate Modal ──────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(3px);
  z-index: 900;
  display: flex; align-items: flex-end;
  justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal-sheet {
  background: white;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  width: 100%; max-width: 540px;
  padding: 28px 28px 36px;
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 -8px 40px rgba(0,0,0,.15);
}
.modal-overlay.open .modal-sheet { transform: translateY(0); }
.modal-handle {
  width: 40px; height: 4px;
  background: var(--border); border-radius: var(--r-full);
  margin: 0 auto 20px;
}
.modal-title { font-size: 1.25rem; font-weight: 800; margin-bottom: 4px; }
.modal-sub { font-size: .875rem; color: var(--text-secondary); margin-bottom: 20px; }
.modal-actions { display: flex; flex-direction: column; gap: 10px; }

/* ── Issue Detail Page ─────────────────────────────────────────── */
.detail-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 20px;
  align-items: start;
}

.detail-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.detail-card-body { padding: 20px; }

/* Comment thread */
.comment-form-wrap {
  display: flex; gap: 10px; padding: 14px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-body);
}
.comment-input-avatar {
  width: 36px; height: 36px; flex-shrink: 0;
  border-radius: 50%;
  background: var(--blue);
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700; color: white;
}
.comment-input-wrap { flex: 1; }
.comment-input {
  width: 100%;
  background: white;
  border: 1.5px solid var(--border);
  border-radius: var(--r-full);
  padding: 8px 16px;
  font-size: .875rem;
  transition: all var(--t);
}
.comment-input:focus {
  outline: none; border-color: var(--border-focus);
  border-radius: var(--r-lg);
  box-shadow: 0 0 0 3px rgba(26,86,232,.1);
}

.comment {
  display: flex; gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  animation: fadeIn .2s ease;
}
.comment:last-child { border-bottom: none; }
.comment-avatar {
  width: 36px; height: 36px; flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--teal));
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700; color: white;
}
.comment-bubble {
  background: var(--bg-body);
  border-radius: 0 var(--r-lg) var(--r-lg) var(--r-lg);
  padding: 10px 14px; flex: 1;
}
.comment-name { font-size: .8rem; font-weight: 700; margin-bottom: 3px; }
.comment-text { font-size: .875rem; color: var(--text-secondary); line-height: 1.5; }
.comment-time { font-size: .7rem; color: var(--text-muted); margin-top: 4px; }

/* Timeline */
.timeline { position: relative; padding-left: 28px; }
.timeline::before {
  content: ''; position: absolute;
  left: 10px; top: 4px; bottom: 4px;
  width: 2px; background: var(--border);
}
.tl-item { position: relative; margin-bottom: 18px; }
.tl-dot {
  position: absolute; left: -28px; top: 3px;
  width: 14px; height: 14px; border-radius: 50%;
  background: white; border: 2px solid var(--blue);
  box-shadow: 0 0 0 3px rgba(26,86,232,.1);
}
.tl-title { font-size: .875rem; font-weight: 600; }
.tl-desc { font-size: .8rem; color: var(--text-secondary); margin-top: 2px; }
.tl-meta { font-size: .7rem; color: var(--text-muted); margin-top: 3px; }

/* Tabs */
.tabs {
  display: flex; border-bottom: 1.5px solid var(--border);
  background: white; gap: 0;
}
.tab-btn {
  padding: 12px 20px;
  font-size: .875rem; font-weight: 600;
  color: var(--text-muted);
  border: none; background: none; cursor: pointer;
  border-bottom: 2.5px solid transparent;
  margin-bottom: -1.5px;
  transition: all var(--t);
}
.tab-btn.active { color: var(--blue); border-bottom-color: var(--blue); }
.tab-btn:hover:not(.active) { color: var(--text-primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Progress bar */
.progress-wrap { background: var(--bg-input); border-radius: var(--r-full); height: 6px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--green); border-radius: var(--r-full); transition: width .6s ease; }

/* ── Pagination ──────────────────────────────────────────────── */
.pagination {
  display: flex; align-items: center; gap: 4px;
  justify-content: center; margin: 24px 0;
}
.page-btn {
  width: 36px; height: 36px;
  border-radius: var(--r-md);
  background: white; border: 1.5px solid var(--border);
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  font-size: .875rem; font-weight: 600;
  cursor: pointer; transition: all var(--t); text-decoration: none;
}
.page-btn:hover { border-color: var(--blue); color: var(--blue); }
.page-btn.active { background: var(--blue); color: white; border-color: var(--blue); }

/* ── Leaderboard Page ────────────────────────────────────────── */
.lb-table {
  background: white; border: 1px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-card);
}
.lb-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  transition: background var(--t);
}
.lb-row:last-child { border-bottom: none; }
.lb-row:hover { background: var(--bg-body); }
.lb-rank { font-size: 1rem; font-weight: 800; min-width: 32px; text-align: center; }
.lb-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--teal));
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem; font-weight: 700; color: white;
  flex-shrink: 0;
}
.lb-info { flex: 1; }
.lb-name { font-size: .925rem; font-weight: 700; }
.lb-role { font-size: .75rem; color: var(--text-muted); }
.lb-score { font-size: 1rem; font-weight: 800; color: var(--blue); }
.lb-issues { font-size: .75rem; color: var(--text-muted); }

/* ── Toast Notifications ─────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px; z-index: 9999;
}
.toast {
  padding: 12px 18px;
  border-radius: var(--r-md);
  font-size: .875rem; font-weight: 600;
  display: flex; align-items: center; gap: 10px;
  box-shadow: var(--shadow-lg); min-width: 260px;
  animation: slideRight .3s ease;
  cursor: pointer;
}
.toast-success { background: var(--green); color: white; }
.toast-error   { background: var(--red);   color: white; }
.toast-info    { background: var(--blue);  color: white; }
.toast svg { width: 16px; height: 16px; }

/* ── Empty State ──────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 48px 24px;
  color: var(--text-muted);
  background: white; border-radius: var(--r-lg);
  border: 1px dashed var(--border);
}
.empty-state-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state h3 { font-size: 1rem; font-weight: 700; color: var(--text-secondary); margin-bottom: 4px; }
.empty-state p { font-size: .875rem; }

/* ── Page Section Header ──────────────────────────────────────── */
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.section-head h2 { font-size: 1.1rem; font-weight: 800; }
.section-head a { font-size: .8rem; color: var(--blue); font-weight: 600; }
.section-head a:hover { text-decoration: underline; }

/* ── Footer ──────────────────────────────────────────────────── */
.site-footer {
  background: white;
  border-top: 1px solid var(--border);
  padding: 24px 20px;
  margin-top: 40px;
}
.footer-inner {
  max-width: var(--content-w); margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.footer-brand { font-size: .9rem; font-weight: 700; color: var(--blue); }
.footer-links { display: flex; gap: 16px; }
.footer-links a { font-size: .8rem; color: var(--text-muted); transition: color var(--t); }
.footer-links a:hover { color: var(--blue); }
.footer-copy { font-size: .75rem; color: var(--text-muted); width: 100%; text-align: center; margin-top: 8px; }

/* ── Spinner ──────────────────────────────────────────────────── */
.spinner {
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255,255,255,.35);
  border-top-color: white;
  border-radius: 50%; animation: spin .6s linear infinite; display: inline-block;
}
.spinner-blue {
  border-color: rgba(26,86,232,.2);
  border-top-color: var(--blue);
}

/* ── Utility ──────────────────────────────────────────────────── */
.d-flex       { display: flex; }
.ai-center    { align-items: center; }
.jc-between   { justify-content: space-between; }
.gap-4  { gap: 4px; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mb-8   { margin-bottom: 8px; }
.mb-12  { margin-bottom: 12px; }
.mb-16  { margin-bottom: 16px; }
.mb-20  { margin-bottom: 20px; }
.mt-8   { margin-top: 8px; }
.mt-12  { margin-top: 12px; }
.mt-16  { margin-top: 16px; }
.p-12   { padding: 12px; }
.p-16   { padding: 16px; }
.p-20   { padding: 20px; }
.text-muted  { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-blue   { color: var(--blue); }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-sm     { font-size: .875rem; }
.text-xs     { font-size: .75rem; }
.text-xxs    { font-size: .7rem; }
.font-bold   { font-weight: 700; }
.font-semibold { font-weight: 600; }
.w-full      { width: 100%; }
.truncate    { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card        { background: white; border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-card); }
.card-body   { padding: 16px; }
.sticky-top  { position: sticky; top: calc(var(--nav-h) + 12px); }

/* ── Attachment Gallery Grid ─────────────────────────────────── */
.attachment-grid {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 0 12px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.attachment-thumb {
  width: 90px;
  height: 90px;
  border-radius: var(--r-md);
  overflow: hidden;
  flex-shrink: 0;
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-body);
  position: relative;
  transition: all var(--t);
  text-decoration: none;
  cursor: pointer;
}
.attachment-thumb:hover {
  border-color: var(--blue);
  transform: translateY(-2px) scale(1.03);
  box-shadow: var(--shadow-sm);
}
.attachment-thumb img,
.attachment-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.video-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  color: white;
  font-size: 1.25rem;
  font-weight: 700;
  transition: background var(--t);
}
.attachment-thumb:hover .video-overlay {
  background: rgba(0, 0, 0, 0.45);
}

/* ── Animations ───────────────────────────────────────────────── */
@keyframes fadeUp { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:translateY(0); } }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
@keyframes slideRight { from { opacity:0; transform:translateX(20px); } to { opacity:1; transform:translateX(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes likePop { 0%{transform:scale(1)} 40%{transform:scale(1.35)} 70%{transform:scale(.9)} 100%{transform:scale(1)} }
.like-pop { animation: likePop .35s ease; }

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .page-wrap { grid-template-columns: 1fr; }
  .sidebar-right { display: none; }
  .detail-wrap { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .nav-search { display: none; }
  .nav-link span { display: none; }
  .hero-inner { flex-direction: column; text-align: center; }
  .hero-stats { justify-content: center; }
  .page-wrap { padding: 12px; }
  .auth-card { padding: 24px; }
  .modal-sheet { padding: 20px 20px 32px; }
}
@media (max-width: 480px) {
  .hero-text h1 { font-size: 1.3rem; }
  .ic-actions { gap: 0; }
  .ic-action-btn { font-size: .75rem; }
  .hero-stats { gap: 16px; }
}
