:root {
  color-scheme: light;
  --bg: #f0f2f5;
  --surface: #ffffff;
  --border: #e2e5ea;
  --text: #14171a;
  --text-muted: #65676b;
  --text-faint: #8a8d91;
  --accent: #111113;
  --accent-hover: #000000;
  --accent-soft: #eeeef0;
  --danger-soft: #fdeaea;
  --danger-text: #b42318;
  --success-soft: #e7f7ee;
  --success-text: #16794f;
  --warning-soft: #fdf3e2;
  --warning-text: #9a6400;
  --admin-bg: #fff4bf;
  --admin-border: #e8c200;
  --admin-text: #6b5300;
  --admin-accent: #ffd93d;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 1px rgba(15, 23, 42, 0.04);
  --radius: 12px;
}

* { box-sizing: border-box; }

input[type="radio"], input[type="checkbox"] { accent-color: var(--accent); }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 0;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
}

a { color: inherit; }

/* Top bar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  min-width: 0;
}

.brand-mark {
  flex-shrink: 0;
  border-radius: 50%;
}

.brand-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-shrink: 0;
}

.project-subheader {
  position: sticky;
  top: 56px;
  z-index: 9;
  /* Same surface as the logo bar above it, not the page background — reads
     as one continuous header unit anchored under the wordmark, rather than
     the start of the scrollable content area. */
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.project-subheader-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 10px 16px;
}

.project-picker-form {
  display: inline-block;
}

.project-picker-label {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 6px 4px 12px;
}

.project-picker-label select {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text);
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
}

.project-picker-label select:hover { border-color: var(--accent); }

.user-menu {
  position: relative;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  list-style: none;
}

.user-chip::-webkit-details-marker { display: none; }

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 170px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 20;
}

.user-menu-form { margin: 0; }

.user-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.6rem;
  border: none;
  border-radius: 6px;
  background: none;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
}

.user-menu-item:hover { background: var(--bg); }

.user-menu-item-admin {
  color: var(--admin-text);
  background: var(--admin-bg);
}

.user-menu-item-admin:hover { background: var(--admin-accent); }

.client-view-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px 16px;
  background: var(--admin-bg);
  border-bottom: 1px solid var(--admin-border);
  color: var(--admin-text);
  font-size: 0.82rem;
  font-weight: 600;
}

.client-view-banner-exit {
  background: var(--admin-accent);
  color: var(--admin-text);
  border: 1px solid var(--admin-border);
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

.client-view-banner-exit:hover { background: var(--admin-border); }

.client-view-banner-dismiss {
  background: none;
  border: none;
  color: var(--admin-text);
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 4px;
  cursor: pointer;
  opacity: 0.7;
}

.client-view-banner-dismiss:hover { opacity: 1; }

.avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.user-email {
  color: var(--text-muted);
  font-size: 0.85rem;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Layout */

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px 64px;
}

/* Buttons */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: white;
  border: none;
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
}

.button:hover { background: var(--accent-hover); }

.button-ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border);
}

.button-ghost:hover { background: var(--accent-soft); }

.button-admin {
  background: var(--admin-accent);
  color: var(--admin-text);
  border: 1px solid var(--admin-border);
}

.button-admin:hover { background: var(--admin-border); }

button { font-family: inherit; }

/* Dashboard: query cards */

.page-header {
  margin: 4px 0 20px;
}

.page-header h1 {
  font-size: 1.4rem;
  margin: 0 0 4px;
}

.page-header .subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0;
}

.jobs-project-filter {
  margin: 4px 0 18px;
}

.jobs-project-filter label {
  display: block;
  max-width: 260px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
}

.jobs-project-filter select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 600;
  text-transform: none;
  letter-spacing: normal;
}

.job-project-tag {
  color: var(--text-faint);
  font-size: 0.78rem;
}

.job-pair-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -2px 0 2px 24px;
  padding: 6px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 10px 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: none;
}

.job-pair-row:hover {
  color: var(--text);
  background: var(--accent-soft);
}

/* Dashboard: stat cards + charts */

.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.stat-value {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--text);
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

.project-collection-card {
  margin-bottom: -2px;
}

.project-keyword-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 16px;
}

.project-keyword-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  font-size: 0.85rem;
}

.project-keyword-row form {
  margin: 0;
}

.project-keyword-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.admin-panel {
  margin-top: 16px;
  padding: 16px 18px 18px;
  border: 1px solid var(--admin-border);
  border-radius: var(--radius);
  background: var(--admin-bg);
}

.admin-panel-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--admin-text);
  margin-bottom: 12px;
}

.admin-panel .stat-cards {
  margin-top: 0;
}

.dashboard-charts {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-top: 28px;
}

.moodboard-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  margin-top: 10px;
}

.moodboard-image {
  aspect-ratio: 1;
  width: 100%;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.chart-card-full {
  grid-column: 1 / -1;
}

.chart-container {
  position: relative;
  height: 280px;
  margin-top: 8px;
}

.chart-container-small {
  height: 220px;
}

.chart-container-tall {
  height: 320px;
}

.top-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.top-list-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
}

.top-list-name {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 280px;
  flex-shrink: 0;
  color: var(--text);
  text-decoration: none;
}

.top-list-name:hover .top-list-name-text {
  color: var(--accent);
  text-decoration: underline;
}

.top-list-name-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-list-avatar,
.top-list-avatar-fallback {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
}

.top-list-avatar {
  object-fit: cover;
  background: var(--bg);
}

.top-list-avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.72rem;
}

.top-list-bar-track {
  flex: 1;
  background: var(--bg);
  border-radius: 6px;
  height: 10px;
  overflow: hidden;
}

.top-list-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 6px;
}

.top-list-count {
  width: 32px;
  flex-shrink: 0;
  text-align: right;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.jobs-section-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 28px 0 10px;
}

.env-error-banner {
  background: var(--danger-soft);
  border: 2px solid var(--danger-text);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 24px;
  color: var(--danger-text);
}

.env-error-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.env-error-banner p {
  margin: 6px 0 0;
  font-size: 0.88rem;
  line-height: 1.5;
}

.env-error-detail {
  font-family: ui-monospace, monospace;
  font-size: 0.78rem !important;
  word-break: break-word;
  background: var(--surface);
  border-radius: 6px;
  padding: 8px 10px;
}

.env-error-time {
  font-size: 0.75rem !important;
  opacity: 0.8;
}

.jobs-section-title:first-of-type {
  margin-top: 4px;
}

.jobs-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 28px 0 10px;
}

.jobs-section-header .jobs-section-title {
  margin: 0;
}

.inline-search-input {
  width: 240px;
  max-width: 50vw;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.85rem;
  font-family: inherit;
}

.inline-search-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.jobs-section-meta {
  font-weight: 500;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-left: 8px;
}

.jobs-section-meta.at-cap {
  color: var(--danger-text);
  font-weight: 700;
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 0.82rem;
}

.detail-table th,
.detail-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.detail-table th {
  background: var(--bg);
  color: var(--text-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 700;
}

.detail-table tbody tr:last-child td {
  border-bottom: none;
}

.detail-table a {
  color: var(--accent);
  word-break: break-all;
}

.detail-error {
  color: var(--danger-text);
  max-width: 360px;
  word-break: break-word;
}

.detail-table .nowrap {
  white-space: nowrap;
}

.query-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.query-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.query-card-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.query-card-main .query-title {
  font-weight: 600;
  text-decoration: none;
  color: var(--text);
  font-size: 1rem;
}

.query-card-main a.query-title:hover { color: var(--accent); }

.query-card-meta {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.query-card-stats {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.post-count {
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.badge {
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge.active { background: var(--success-soft); color: var(--success-text); }
.badge.paused { background: var(--border); color: var(--text-muted); }
.badge.warning { background: var(--warning-soft); color: var(--warning-text); }

.spinner {
  display: inline-block;
  width: 0.7em;
  height: 0.7em;
  margin-right: 0.35em;
  border: 2px solid var(--text-muted);
  border-top-color: transparent;
  border-radius: 50%;
  vertical-align: -0.1em;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.query-card form { margin: 0; }

.user-list {
  display: flex;
  flex-direction: column;
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 14px;
  border-bottom: 1px solid var(--border);
}

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

.user-row-main {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
}

.user-row-email {
  font-weight: 600;
  font-size: 0.9rem;
}

.user-row-meta {
  color: var(--text-muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.user-row-grants {
  color: var(--text-muted);
  font-size: 0.78rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.query-card-error-footer {
  flex-basis: 100%;
  margin: 0;
  background: var(--danger-soft);
  color: var(--danger-text);
  border-radius: 6px;
  padding: 8px 10px;
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
  word-break: break-word;
}

.icon-button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 8px;
  padding: 0.35rem 0.65rem;
  font-size: 0.78rem;
  cursor: pointer;
}

.icon-button:hover { background: var(--bg); }

.icon-button-danger {
  border-color: var(--danger-text);
  color: var(--danger-text);
}

.icon-button-danger:hover { background: var(--danger-soft); }

.empty {
  color: var(--text-muted);
  text-align: center;
  padding: 48px 16px;
}

/* Post feed */

.feed-main {
  flex: 1;
  min-width: 0;
}

.feed-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin: 4px 0 16px;
  flex-wrap: wrap;
}

.back-link {
  display: inline-block;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  margin-bottom: 10px;
}

.back-link:hover { color: var(--text); }

.feed-header h1 {
  font-size: 1.3rem;
  margin: 0;
}

.feed-header .feed-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.posts-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.platform-badge-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.debug-button {
  background: var(--admin-bg);
  border: 1px solid var(--admin-border);
  color: var(--admin-text);
  border-radius: 6px;
  width: 24px;
  height: 24px;
  font-size: 0.8rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.debug-button:hover { background: var(--admin-accent); }

.debug-modal {
  border: 2px solid var(--admin-border);
  border-radius: var(--radius);
  padding: 0;
  width: min(520px, 90vw);
  max-height: 80vh;
  box-shadow: var(--shadow);
}

.debug-modal::backdrop {
  background: rgba(0, 0, 0, 0.4);
}

.debug-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--admin-bg);
  border-bottom: 1px solid var(--admin-border);
  padding: 12px 16px;
  font-weight: 700;
  color: var(--admin-text);
}

.debug-modal-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  color: var(--admin-text);
}

.debug-modal-body {
  padding: 16px;
  overflow-y: auto;
  max-height: calc(80vh - 50px);
}

.debug-modal-meta {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 0 0 12px;
}

.debug-match {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
}

.debug-match-keyword {
  font-weight: 600;
  font-size: 0.9rem;
}

.debug-match-meta {
  color: var(--text-muted);
  font-size: 0.78rem;
  margin-top: 2px;
}

.debug-match-raw {
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--bg);
  border-radius: 6px;
  padding: 6px 8px;
  margin-top: 6px;
  word-break: break-word;
}

.debug-term-highlight {
  background: #fff176;
  color: var(--text);
  border-radius: 3px;
  padding: 0 2px;
  font-weight: 700;
}

.debug-match-collections {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.debug-collection-pill {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 500;
}

.platform-badge {
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}

.platform-badge-linkedin {
  background: #e8f2fc;
  color: #0a66c2;
}

.platform-badge-x {
  background: #000000;
  color: #ffffff;
}

.platform-badge-substack {
  background: #ff6719;
  color: #ffffff;
}

.platform-badge-podcasts {
  background: #7c3aed;
  color: #ffffff;
}

.platform-badge-unknown {
  background: var(--bg);
  color: var(--text-faint);
}

.post-author {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 10px;
}

.author-pic {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg);
}

.author-pic-fallback {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.author-info {
  min-width: 0;
}

.author-name {
  font-weight: 600;
  text-decoration: none;
  color: var(--text);
  font-size: 0.95rem;
}

.author-name:hover { text-decoration: underline; }

.account-type-badge {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  vertical-align: middle;
}

.account-type-badge-person {
  background: var(--accent-soft);
  color: var(--accent);
}

.account-type-badge-organization {
  background: #f1e9fc;
  color: #6b3fc4;
}

.verified-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  margin-left: 5px;
  border-radius: 50%;
  color: #ffffff;
  font-size: 0.62rem;
  font-weight: 700;
  vertical-align: middle;
}

.verified-badge-gold { background: #ca9a1e; }
.verified-badge-blue { background: #1d9bf0; }
.verified-badge-gray { background: #8899a6; }

.author-headline {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}

.post-text {
  white-space: pre-wrap;
  font-size: 0.92rem;
  margin: 0 0 10px;
}

.post-image {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 10px;
  display: block;
}

.hashtags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.hashtag-pill {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 500;
}

.post-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem 0.5rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.post-footer .divider { color: var(--text-faint); }

.post-footer a {
  color: var(--accent);
  text-decoration: none;
}

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

.post-card.fallback h3 {
  font-size: 1rem;
  margin: 0 0 6px;
}

.post-card.fallback h3 a {
  text-decoration: none;
  color: var(--text);
}

.post-card.fallback h3 a:hover { color: var(--accent); }

.post-meta {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin: 0 0 8px;
}

.post-desc {
  font-size: 0.9rem;
  margin: 0 0 10px;
  color: var(--text);
}

.enrich-pending {
  color: var(--text-faint);
  font-style: italic;
}

/* Pagination */

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.pagination a, .pagination .disabled {
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
}

.pagination a { color: var(--accent); }
.pagination a:hover { background: var(--accent-soft); }
.pagination .disabled { color: var(--text-faint); }

.pagination .page-indicator {
  color: var(--text-muted);
  font-size: 0.82rem;
}

/* Login */

.login-box {
  max-width: 360px;
  margin: 15vh auto 0;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 28px;
  box-shadow: var(--shadow);
}

.login-box h1 {
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
}

.login-box p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

/* Forms */

.query-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  max-width: 420px;
}

.query-form label {
  display: block;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.query-form input,
.query-form select {
  display: block;
  width: 100%;
  padding: 0.5rem 0.6rem;
  margin-top: 0.35rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
}

.query-form input:focus,
.query-form select:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.checkbox-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  margin-top: 0.35rem;
  background: var(--bg);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 400;
  font-size: 0.88rem;
  color: var(--text);
  margin-bottom: 0;
}

.checkbox-row input { width: auto; margin: 0; }

/* Collection type badges */

.badge.type-event { background: var(--accent-soft); color: var(--accent); }
.badge.type-association { background: var(--success-soft); color: var(--success-text); }
.badge.type-competitor { background: var(--danger-soft); color: var(--danger-text); }

/* Top nav links */

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
}

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

.nav-link-admin {
  color: var(--admin-text);
  background: var(--admin-bg);
  border: 1px solid var(--admin-border);
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
}

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

.nav-link-current {
  color: var(--text);
  font-weight: 700;
}

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

/* Filter sidebar */

.filter-context {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: -8px 0 14px;
}

.filter-context a { color: var(--accent); text-decoration: none; }

.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -6px 0 14px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 0.3rem 0.4rem 0.3rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 600;
}

.filter-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.95rem;
  line-height: 1;
}

.filter-chip-remove:hover {
  background: var(--surface);
}

main.main-with-sidebar {
  max-width: 1080px;
}

main.main-wide {
  max-width: 1200px;
}

.feed-layout {
  display: flex;
  align-items: flex-start;
  gap: 24px;
}

.filters-sidebar {
  width: 300px;
  flex-shrink: 0;
  position: sticky;
  top: 72px;
  max-height: calc(100vh - 88px);
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.project-selector {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.project-selector-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
}

.project-selector-label select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 600;
  text-transform: none;
  letter-spacing: normal;
}

.sidebar-collapse > .filters-sidebar-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  cursor: pointer;
  padding: 14px 16px;
  list-style: none;
}

.sidebar-collapse > .filters-sidebar-title::-webkit-details-marker { display: none; }

.sidebar-collapse > .filters-sidebar-title::after {
  content: "▾";
  color: var(--text-faint);
  font-size: 0.85rem;
}

.sidebar-collapse:not([open]) > .filters-sidebar-title::after {
  content: "▸";
}

.sidebar-collapse[open] > .filters-sidebar-title {
  border-bottom: 1px solid var(--border);
}

.sidebar-collapse-body {
  padding: 0 16px 16px;
}

.sidebar-collapse-body > .filter-section:first-child {
  border-top: none;
  padding-top: 14px;
}

.filter-section {
  border-top: 1px solid var(--border);
  padding: 10px 0;
}

.filter-section summary {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  list-style: none;
}

.filter-section summary::-webkit-details-marker { display: none; }

.filter-section summary::before {
  content: "▸";
  display: inline-block;
  width: 1em;
  color: var(--text-faint);
}

.filter-section[open] summary::before { content: "▾"; }

.filter-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 8px 5px 20px;
  margin-top: 2px;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.85rem;
}

.filter-option:hover { background: var(--bg); }

.filter-option.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.count-badge {
  background: var(--bg);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
}

.filter-option.active .count-badge {
  background: var(--surface);
  color: var(--accent);
}

.filter-suboption {
  padding-left: 34px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.language-checkbox-form {
  display: flex;
  flex-direction: column;
  max-height: 260px;
  overflow-y: auto;
}

.filter-checkbox-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px 5px 4px;
  margin-top: 2px;
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
}

.filter-checkbox-option:hover { background: var(--bg); }

.filter-checkbox-option input[type="checkbox"] {
  flex-shrink: 0;
  accent-color: var(--accent);
}

.filter-checkbox-option .count-badge {
  margin-left: auto;
}

.word-filter-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 2px 2px 0;
}

.word-tag-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.word-filter-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.word-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.word-tag-list:empty { display: none; }

.word-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 0.15rem 0.4rem 0.15rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 500;
}

.word-tag-exclude {
  background: var(--danger-soft);
  color: var(--danger-text);
}

.word-tag-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  font-size: 0.9rem;
  line-height: 1;
  padding: 0 2px;
  opacity: 0.7;
}

.word-tag-remove:hover { opacity: 1; }

.word-tag-input {
  font-size: 0.85rem;
  color: var(--text);
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.filter-empty {
  padding: 4px 8px 4px 20px;
  margin: 2px 0 0;
  color: var(--text-faint);
  font-size: 0.8rem;
  font-style: italic;
}

.date-filter {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 4px;
}

.filter-date-label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.filter-date-label input {
  width: 100%;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.85rem;
  font-family: inherit;
}

.clear-all-link {
  display: block;
  text-align: center;
  margin-top: 12px;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
}

.export-bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}

.export-menu {
  position: relative;
}

.export-menu > summary.icon-button {
  cursor: pointer;
  list-style: none;
}

.export-menu > summary.icon-button::-webkit-details-marker { display: none; }

.export-menu-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 170px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 20;
}

/* Responsive */

@media (max-width: 860px) {
  .feed-layout {
    flex-direction: column;
  }

  .filters-sidebar {
    width: 100%;
    position: static;
    max-height: none;
  }

  .dashboard-charts {
    grid-template-columns: 1fr;
  }

  .moodboard-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

@media (max-width: 640px) {
  .topbar-inner {
    height: auto;
    flex-wrap: wrap;
    padding: 10px 16px;
    gap: 0.6rem;
  }

  main {
    padding: 16px 12px 48px;
  }

  .topnav {
    width: 100%;
    flex-wrap: wrap;
    gap: 0.6rem 0.9rem;
  }

  .query-card {
    padding: 12px 14px;
  }

  .query-card-stats {
    width: 100%;
    justify-content: space-between;
  }

  .post-card {
    padding: 14px;
  }

  .pagination {
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    text-align: center;
  }

  .top-list-name {
    width: 130px;
  }

  .moodboard-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 420px) {
  .user-email {
    display: none;
  }

  .brand-name {
    max-width: 140px;
  }
}
