/* style.css — LinkSwap Design System */

/* ═══ TOKENS ═══ */
:root {
  --text-xs:   clamp(0.75rem,  0.7rem  + 0.25vw, 0.875rem);
  --text-sm:   clamp(0.875rem, 0.8rem  + 0.35vw, 1rem);
  --text-base: clamp(1rem,     0.9rem  + 0.5vw,  1.125rem);
  --text-lg:   clamp(1.125rem, 0.95rem + 0.85vw, 1.5rem);
  --text-xl:   clamp(1.5rem,   1rem    + 1.5vw,  2.25rem);
  --text-2xl:  clamp(2rem,     1.2rem  + 2.5vw,  3.5rem);

  --space-1: 0.25rem; --space-2: 0.5rem; --space-3: 0.75rem;
  --space-4: 1rem; --space-5: 1.25rem; --space-6: 1.5rem;
  --space-8: 2rem; --space-10: 2.5rem; --space-12: 3rem;
  --space-16: 4rem; --space-20: 5rem; --space-24: 6rem;

  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body: 'DM Sans', 'Helvetica Neue', sans-serif;
  --font-ui: 'Inter', 'Helvetica Neue', sans-serif;

  --radius-sm: 0.375rem; --radius-md: 0.5rem;
  --radius-lg: 0.75rem; --radius-xl: 1rem; --radius-full: 9999px;

  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);

  --sidebar-w: 240px;
  --sidebar-collapsed: 64px;
  --header-h: 56px;
}

/* ═══ LIGHT MODE (only — no dark mode) ═══ */
:root, [data-theme="light"] {
  --color-bg: #ffffff;
  --color-surface: #ffffff;
  --color-surface-2: #fafafa;
  --color-surface-offset: #F0EFEF;
  --color-surface-offset-2: #e8e7e7;
  --color-surface-dynamic: #e0dfdf;
  --color-divider: #e0dfdf;
  --color-border: #d4d3d3;
  --color-text: #1a1a1a;
  --color-text-muted: #6b6b6b;
  --color-text-faint: #a0a0a0;
  --color-text-inverse: #ffffff;
  --color-primary: #27670D;
  --color-primary-hover: #1e5209;
  --color-primary-active: #163d07;
  --color-primary-highlight: #e6f0e1;
  --color-warning: #964219;
  --color-warning-highlight: #f5e6db;
  --color-error: #a12c7b;
  --color-error-highlight: #f3e0ed;
  --color-notification: #a13544;
  --color-notification-highlight: #f5e0e3;
  --color-orange: #FF6719;
  --color-orange-highlight: #fff0e6;
  --color-success: #27670D;
  --color-success-highlight: #e6f0e1;
  --color-blue: #006494;
  --color-blue-highlight: #e0f0f8;
  --color-purple: #7a39bb;
  --color-purple-highlight: #f0e6f8;
  --color-gold: #d19900;
  --color-gold-highlight: #fdf4dc;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.07);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.10);
}

/* Dark mode removed per user request */

/* ═══ DASHBOARD LAYOUT ═══ */
html, body { height: 100%; overflow: hidden; }

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--header-h) 1fr;
  height: 100dvh;
}

/* ═══ SIDEBAR ═══ */
.sidebar {
  grid-row: 1 / -1;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  z-index: 20;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  height: var(--header-h);
  border-bottom: 1px solid var(--color-divider);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--color-text);
  text-decoration: none;
  white-space: nowrap;
}
.sidebar-logo svg { flex-shrink: 0; }

.sidebar-nav { flex: 1; padding: var(--space-3) var(--space-2); }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all var(--transition-interactive);
  white-space: nowrap;
}
.sidebar-nav a:hover { background: var(--color-surface-offset); color: var(--color-text); }
.sidebar-nav a.active { background: var(--color-primary-highlight); color: var(--color-primary); font-weight: 600; }
.sidebar-nav a svg { width: 20px; height: 20px; flex-shrink: 0; }
.sidebar-nav a .nav-label { overflow: hidden; text-overflow: ellipsis; }

.sidebar-footer {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--color-divider);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

/* ═══ HEADER ═══ */
.header {
  grid-column: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  z-index: 10;
}
.header-left { display: flex; align-items: center; gap: var(--space-4); }
.header-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text);
}
.header-right { display: flex; align-items: center; gap: var(--space-3); }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  transition: all var(--transition-interactive);
  position: relative;
}
.icon-btn:hover { background: var(--color-surface-offset); color: var(--color-text); }
.icon-btn:active { background: var(--color-surface-dynamic); }
.icon-btn svg { width: 20px; height: 20px; }

.notif-badge {
  position: absolute;
  top: 2px; right: 2px;
  width: 16px; height: 16px;
  border-radius: var(--radius-full);
  background: var(--color-notification);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums lining-nums;
}
.notif-badge:empty { display: none; }

.hamburger-btn { display: none; }

/* ═══ MAIN CONTENT ═══ */
.main {
  grid-column: 2;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--space-6);
}

/* ═══ PAGE HEADER ═══ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
  gap: var(--space-3);
}
.page-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-text);
}

/* ═══ STAT CARDS ═══ */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}
.stat-card {
  background: var(--color-surface);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
}
.stat-card .stat-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
  margin-bottom: var(--space-1);
}
.stat-card .stat-value {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  font-variant-numeric: tabular-nums lining-nums;
  color: var(--color-text);
}

/* ═══ BUTTONS ═══ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-5);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--text-sm);
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all var(--transition-interactive);
  border: none;
  white-space: nowrap;
  min-height: 36px;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  position: relative;
}
.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: 0 0 16px rgba(39, 103, 13, 0);
  transition: box-shadow var(--transition-interactive);
  pointer-events: none;
}
.btn-primary:hover { background: var(--color-primary-hover); transform: translateY(-1px); }
.btn-primary:hover::before { box-shadow: 0 0 20px rgba(39, 103, 13, 0.25); }
.btn-secondary { background: var(--color-surface-dynamic); color: var(--color-text); border: 1px solid var(--color-border); }
.btn-secondary:hover { background: var(--color-surface-offset-2); }
.btn-ghost { background: transparent; color: var(--color-primary); }
.btn-ghost:hover { background: var(--color-primary-highlight); }
.btn-success { background: var(--color-success); color: #fff; }
.btn-success:hover { opacity: 0.9; }
.btn-danger { background: var(--color-notification); color: #fff; }
.btn-danger:hover { opacity: 0.9; }
.btn-sm { padding: var(--space-1) var(--space-3); font-size: var(--text-xs); min-height: 28px; }
.btn svg { width: 16px; height: 16px; }

/* ═══ BADGES / PILLS ═══ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  white-space: nowrap;
}
.badge-open { border: 1.5px solid var(--color-primary); color: var(--color-primary); background: transparent; }
.badge-pending { background: var(--color-orange-highlight); color: var(--color-orange); }
.badge-done { background: var(--color-success); color: #fff; }
.badge-complete { background: var(--color-success); color: #fff; }
.badge-declined { background: var(--color-notification-highlight); color: var(--color-notification); }
.badge-accepted { background: var(--color-success-highlight); color: var(--color-success); }

.topic-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-interactive);
  white-space: nowrap;
}
.topic-pill:hover { opacity: 0.85; }
.topic-pill.active { outline: 2px solid var(--color-primary); outline-offset: 1px; }
.topic-pill.selected { outline: 2px solid var(--color-primary); outline-offset: 1px; background: var(--color-primary-highlight); }
.filter-bar .topic-pill.active { background: var(--color-primary-highlight); color: var(--color-primary); }

/* ═══ CARDS ═══ */
.card {
  background: var(--color-surface);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: transform var(--transition-interactive), box-shadow var(--transition-interactive);
}
.card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.08); }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
  gap: var(--space-4);
}
.card-grid > * { content-visibility: auto; contain-intrinsic-size: 0 200px; }

.card-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.card-title {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.3;
}
.card-meta {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.card-topics {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin: var(--space-3) 0;
}
.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-divider);
}

/* ═══ AVATAR ═══ */
.avatar {
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: var(--text-sm);
  color: #fff;
  flex-shrink: 0;
  text-transform: uppercase;
}
.avatar-sm { width: 28px; height: 28px; font-size: var(--text-xs); }
.avatar-lg { width: 48px; height: 48px; font-size: var(--text-lg); }

/* ═══ FORMS ═══ */
.form-group { margin-bottom: var(--space-4); }
.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: var(--space-1);
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-base);
  transition: border-color var(--transition-interactive);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
  border-color: var(--color-primary);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--color-text-faint); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-select { appearance: auto; }
.form-hint { font-size: var(--text-xs); color: var(--color-text-muted); margin-top: var(--space-1); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }

.checkbox-group {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
}
.checkbox-group input[type="checkbox"],
.checkbox-group input[type="radio"] {
  width: 18px; height: 18px;
  accent-color: var(--color-orange);
  cursor: pointer;
}
/* Custom checkbox: white checkmark on colored background */
.checkbox-group input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border: 2px solid var(--color-border);
  border-radius: 3px;
  background: var(--color-surface);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: all var(--transition-interactive);
}
.checkbox-group input[type="checkbox"]:checked {
  background: var(--color-primary);
  border-color: var(--color-primary);
}
.checkbox-group input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Multi-select pills */
.topic-selector {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}
.topic-selector .topic-pill { cursor: pointer; user-select: none; }
.topic-selector .topic-pill.selected { outline: 2px solid var(--color-primary); outline-offset: 1px; }

/* Custom tag input */
.custom-tag-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
}
.custom-tag-row input {
  flex: 1;
  padding: var(--space-1) var(--space-3);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--color-text);
  font-size: 11px;
  max-width: 200px;
  transition: border-color var(--transition-interactive);
}
.custom-tag-row input:focus {
  outline: none;
  border-color: var(--color-primary);
  border-style: solid;
}
.custom-tag-row input::placeholder { color: var(--color-text-faint); }

/* ═══ FILTER BAR ═══ */
.filter-bar {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-5);
  align-items: center;
}
.filter-bar .topic-pill { font-size: 12px; }

/* ═══ TABLE / EXCHANGE LIST ═══ */
.exchange-table { width: 100%; }
.exchange-table th {
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: var(--space-3) var(--space-4);
  border-bottom: 2px solid var(--color-divider);
  white-space: nowrap;
}
.exchange-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-divider);
  font-size: var(--text-sm);
  vertical-align: middle;
}
.exchange-table tr:hover td { background: var(--color-surface-offset); }

/* ═══ NOTIFICATION LIST ═══ */
.notif-list { display: flex; flex-direction: column; gap: var(--space-2); }
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  border: 1px solid rgba(0,0,0,0.08);
  transition: background var(--transition-interactive), transform var(--transition-interactive);
  cursor: pointer;
  text-decoration: none;
}
.notif-item:hover { background: var(--color-surface-offset); transform: translateY(-1px); }
.notif-item.unread { background: var(--color-primary-highlight); border-color: var(--color-primary); }
.notif-item .notif-msg { flex: 1; font-size: var(--text-sm); color: var(--color-text); }
.notif-item .notif-time { font-size: var(--text-xs); color: var(--color-text-faint); white-space: nowrap; }
.notif-item .notif-dot {
  width: 8px; height: 8px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  flex-shrink: 0;
  margin-top: 6px;
}
.notif-item.unread .notif-dot { background: var(--color-primary); }
.notif-item:not(.unread) .notif-dot { background: var(--color-text-faint); }

/* ═══ EMPTY STATE ═══ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-16) var(--space-8);
  color: var(--color-text-muted);
}
.empty-state-icon {
  width: 56px; height: 56px;
  margin-bottom: var(--space-4);
  color: var(--color-text-faint);
}
.empty-state-icon svg { width: 100%; height: 100%; }
.empty-state h3 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--color-text);
  margin-bottom: var(--space-2);
}
.empty-state p {
  max-width: 36ch;
  margin-bottom: var(--space-6);
  font-size: var(--text-sm);
}

/* ═══ SKELETON ═══ */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--color-surface-offset) 25%, var(--color-surface-dynamic) 50%, var(--color-surface-offset) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
.skeleton-text { height: 1em; margin-bottom: var(--space-2); }
.skeleton-text:last-child { width: 60%; }
.skeleton-heading { height: 1.5em; width: 40%; margin-bottom: var(--space-4); }
.skeleton-card {
  height: 180px;
  border-radius: var(--radius-lg);
  background: linear-gradient(90deg, var(--color-surface-offset) 25%, var(--color-surface-dynamic) 50%, var(--color-surface-offset) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

/* ═══ TOAST ═══ */
.toast-container {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.toast {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-5);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  max-width: 360px;
  animation: toastIn 300ms cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.toast.toast-success { border-left: 3px solid var(--color-success); }
.toast.toast-error { border-left: 3px solid var(--color-notification); }
.toast.toast-info { border-left: 3px solid var(--color-primary); }
.toast-code { font-weight: 700; font-size: var(--text-lg); color: var(--color-primary); font-variant-numeric: tabular-nums lining-nums; }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* ═══ MODAL / OVERLAY ═══ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: oklch(0.2 0 0 / 0.5);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  animation: fadeIn 200ms ease;
}
.modal {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 300ms cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
}
.modal-title {
  font-family: var(--font-body);
  font-size: var(--text-lg);
  font-weight: 600;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

/* ═══ PROFILE ═══ */
.profile-header {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}
.profile-info h2 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
}
.profile-info .profile-url {
  font-size: var(--text-sm);
  color: var(--color-primary);
  text-decoration: none;
}
.profile-info .profile-url:hover { text-decoration: underline; }
.profile-topics { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }

/* ═══ LOGIN SCREEN ═══ */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: var(--space-6);
  background: var(--color-bg);
}
.login-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}
.login-card h1 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  margin-bottom: var(--space-2);
}
.login-card p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-6);
}
.login-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-lg);
}

/* ═══ INLINE LINK ═══ */
a.inline-link { color: var(--color-primary); text-decoration: none; }
a.inline-link:hover { text-decoration: underline; }

/* ═══ DIVIDER ═══ */
.divider { border: none; border-top: 1px solid var(--color-divider); margin: var(--space-6) 0; }

/* ═══ RESPONSIVE: MOBILE ═══ */
@media (max-width: 768px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: var(--header-h) 1fr auto;
  }
  .sidebar {
    grid-row: 3;
    grid-column: 1;
    flex-direction: row;
    border-right: none;
    border-top: 1px solid var(--color-border);
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior: contain;
  }
  .sidebar-logo { display: none; }
  .sidebar-nav {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: var(--space-1) var(--space-2);
    gap: 0;
    flex: 1;
    justify-content: space-around;
  }
  .sidebar-nav a {
    flex-direction: column;
    gap: 2px;
    padding: var(--space-1) var(--space-2);
    font-size: 10px;
    min-width: 56px;
    text-align: center;
    justify-content: center;
  }
  .sidebar-nav a svg { width: 20px; height: 20px; }
  .sidebar-footer { display: none; }
  .header { grid-column: 1; }
  .main { grid-column: 1; padding: var(--space-4); }
  .hamburger-btn { display: inline-flex; }
  .form-row { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .stat-row { grid-template-columns: 1fr 1fr; }

  .exchange-table-wrapper { overflow-x: auto; }
  .exchange-table { min-width: 600px; }
}

@media (max-width: 480px) {
  .stat-row { grid-template-columns: 1fr; }
  .card-grid { grid-template-columns: 1fr; }
}

/* ═══ TOPIC COLORS — all light grey, smaller ═══ */
.topic-pill {
  background: #F0EFEF;
  color: #4a4a4a;
  font-size: 11px;
  padding: 1px var(--space-2);
}
.topic-ai-tools,
.topic-ai-product-management,
.topic-vibe-coding,
.topic-agentic-ai,
.topic-ai-literacy,
.topic-substack-growth,
.topic-ai-writing-content,
.topic-seo-aio,
.topic-productivity,
.topic-no-code-low-code,
.topic-product-design,
.topic-developer-tools,
.topic-marketing-growth,
.topic-community-building,
.topic-tech-trends,
.topic-default { background: #F0EFEF; color: #4a4a4a; }

/* ═══ PROFILE STAT ═══ */
.profile-stat-value {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
}

/* ═══ NOTIFICATION PREFERENCES ═══ */
.notif-prefs-section {
  margin-top: var(--space-6);
}
.notif-prefs-section h3 {
  font-family: var(--font-display);
  font-weight: 600;
  margin-bottom: var(--space-4);
}
.notif-pref-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-divider);
}
.notif-pref-row:last-child { border-bottom: none; }
.notif-pref-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.notif-pref-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
}
.notif-pref-desc {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
/* Toggle switch */
.toggle {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--color-surface-dynamic);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--transition-interactive);
}
.toggle-track::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: var(--radius-full);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  transition: transform var(--transition-interactive);
}
.toggle input:checked + .toggle-track {
  background: var(--color-primary);
}
.toggle input:checked + .toggle-track::before {
  transform: translateX(18px);
}

/* ═══ BUTTON LOADING STATE ═══ */
.btn.is-loading {
  pointer-events: none;
  opacity: 0.7;
  position: relative;
  color: transparent !important;
}
.btn.is-loading::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  top: 50%; left: 50%;
  margin: -8px 0 0 -8px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: var(--radius-full);
  animation: btn-spin 0.5s linear infinite;
}
.btn-primary.is-loading::after { border-color: #fff; border-right-color: transparent; }
.btn-success.is-loading::after { border-color: #fff; border-right-color: transparent; }
.btn-secondary.is-loading::after { border-color: var(--color-text); border-right-color: transparent; }
.btn-sm.is-loading::after { width: 12px; height: 12px; margin: -6px 0 0 -6px; }
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* ═══ PAGE SKELETON LOADERS ═══ */
.skeleton-page { animation: fadeIn 200ms ease; }
.skeleton-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}
.skeleton-stat {
  height: 88px;
  border-radius: var(--radius-lg);
  background: linear-gradient(90deg, var(--color-surface-offset) 25%, var(--color-surface-dynamic) 50%, var(--color-surface-offset) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}
.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
  gap: var(--space-4);
}
.skeleton-card-sm {
  height: 140px;
  border-radius: var(--radius-lg);
  background: linear-gradient(90deg, var(--color-surface-offset) 25%, var(--color-surface-dynamic) 50%, var(--color-surface-offset) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}
.skeleton-line {
  height: 14px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--color-surface-offset) 25%, var(--color-surface-dynamic) 50%, var(--color-surface-offset) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  margin-bottom: var(--space-2);
}
.skeleton-line.w-40 { width: 40%; }
.skeleton-line.w-60 { width: 60%; }
.skeleton-line.w-80 { width: 80%; }
.skeleton-table {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.skeleton-table-row {
  height: 48px;
  border-radius: var(--radius-md);
  background: linear-gradient(90deg, var(--color-surface-offset) 25%, var(--color-surface-dynamic) 50%, var(--color-surface-offset) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

/* ═══ INITIAL APP LOADER ═══ */
.app-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  gap: var(--space-4);
  background: var(--color-bg);
}
.app-loader-spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--color-surface-offset);
  border-top-color: var(--color-primary);
  border-radius: var(--radius-full);
  animation: btn-spin 0.7s linear infinite;
}
.app-loader-text {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  font-family: var(--font-body);
}

/* ═══ MISC UTILITIES ═══ */
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.text-muted { color: var(--color-text-muted); }
.text-faint { color: var(--color-text-faint); }
.text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.fw-600 { font-weight: 600; }
.hidden { display: none !important; }

/* Expanded card detail */
.card-detail { margin-top: var(--space-3); padding-top: var(--space-3); border-top: 1px solid var(--color-divider); }
.card-note { font-size: var(--text-sm); color: var(--color-text-muted); font-style: italic; margin-bottom: var(--space-3); }

/* ═══ SEARCH BAR ═══ */
.search-bar {
  position: relative;
  max-width: 320px;
}
.search-bar input {
  width: 100%;
  padding: var(--space-2) var(--space-3) var(--space-2) 36px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-sm);
  transition: border-color var(--transition-interactive);
}
.search-bar input:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
  border-color: var(--color-primary);
}
.search-bar input::placeholder { color: var(--color-text-faint); }
.search-bar svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--color-text-faint);
  pointer-events: none;
}

/* ═══ WELCOME / ONBOARDING SCREEN ═══ */
.welcome-screen {
  text-align: center;
  max-width: 480px;
  margin: 0 auto;
}
.welcome-screen .welcome-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-5);
  background: var(--color-primary-highlight);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
}
.welcome-screen .welcome-icon svg {
  width: 32px;
  height: 32px;
  color: var(--color-primary);
}
.welcome-screen h1 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  margin-bottom: var(--space-3);
}
.welcome-screen p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
  max-width: 42ch;
  margin-left: auto;
  margin-right: auto;
}
.welcome-screen .upgrade-link {
  display: inline-block;
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-primary);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
  margin-bottom: var(--space-6);
  transition: all var(--transition-interactive);
}
.welcome-screen .upgrade-link:hover {
  background: var(--color-primary-highlight);
}

/* ═══ MEMBERS PAGE ═══ */
.member-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: var(--space-4);
}
.member-card {
  background: var(--color-surface);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: transform var(--transition-interactive), box-shadow var(--transition-interactive);
}
.member-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.08); }
.member-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.member-card-name {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text);
}
.member-card-url {
  font-size: var(--text-xs);
  color: var(--color-primary);
  text-decoration: none;
  display: block;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.member-card-url:hover { text-decoration: underline; }
.member-card-topics {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-top: var(--space-3);
}

/* ═══ STAT CARD DESCRIPTIONS ═══ */
.stat-card .stat-desc {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-top: var(--space-1);
  line-height: 1.4;
}

/* ═══ NAV BADGE (pending request count) ═══ */
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-full);
  background: var(--color-notification);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums lining-nums;
  margin-left: auto;
  line-height: 1;
}
.nav-badge:empty { display: none; }

/* ═══ EXCHANGE DETAIL GRID ═══ */
.exchange-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
  margin-top: var(--space-6);
}
.exchange-detail-grid .detail-card {
  background: var(--color-surface);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}
.exchange-detail-grid .detail-card h3 {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 600;
  margin-bottom: var(--space-3);
  color: var(--color-text);
}
.exchange-detail-grid .detail-card .detail-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-divider);
  font-size: var(--text-sm);
}
.exchange-detail-grid .detail-card .detail-row:last-child {
  border-bottom: none;
}
.exchange-detail-grid .detail-card .detail-label {
  color: var(--color-text-muted);
  font-weight: 500;
}
.exchange-detail-grid .detail-card .detail-value {
  color: var(--color-text);
  text-align: right;
  word-break: break-word;
  max-width: 60%;
}
.exchange-detail-grid .detail-card .detail-value a {
  color: var(--color-primary);
  text-decoration: none;
}
.exchange-detail-grid .detail-card .detail-value a:hover {
  text-decoration: underline;
}

/* Exchange detail header */
.exchange-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.exchange-detail-header h2 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
}

/* Exchange status filter tabs */
.exchange-filters {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.exchange-filter-btn {
  padding: var(--space-1) var(--space-4);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  transition: all var(--transition-interactive);
}
.exchange-filter-btn:hover {
  background: var(--color-surface-offset);
  color: var(--color-text);
}
.exchange-filter-btn.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

/* Swap count badge on member cards */
.member-swap-count {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-2);
}
.member-swap-count svg {
  width: 14px;
  height: 14px;
}

/* Cancelled badge */
.badge-cancelled {
  background: var(--color-surface-offset);
  color: var(--color-text-muted);
}

/* Responsive: exchange detail grid stacks on mobile */
@media (max-width: 768px) {
  .exchange-detail-grid {
    grid-template-columns: 1fr;
  }
}
