/* ── Reset & Variables ─────────────────────────────────── */

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

:root {
  --bg: #f5f2ec;
  --bg-card: #ffffff;
  --text: #1a1a18;
  --text-muted: #6b6960;
  --accent: #d94f1e;
  --accent-light: #fceee8;
  --border: #ddd8ce;
  --border-light: #eae6df;
  --tag-bg: #edeae4;
  --tag-active-bg: var(--accent);
  --tag-active-text: #fff;
  --radius: 6px;
  --radius-lg: 10px;
  --mono: "Menlo", "Consolas", "Liberation Mono", monospace;
  --sans: -apple-system, "Segoe UI", "Helvetica Neue", Helvetica, sans-serif;
}

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

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

a:hover {
  text-decoration: underline;
}

/* ── Header ───────────────────────────────────────────── */

header {
  border-bottom: 2px solid var(--text);
  padding: 1.6rem 2rem 1.4rem;
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: baseline;
  gap: 1.2rem;
  flex-wrap: wrap;
}

.logo {
  font-family: var(--mono);
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.03em;
  text-decoration: none;
}

.logo span {
  color: var(--accent);
}

.logo:hover {
  text-decoration: none;
}

.header-nav {
  display: flex;
  gap: 0.2rem;
}

.nav-link {
  font-family: var(--mono);
  font-size: 0.78rem;
  padding: 0.3rem 0.7rem;
  border-radius: 3px;
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.15s ease;
}

.nav-link:hover {
  color: var(--text);
  background: var(--tag-bg);
  text-decoration: none;
}

.nav-link.active {
  color: var(--text);
  background: var(--tag-bg);
  font-weight: 600;
}

/* ── Main Layout ──────────────────────────────────────── */

.page-layout {
  display: flex;
  flex: 1;
  align-items: flex-start;
  min-height: 0;
}

main {
  flex: 1;
  min-width: 0;
  max-width: 960px;
  margin: 0 auto;
  padding: 1.8rem 2rem 3rem;
}

/* ── Map Pane ─────────────────────────────────────────── */

.page-layout.detail-view #map-pane { display: none !important; }
.page-layout.detail-view main { max-width: 960px; margin: 0 auto; }

/* Desktop: always-visible sticky panel */
@media (min-width: 1050px) {
  main {
    margin: 0;
    max-width: none;
  }

  #map-pane {
    width: 400px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
  }

  #map {
    flex: 1;
    height: 100%;
  }

  .map-toggle-btn { display: none; }
  .map-close-btn  { display: none; }
}

/* Narrow: map is a full-screen overlay, hidden by default */
@media (max-width: 1049px) {
  #map-pane {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 500;
    background: var(--bg);
    flex-direction: column;
  }

  #map-pane.open {
    display: flex;
  }

  #map {
    flex: 1;
  }

  .map-close-btn {
    flex-shrink: 0;
    padding: 0.7rem 1rem;
    font-family: var(--sans);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg);
    border: none;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    text-align: left;
    transition: color 0.15s;
  }

  .map-close-btn:hover { color: var(--accent); }

  .map-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--sans);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.4rem 0.8rem;
    cursor: pointer;
    margin-bottom: 1rem;
    transition: all 0.15s;
  }

  .map-toggle-btn:hover {
    border-color: var(--accent);
    color: var(--text);
  }
}

/* ── Map Popup ────────────────────────────────────────── */

.map-popup-name {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.map-popup-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.map-popup-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  margin-bottom: 0.3rem;
}

.map-popup-extras {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.map-popup-btn {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-light);
  border: 1px solid var(--accent);
  border-radius: 3px;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
  transition: all 0.15s;
}

.map-popup-btn:hover {
  background: var(--accent);
  color: #fff;
}

/* ── Filters ──────────────────────────────────────────── */

.filters {
  display: flex;
  gap: 2rem;
  margin-bottom: 1.4rem;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-group label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  white-space: nowrap;
}

.filter-chips {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.chip {
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 0.3rem 0.6rem;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.chip:hover {
  border-color: var(--accent);
  color: var(--text);
}

.chip.active {
  background: var(--tag-active-bg);
  color: var(--tag-active-text);
  border-color: var(--tag-active-bg);
}

.date-filter {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.date-filter input[type="date"] {
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 0.3rem 0.5rem;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
}

.date-sep {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* ── List View ────────────────────────────────────────── */

.list-header {
  display: grid;
  grid-template-columns: 11rem 1fr 9rem 7rem 4.5rem 4rem 5rem 6rem;
  gap: 0.5rem;
  padding: 0.5rem 0.8rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.sort-header {
  cursor: pointer;
  user-select: none;
}

.sort-header:hover {
  color: var(--accent);
}

.sort-header.sort-active {
  color: var(--text);
}

.event-row {
  display: grid;
  grid-template-columns: 11rem 1fr 9rem 7rem 4.5rem 4rem 5rem 6rem;
  gap: 0.5rem;
  padding: 0.75rem 0.8rem;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background 0.12s ease;
  align-items: center;
  text-decoration: none;
  color: inherit;
}

.event-row:hover {
  background: var(--bg-card);
  text-decoration: none;
}

.event-row .col-date {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.event-row .col-name {
  font-weight: 600;
  font-size: 0.95rem;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.event-row .col-city {
  font-size: 0.85rem;
  color: var(--text-muted);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  gap: 0.3rem;
}

.no-map-icon {
  flex-shrink: 0;
  width: 11px;
  height: 11px;
  color: var(--text-muted);
  opacity: 0.5;
  vertical-align: middle;
}

.map-icon {
  flex-shrink: 0;
  width: 11px;
  height: 11px;
  color: var(--text-muted);
  opacity: 0.6;
  vertical-align: middle;
}

.event-row .col-mode {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.event-row .col-size {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--text-muted);
}

.event-row .col-surface {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.event-row .col-age-group {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.event-row .col-updated {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.event-row .col-surface-size {
  display: none;
}

.event-row .col-mode-meta {
  display: none;
}

.type-tag {
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: 500;
  padding: 0.1rem 0.3rem;
  border-radius: 2px;
  vertical-align: middle;
  margin-left: 0.3rem;
}

.type-tag[data-type="other"] {
  background: var(--tag-bg);
  color: var(--text-muted);
}

.mode-tag {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 500;
  padding: 0.15rem 0.4rem;
  border-radius: 2px;
  background: var(--tag-bg);
  color: var(--text-muted);
  white-space: nowrap;
}

.mode-tag[data-mode="Mixed"] { background: #e0eddf; color: #2d5e2a; }
.mode-tag[data-mode="Loose Mixed"] { background: #dde8ee; color: #2a4f5e; }
.mode-tag[data-mode="Open"] { background: #eee4d5; color: #6b4d26; }
.mode-tag[data-mode="Women"] { background: #eddde8; color: #5e2a4f; }

.hat-badge {
  font-size: 0.6rem;
  font-weight: 600;
  padding: 0.1rem 0.35rem;
  border-radius: 2px;
  background: var(--accent);
  color: #fff;
  vertical-align: middle;
  margin-left: 0.3rem;
  letter-spacing: 0.04em;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.loading-state[hidden] { display: none; }
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 4rem 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.spinner {
  width: 2rem;
  height: 2rem;
  border: 2px solid var(--border);
  border-top-color: var(--text-muted);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ── Detail View ──────────────────────────────────────── */

.back-btn {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.3rem 0;
  margin-bottom: 1.2rem;
  transition: color 0.15s;
}

.back-btn:hover {
  color: var(--accent);
}

.detail-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
}

.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
  padding-bottom: 1.4rem;
  border-bottom: 1px solid var(--border-light);
}

.detail-header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.detail-date-badge {
  font-family: var(--mono);
  font-size: 0.82rem;
  background: var(--accent);
  color: #fff;
  padding: 0.4rem 0.7rem;
  border-radius: 3px;
  white-space: nowrap;
  flex-shrink: 0;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1.6rem;
  margin-bottom: 1.8rem;
}

.detail-section h3 {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.8rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-light);
}

.detail-section dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.3rem 0.8rem;
}

.detail-section dt {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.detail-section dd {
  font-size: 0.88rem;
  font-weight: 500;
  overflow-wrap: break-word;
  word-break: break-word;
}

.detail-emails {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.detail-email {
  padding-top: 1.4rem;
  border-top: 1px solid var(--border-light);
}

.detail-email h3 {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

.detail-email h3 a {
  font-size: 0.7rem;
  text-transform: none;
  letter-spacing: normal;
}

.detail-body {
  font-family: var(--sans);
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--text);
  white-space: pre-wrap;
  word-wrap: break-word;
  max-width: 70ch;
}

/* ── Detail header right (date + follow) ─────────────── */

.detail-header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* ── Follow Button ────────────────────────────────────── */

.follow-wrap {
  position: relative;
}

.follow-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.follow-btn i,
.follow-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.follow-btn .follow-chevron,
.follow-btn .follow-chevron svg {
  width: 10px;
  height: 10px;
  color: var(--text-muted);
  opacity: 0.6;
}

.follow-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.follow-btn--active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-light);
}

.follow-btn--active:hover {
  background: var(--accent);
  color: #fff;
}

.follow-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
  min-width: 11rem;
  z-index: 200;
  overflow: hidden;
}

.follow-menu[hidden] { display: none; }

.follow-menu-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
  background: none;
  border: none;
  padding: 0.55rem 0.9rem;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s;
}

.follow-menu-item i,
.follow-menu-item svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  color: var(--text-muted);
}

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

.follow-menu-item--danger {
  color: var(--accent);
  border-top: 1px solid var(--border-light);
}

.follow-menu-item--danger i {
  color: var(--accent);
}

.follow-menu-note {
  margin: 0;
  padding: 0.45rem 0.75rem 0.4rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-light);
}

/* ── Detail Mini Map ──────────────────────────────────── */

.detail-map-wrap {
  margin-bottom: 1.6rem;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-light);
}

.detail-map-wrap[hidden] { display: none; }

#detail-map {
  height: 220px;
  width: 100%;
}

/* ── Sibling editions ─────────────────────────────────── */

.detail-siblings {
  margin-top: 1.6rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--border-light);
}

.detail-siblings h3 {
  font-size: 0.95rem;
  margin: 0 0 0.7rem 0;
}

.detail-siblings ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.detail-siblings a {
  display: grid;
  grid-template-columns: 9rem 1fr auto;
  gap: 0.8rem;
  align-items: baseline;
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--border-light);
}

.detail-siblings a:hover {
  background: var(--accent-light);
  border-color: var(--accent);
}

.detail-siblings .sibling-date {
  font-variant-numeric: tabular-nums;
  color: var(--text-muted, #666);
  font-size: 0.85rem;
}

.detail-siblings .sibling-name {
  font-weight: 600;
}

.detail-siblings .sibling-loc {
  color: var(--text-muted, #666);
  font-size: 0.85rem;
}

@media (max-width: 600px) {
  .detail-siblings a {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }
}

/* ── Series Button ────────────────────────────────────── */

.detail-series {
  margin-top: 1.4rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--border-light);
}

.series-btn {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-light);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.series-btn:hover {
  background: var(--accent);
  color: #fff;
}

/* ── Series Filter Banner ─────────────────────────────── */

.series-banner {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.6rem 0.8rem;
  margin-bottom: 1rem;
  background: var(--accent-light);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  font-size: 0.85rem;
}

.series-banner strong {
  color: var(--accent);
}

.series-banner button {
  font-family: var(--sans);
  font-size: 0.75rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
  color: var(--text-muted);
  margin-left: auto;
}

.series-banner button:hover {
  border-color: var(--accent);
  color: var(--text);
}

/* ── Footer ───────────────────────────────────────────── */

footer {
  border-top: 1px solid var(--border);
  padding: 1.8rem 2rem;
  margin-top: auto;
}

.footer-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}

.footer-cols {
  display: flex;
  gap: 3rem;
  flex-wrap: wrap;
}

.footer-col {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.footer-col-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.footer-col a {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-decoration: none;
}

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

.coffee-btn {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text);
  white-space: nowrap;
  text-decoration: none;
  transition: all 0.15s ease;
}

.coffee-btn:hover,
.refresh-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.footer-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.refresh-btn {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text-muted);
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
}

.refresh-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ── Deadline warning ─────────────────────────────────── */

.deadline-soon {
  color: var(--accent);
  font-weight: 600;
}

/* ── Inbox View ──────────────────────────────────────── */

.inbox-intro {
  max-width: 48rem;
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.inbox-intro a {
  color: var(--accent);
  text-decoration: none;
}

.inbox-intro a:hover {
  text-decoration: underline;
}

.inbox-badge,
.inbox-badge-inline {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 3px;
  padding: 0.05em 0.4em;
  vertical-align: middle;
  white-space: nowrap;
  opacity: 0.85;
}

.inbox-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.inbox-search {
  font-family: var(--sans);
  font-size: 0.85rem;
  padding: 0.5rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text);
  flex: 1;
  max-width: 20rem;
}

.inbox-search:focus {
  outline: none;
  border-color: var(--accent);
}

.inbox-count {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.inbox-row {
  display: grid;
  grid-template-columns: 10rem 1fr 1fr 8rem;
  gap: 0.8rem;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background 0.12s ease;
  align-items: center;
}

.inbox-row:hover {
  background: var(--bg-card);
}

.inbox-author {
  font-size: 0.85rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inbox-subject {
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  overflow: hidden;
}

.inbox-subject > :first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.inbox-preview {
  font-size: 0.8rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inbox-date {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: right;
  white-space: nowrap;
}

.inbox-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1.5rem 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.inbox-pagination button {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.3rem 0.75rem;
  cursor: pointer;
  color: var(--text);
  font-size: 0.85rem;
}

.inbox-pagination button:disabled {
  opacity: 0.35;
  cursor: default;
}

.inbox-loading,
.inbox-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.inbox-message {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
}

.inbox-msg-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-light);
}

.inbox-msg-header h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.inbox-msg-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.inbox-msg-meta span:first-child {
  font-weight: 600;
  color: var(--text);
}


.inbox-msg-body {
  font-family: var(--sans);
  font-size: 0.9rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: var(--text);
}

/* ── Auth ─────────────────────────────────────────────── */

.auth-btn {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 0.3rem 0.7rem;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.auth-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

/* Inline "login to see" button in detail view */
.login-prompt-btn {
  font-family: var(--sans);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--accent);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── Login Modal ──────────────────────────────────────── */

.login-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 24, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.login-modal-overlay[hidden] {
  display: none;
}

.login-modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 100%;
  max-width: 22rem;
  position: relative;
  margin: 1rem;
}

.login-modal-box h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}


.login-modal-close {
  position: absolute;
  top: 0.9rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.2rem;
}

.login-modal-close:hover {
  color: var(--text);
}

.login-email-input {
  display: block;
  width: 100%;
  font-family: var(--sans);
  font-size: 0.9rem;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  margin-bottom: 0.7rem;
}

.login-email-input:focus {
  outline: none;
  border-color: var(--accent);
}

.login-submit-btn {
  display: block;
  width: 100%;
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.55rem 1rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: opacity 0.15s;
}

.login-submit-btn:hover {
  opacity: 0.87;
}

.login-submit-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.login-error {
  font-size: 0.82rem;
  color: var(--accent);
  margin-bottom: 0.6rem;
}

.login-mode-toggle {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.9rem;
}

.login-mode-btn {
  background: none;
  border: none;
  font-size: 0.8rem;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.login-success-msg {
  text-align: center;
  padding: 0.5rem 0 0.2rem;
}

.login-success-msg .checkmark {
  font-size: 2rem;
  color: var(--accent);
  margin-bottom: 0.7rem;
}

.login-success-msg p {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── Profile Page ─────────────────────────────────────── */

.profile-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 2rem 3rem;
}

.profile-gated {
  padding: 2rem 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Collapsible sections */
.profile-section {
  margin-bottom: 2rem;
}

.profile-section-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 0 0 0.6rem;
  margin-bottom: 0.2rem;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  text-align: left;
}

.profile-section-header:hover {
  color: var(--accent);
}

.profile-section-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 5px;
  background: var(--tag-bg);
  border-radius: 9px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.profile-section-chevron,
.profile-section-chevron svg {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  margin-left: auto;
  transition: transform 0.18s;
  flex-shrink: 0;
}

.profile-section-header[aria-expanded="false"] .profile-section-chevron {
  transform: rotate(-90deg);
}

.profile-section-body[hidden] { display: none; }

/* Rows shared between follows and saved searches */
.profile-follow-row,
.profile-search-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--border-light);
}

.profile-follow-info,
.profile-search-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
  flex: 1;
}

.profile-follow-name,
.profile-search-label {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-follow-name:hover,
.profile-search-label:hover {
  color: var(--accent);
  text-decoration: none;
}

.profile-follow-loc,
.profile-search-summary {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.profile-row-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.profile-delete-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 0.25rem;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: var(--radius);
  transition: color 0.15s, background 0.15s;
  line-height: 1;
}

.profile-delete-btn svg,
.profile-delete-btn i {
  width: 14px;
  height: 14px;
}

.profile-delete-btn:hover {
  color: var(--accent);
  background: var(--accent-light);
}

.profile-follows-note {
  margin: 0.5rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Toggle switch */
.notif-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  flex-shrink: 0;
  user-select: none;
}

.notif-checkbox {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.notif-slider {
  position: relative;
  display: inline-block;
  width: 32px;
  height: 18px;
  background: var(--border);
  border-radius: 9px;
  transition: background 0.2s;
  flex-shrink: 0;
}

.notif-slider::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}

.notif-checkbox:checked + .notif-slider {
  background: var(--accent);
}

.notif-checkbox:checked + .notif-slider::after {
  transform: translateX(14px);
}

.notif-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Save Search Bar ──────────────────────────────────── */

.save-search-bar {
  margin: 0.6rem 0 0.2rem;
}

.save-search-bar[hidden] { display: none; }

.save-search-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 0.3rem 0.7rem;
  cursor: pointer;
  transition: all 0.15s;
}

.save-search-trigger svg,
.save-search-trigger i {
  width: 13px;
  height: 13px;
}

.save-search-trigger:hover {
  border-color: var(--accent);
  color: var(--accent);
  border-style: solid;
}

.save-search-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.6rem 0.8rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 0.4rem;
}

.save-search-form[hidden] { display: none; }

.save-search-input {
  flex: 1;
  min-width: 160px;
  font-family: var(--sans);
  font-size: 0.88rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.35rem 0.6rem;
  outline: none;
}

.save-search-input:focus {
  border-color: var(--accent);
}

.save-search-save {
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  transition: opacity 0.15s;
}

.save-search-save:hover { opacity: 0.85; }

.save-search-cancel {
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.35rem 0.65rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.save-search-cancel:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

/* ── Legal pages (Impressum, Datenschutz, Cookies) ──────── */

.legal-page {
  max-width: 720px;
}

.legal-page h1 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.legal-page .legal-updated {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 2rem;
}

.legal-page h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

.legal-page h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-top: 1.2rem;
  margin-bottom: 0.4rem;
}

.legal-page p {
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.legal-page ul {
  padding-left: 1.4rem;
  margin-bottom: 0.75rem;
  line-height: 1.7;
}

.cookie-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.2rem;
  font-size: 0.9rem;
}

.cookie-table th,
.cookie-table td {
  border: 1px solid var(--border);
  padding: 0.55rem 0.75rem;
  text-align: left;
  vertical-align: top;
}

.cookie-table th {
  background: var(--tag-bg);
  font-weight: 600;
}

.cookie-table code {
  font-family: var(--mono);
  font-size: 0.82rem;
}

/* ── Responsive ───────────────────────────────────────── */

@media (max-width: 720px) {
  header { padding: 1.2rem 1rem; }
  main { padding: 1.2rem 1rem 2rem; }

  .list-header { display: none; }

  .event-row {
    grid-template-columns: 1fr;
    gap: 0.2rem;
    padding: 0.8rem 0.5rem;
  }

  .event-row .col-date         { order: -1; font-size: 0.75rem; }
  .event-row .col-name         { font-size: 1rem; white-space: normal; }
  .event-row .col-city         { font-size: 0.8rem; }
  .event-row .col-surface      { display: none; }
  .event-row .col-size         { display: none; }
  .event-row .col-age-group    { display: none; }
  .event-row .col-updated      { display: none; }
  .event-row .col-surface-size { display: none; }
  .event-row .col-mode-meta    { display: inline; margin-left: 0.4rem; font-size: 0.78rem; color: var(--text-muted); align-self: center; }

  .detail-grid {
    grid-template-columns: 1fr;
    gap: 1.2rem;
  }

  .detail-header {
    flex-direction: column;
  }

  .detail-header-right {
    align-self: flex-start;
  }

  .filters {
    flex-direction: column;
    gap: 0.8rem;
  }

  .inbox-row {
    grid-template-columns: 1fr;
    gap: 0.15rem;
    padding: 0.7rem 0.5rem;
  }

  .inbox-row .inbox-preview { display: none; }
  .inbox-row .inbox-date { text-align: left; }
}
