:root {
  /* Palette */
  --bg: #F9F8F5;
  --card: #FFFFFF;
  --card-2: #F7F5F0;
  --text: #4A4A4A;
  --muted: #6B6B6B;
  --muted-2: #8A8A8A;

  --brand: #4A7C71;
  --brand-2: #002147;

  --border: #E5E2DA;
  --border-2: #ECE9E2;

  --danger: #B23A48;

  --ring: #9FC5BB;
  --ring-muted: #C9DDD7;

  --gradient: radial-gradient(
      1200px 600px at 0% -10%,
      color-mix(in oklab, var(--brand) 10%, transparent),
      transparent 60%
    ),
    radial-gradient(
      900px 400px at 100% -10%,
      color-mix(in oklab, var(--brand-2) 8%, transparent),
      transparent 60%
    );

  --shadow: 0 1px 3px rgba(0, 0, 0, 0.02), 0 4px 12px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.06), 0 12px 40px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 8px 32px rgba(0, 0, 0, 0.08), 0 20px 60px rgba(0, 0, 0, 0.12);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;

  --radius-1: 6px;
  --radius-2: 8px;
  --radius-3: 12px;

  --space-1: 0.5rem;
  --space-2: 0.75rem;
  --space-3: 1rem;
  --space-4: 1.25rem;
  --space-5: 1.5rem;
  --space-6: 2rem;

  --color-surface: var(--card);
  --color-surface-strong: #F3F1EB;
  --color-surface-hover: #F0EEE8;
  --color-border: var(--border);
  --color-text: var(--text);
  --color-text-muted: var(--muted);
  --color-primary: var(--brand);
  --color-primary-muted: #DDEBE7;
  --color-success: #2E7D32;
  --color-success-muted: #E8F3EA;
  --color-danger: var(--danger);
  --color-danger-muted: #F8E7EA;
  
  --transition-base: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== BASE ========== */
* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  color-scheme: light;
  font-family: "Lato", "Open Sans", "Roboto", system-ui, -apple-system, Segoe UI, Ubuntu, Cantarell, "Noto Sans", sans-serif;
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

html {
  scroll-behavior: smooth;
}

h1, h2, h3, h4 {
  font-family: "Poppins", "Montserrat", "Nunito Sans", system-ui, -apple-system, Segoe UI, sans-serif;
  color: var(--brand);
  letter-spacing: -0.01em;
  margin-top: 0;
  line-height: 1.2;
  font-feature-settings: 'kern' 1;
}

h1 { font-weight: 800; font-size: 1.777rem; }
h2 { font-weight: 700; font-size: 1.333rem; }
h3 { font-weight: 700; font-size: 1.04rem; }
h4 { font-weight: 700; font-size: 0.888rem; }

a {
  color: var(--brand);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  text-decoration: underline;
}

.container {
  max-width: 1680px;
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

/* ========== SHARED APP LAYOUT ========== */
body {
  display: flex;
  flex-direction: column;
}

main.container {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100% !important;
  max-width: 100% !important;
  margin: 0;
  padding: var(--space-2);
  padding-bottom: var(--space-2);
  overflow: hidden;
}

main.container > .card {
  margin: 0;
}

@media (min-width: 961px) {
  html,
  body {
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
  }
}

/* ========== HEADER ========== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: saturate(150%) blur(12px);
  background: linear-gradient(180deg, color-mix(in oklab, #FFFFFF 70%, transparent), transparent),
    var(--gradient);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02), 0 4px 16px rgba(0, 0, 0, 0.04);
}

.header-grid {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  justify-content: space-between;
  min-height: 72px;
}

.logo-image {
  height: 50px;
  width: auto;
  border-radius: 8px;
  object-fit: contain;
  transition: transform var(--transition-base), filter var(--transition-base);
}

.logo-image:hover {
  transform: scale(1.02);
  filter: brightness(1.05);
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-text .title {
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--brand);
  font-family: "Poppins", "Montserrat", "Nunito Sans", system-ui, -apple-system, Segoe UI, sans-serif;
}

.brand-text .subtitle {
  color: var(--muted);
  font-size: 0.95rem;
}

.nav {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.link,
a.link,
a.btn-primary {
  background: none;
  border: 1px solid transparent;
  color: var(--brand-2);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-base);
  font-family: inherit;
  font-size: 0.98rem;
  font-weight: 700;
  position: relative;
}

.link:hover,
a.link:hover {
  color: var(--brand);
  background: color-mix(in oklab, #FFFFFF 80%, transparent);
  text-decoration: none;
  transform: translateY(-1px);
}

.link:focus-visible,
a.link:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ring);
}

.divider {
  width: 1px;
  height: 26px;
  background: var(--border);
  margin: 0 var(--space-2);
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--brand-2);
  font-size: 2rem;
  cursor: pointer;
  z-index: 1001;
  padding: 0;
  line-height: 0;
  transition: transform var(--transition-fast);
}

.mobile-menu-btn:hover {
  transform: scale(1.1);
}

.mobile-nav-overlay {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: var(--space-4);
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100dvh;
  background: rgba(0, 33, 71, 0.95);
  backdrop-filter: blur(16px);
  z-index: 1000;
  opacity: 0;
  transition: opacity var(--transition-slow);
}

.mobile-nav-overlay.is-open {
  display: flex;
  opacity: 1;
}

.mobile-nav-close-btn {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  transition: transform var(--transition-fast);
}

.mobile-nav-close-btn:hover {
  transform: rotate(90deg) scale(1.1);
}

.lang-switch-slider {
  position: relative;
  display: inline-flex;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

.lang-switch-slider span {
  padding: 6px 16px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--muted);
  z-index: 1;
  transition: color var(--transition-base);
}

.lang-switch-slider::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  height: calc(100% - 4px);
  width: calc(50% - 2px);
  background: var(--card);
  border-radius: 999px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 0;
}

.lang-switch-slider[data-lang='en'] span:first-child,
.lang-switch-slider[data-lang='es'] span:last-child {
  color: var(--brand-2);
}

.lang-switch-slider[data-lang='es']::before {
  transform: translateX(100%);
}

.auth-area {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

#userName {
  color: var(--muted);
  font-size: 0.95rem;
}

.profile-button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--card-2);
  border: 2px solid var(--border);
  color: var(--brand-2);
  cursor: pointer;
  padding: 0;
  overflow: hidden;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  font-weight: 700;
  flex-shrink: 0;
  transition: all var(--transition-base);
}

.profile-button:hover {
  border-color: var(--brand);
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(74, 124, 113, 0.2);
}

/* ========== BUTTONS & CHIPS ========== */
button {
  font: inherit;
}

.btn-primary,
.btn-secondary,
.btn-ghost,
.btn-danger {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 10px 16px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-base);
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}

.btn-primary {
  background: var(--brand);
  color: #F9F8F5;
  border-color: color-mix(in oklab, var(--brand) 85%, #000);
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(74, 124, 113, 0.2), 0 1px 2px rgba(74, 124, 113, 0.15);
}

.btn-primary:hover {
  background: color-mix(in oklab, var(--brand) 95%, #fff);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(74, 124, 113, 0.3), 0 2px 4px rgba(74, 124, 113, 0.2);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(74, 124, 113, 0.2);
}

.btn-primary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--ring);
}

.btn-secondary {
  background: var(--brand-2);
  color: #FFFFFF;
  border-color: var(--brand-2);
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(0, 33, 71, 0.2);
}

.btn-secondary:hover {
  background: color-mix(in oklab, var(--brand-2) 95%, #fff);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 33, 71, 0.3);
}

.btn-ghost {
  background: transparent;
  color: var(--brand);
  border-color: var(--brand);
  border-radius: 999px;
  font-weight: 800;
}

.btn-ghost:hover {
  background: color-mix(in oklab, var(--brand) 10%, transparent);
  transform: translateY(-1px);
  border-color: color-mix(in oklab, var(--brand) 110%, #000);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: color-mix(in oklab, var(--danger) 85%, #000);
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(178, 58, 72, 0.2);
}

.btn-danger:hover {
  background: color-mix(in oklab, var(--danger) 95%, #fff);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(178, 58, 72, 0.3);
}

button[disabled],
.btn-primary[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.3);
  transform: none !important;
}

.chip {
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--color-border);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.85rem;
  white-space: nowrap;
  transition: all var(--transition-base);
  color: var(--brand-2);
  background: var(--color-surface);
  position: relative;
}

.chip:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-color: color-mix(in oklab, var(--brand) 50%, var(--border));
}

.chip-toggle {
  background: transparent;
}

.chip.active {
  font-weight: 800;
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--brand), 0 2px 8px rgba(74, 124, 113, 0.15);
  color: var(--brand);
}

.chip[data-rsvp="going"].active {
  background: var(--color-success-muted);
  color: var(--color-success);
  border-color: var(--color-success);
  box-shadow: inset 0 0 0 1px var(--color-success), 0 2px 8px rgba(46, 125, 50, 0.15);
}

.chip[data-rsvp="interested"].active {
  background: color-mix(in oklab, orange 15%, transparent);
  color: #d06900;
  border-color: orange;
  box-shadow: inset 0 0 0 1px orange, 0 2px 8px rgba(255, 165, 0, 0.15);
}

.chip[data-rsvp="not_going"].active {
  background: var(--color-danger-muted);
  color: var(--color-danger);
  border-color: var(--color-danger);
  box-shadow: inset 0 0 0 1px var(--color-danger), 0 2px 8px rgba(178, 58, 72, 0.15);
}

.chip#btnFollowCompact.active {
  background: var(--color-primary-muted);
  color: var(--color-primary);
  border-color: var(--color-primary);
  box-shadow: inset 0 0 0 1px var(--color-primary), 0 2px 8px rgba(74, 124, 113, 0.15);
}

/* ========== SURFACES / CARDS ========== */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
  box-shadow: var(--shadow);
  margin-top: var(--space-4);
  margin-bottom: 0;
  transition: box-shadow var(--transition-base), border-color var(--transition-base);
}

.hero {
  background:
    radial-gradient(900px 550px at 15% -20%, color-mix(in oklab, var(--brand) 14%, transparent), transparent 65%),
    radial-gradient(900px 550px at 85% -20%, color-mix(in oklab, var(--brand-2) 12%, transparent), transparent 65%),
    linear-gradient(180deg, #FFFFFF 0%, var(--card) 80%);
  border-color: color-mix(in oklab, var(--border) 70%, transparent);
}

.hero h1 {
  margin: 0 0 0.25rem;
  font-size: clamp(1.42rem, 2vw + 0.89rem, 2.04rem);
  letter-spacing: -0.02em;
}

.hero p {
  color: var(--text);
  font-size: 1rem;
}

.meta {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  color: var(--muted);
  margin-top: var(--space-2);
}

.meta-item {
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  color: var(--brand-2);
  font-weight: 700;
  transition: all var(--transition-base);
}

.meta-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* ========== AUTH SHARED ========== */
.auth-centered {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) 0;
  max-width: 380px;
  margin: 0 auto;
}

.btn-social {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 12px 20px;
  font-size: 1rem;
  font-weight: 800;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-base);
}

.btn-social:active {
  transform: translateY(1px);
}

.btn-social svg {
  width: 22px;
  height: 22px;
}

.btn-google {
  background: white;
  color: #333;
  border: 1px solid #ddd;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.btn-google:hover {
  background: #f7f7f7;
  border-color: #ccc;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  transform: translateY(-1px);
}

.btn-google:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--ring-muted);
}

.separator {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--muted-2);
  width: 100%;
}

.separator::before,
.separator::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border);
}

.separator:not(:empty)::before {
  margin-right: 0.75em;
}

.separator:not(:empty)::after {
  margin-left: 0.75em;
}

.auth-form-secondary {
  display: flex;
  gap: var(--space-2);
  width: 100%;
}

.auth-form-secondary input {
  flex-grow: 1;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--text);
  transition: all var(--transition-base);
}

.auth-form-secondary input:hover {
  border-color: color-mix(in oklab, var(--border) 50%, var(--brand) 30%);
}

.auth-form-secondary input:focus-visible {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--ring);
  background: var(--card);
}

#profile > .btn-ghost {
  margin-bottom: var(--space-3);
}

/* ========== SECTION HEADER + SEARCH ========== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
}

.search-controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.search-bar input {
  width: clamp(220px, 28vw, 280px);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--text);
  transition: all var(--transition-base);
}

.search-bar input::placeholder {
  color: color-mix(in oklab, var(--muted) 75%, white 5%);
}

.search-bar input:hover {
  border-color: color-mix(in oklab, var(--border) 50%, var(--brand) 30%);
}

.search-bar input:focus-visible {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--ring);
  background: var(--card);
}

/* ========== VIEW SWITCH ========== */
.view-switch {
  display: flex;
  gap: 8px;
  margin: 10px 0;
}

/* ========== EVENT CARD & GRID ========== */
.events-grid, #archiveList {
  display: grid;
  grid-auto-rows: min-content;
  gap: var(--space-3);
  padding: var(--space-1);
  overflow-y: auto;
}

#eventsList, #archiveList {
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
}

@supports (scrollbar-gutter: stable) {
  .events-grid, #archiveList {
    scrollbar-gutter: stable;
    padding-right: var(--space-2);
  }
}

.event-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: all var(--transition-base);
  min-height: 320px;
  padding: var(--space-3);
  overflow: hidden;
}

.event-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  opacity: 0;
  transition: opacity var(--transition-base);
}

.event-card:hover::before {
  opacity: 1;
}

.event-card:hover {
  transform: translateY(-4px);
  border-color: var(--brand);
  box-shadow: var(--shadow-lg);
}

.event-card .when {
  font-size: 0.95rem;
  color: var(--muted);
  margin-bottom: var(--space-1);
  font-weight: 600;
}

.event-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-2);
}

.event-title {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: var(--space-1);
  color: var(--brand-2);
  letter-spacing: -0.01em;
}

.event-speaker {
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
}

.event-desc {
  flex-grow: 1;
  margin: var(--space-2) 0;
  max-height: 150px;
  overflow-y: auto;
  padding-right: var(--space-1);
  line-height: 1.6;
  font-size: 0.95rem;
  color: var(--muted);
}

.event-desc::-webkit-scrollbar {
  width: 6px;
}

.event-desc::-webkit-scrollbar-track {
  background: transparent;
}

.event-desc::-webkit-scrollbar-thumb {
  background-color: var(--border);
  border-radius: 10px;
}

.event-card .tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  align-items: center;
  margin-top: auto;
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
}

.tag, .tag-topic {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--brand-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  background: var(--card-2);
  transition: all var(--transition-fast);
}

.tag:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.tag.status-scheduled {
  color: var(--brand);
  border-color: color-mix(in oklab, var(--brand) 40%, var(--border));
  background: var(--color-primary-muted);
}

.tag.status-completed {
  color: var(--color-success);
  border-color: color-mix(in oklab, var(--color-success) 40%, var(--border));
  background: var(--color-success-muted);
}

.tag.tag-success {
  color: var(--color-success);
  border-color: color-mix(in oklab, var(--color-success) 40%, var(--border));
  background: var(--color-success-muted);
}

.tag.status-canceled {
  color: var(--color-danger);
  border-color: color-mix(in oklab, var(--color-danger) 40%, var(--border));
  background: var(--color-danger-muted);
}

.event-card .actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

/* ========== EVENT DETAIL VIEW ========== */
#eventDetail.card {
  padding: 0;
  border: none;
  background: none;
  box-shadow: none;
}

.tab-panel {
  flex-grow: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#discussion-layout {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: var(--space-4);
  flex-grow: 1;
  min-height: 0;
}

.sidebar-container,
#discussion-main {
  background-color: var(--color-surface);
  border-radius: var(--radius-3);
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sidebar-container {
  overflow-y: auto;
}

.sidebar-container #compactEventHeaderContainer {
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-3);
  flex-shrink: 0;
}

.sidebar-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.sidebar-title-row h2 {
  margin: 0;
  font-size: 1.4rem;
  line-height: 1.25;
  font-weight: 700;
  flex: 1;
  color: var(--brand-2);
  letter-spacing: -0.01em;
}

.btn-pill {
  border-radius: 999px;
  border: 1px solid var(--color-border);
  padding: 0.2rem 0.6rem;
  font-size: 0.85rem;
  background: var(--color-surface-strong);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-base);
}

.btn-pill:hover {
  background-color: var(--color-surface-hover);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.event-speakers {
  margin-top: var(--space-2);
}

.speaker-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
}

.speaker-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--spk-color, var(--color-primary));
  background: color-mix(in oklab, var(--spk-color, var(--color-primary)) 12%, transparent);
  font-size: 0.9rem;
  line-height: 1.1;
  color: var(--color-text);
  transition: all var(--transition-base);
}

.speaker-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.speaker-affiliation {
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.sidebar-meta {
  margin-top: var(--space-2);
  color: var(--color-text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.95rem;
}

.sidebar-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: var(--space-2);
}

.zoom-inline {
  margin-top: var(--space-3);
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.event-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: var(--space-3);
}

/* Tabs */
.tabs {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.tab {
  background: none;
  border: none;
  color: var(--color-text-muted);
  padding: 0.7rem 0.3rem;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.95rem;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-base);
  border-radius: 6px 6px 0 0;
  position: relative;
}

.tab::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--brand);
  transform: scaleX(0);
  transition: transform var(--transition-base);
}

.tab:hover {
  color: var(--brand-2);
  background-color: var(--color-surface-hover);
}

.tab.active {
  color: var(--brand);
}

.tab.active::after {
  transform: scaleX(1);
}

/* Description / Prose */
.prose {
  line-height: 1.7;
  color: var(--color-text);
  font-size: 1rem;
  overflow-y: auto;
  padding-right: var(--space-2);
}

.prose a {
  color: var(--brand);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in oklab, var(--brand) 35%, transparent);
  transition: border-color var(--transition-fast);
}

.prose a:hover {
  border-bottom-color: var(--brand);
}

/* Inline forms */
.inline-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: var(--space-3);
}

.inline-form input[type="text"] {
  flex: 1;
  min-width: 200px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--text);
  transition: all var(--transition-base);
}

.inline-form input[type="text"]:hover {
  border-color: color-mix(in oklab, var(--border) 50%, var(--brand) 30%);
}

.inline-form input[type="text"]:focus-visible {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--ring);
  background: var(--card);
}

/* Threads & Comments */
#threadsList {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.thread-list-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-2);
  padding: var(--space-2);
  border-radius: var(--radius-2);
  cursor: pointer;
  transition: all var(--transition-base);
  align-items: center;
}

.thread-list-item:hover {
  background-color: var(--color-surface-hover);
  transform: translateY(-1px);
}

.thread-list-item.active {
  background-color: var(--color-primary-muted);
  box-shadow: inset 0 0 0 1px var(--brand);
}

.thread-list-item .title {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--brand-2);
}

.thread-list-item .meta {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: var(--color-surface-strong);
  display: grid;
  place-content: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
  color: var(--brand-2);
  border: 1px solid var(--color-border);
  transition: all var(--transition-base);
}

.avatar-circle:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#thread-welcome {
  flex-grow: 1;
  display: grid;
  place-content: center;
  color: var(--color-text-muted);
  text-align: center;
  padding: var(--space-4);
}

#threadDetailView {
  flex-grow: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
}

#commentsList {
  flex-grow: 1;
  overflow-y: auto;
  padding: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.comment-node {
  display: block;
  position: relative;
}

.comment-author {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.avatar-circle.comment-avatar {
  width: 26px;
  height: 26px;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--color-text);
}

.comment-author strong {
  font-weight: 700;
  cursor: pointer;
  color: var(--brand-2);
  transition: color var(--transition-fast);
}

.comment-author strong:hover {
  color: var(--brand);
}

.comment-author .timestamp {
  color: var(--color-text-muted);
}

.comment-body-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-1);
}

.comment-bubble {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: calc(var(--space-2) - 2px) var(--space-3);
  background: var(--color-surface-strong);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-2);
  max-width: 100%;
  transition: all var(--transition-base);
}

.comment-bubble:hover {
  background: var(--color-surface-hover);
}

.comment-text {
  margin: 0;
  line-height: 1.6;
  font-size: 0.98rem;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.comment-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.comment-actions .btn-ghost {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-text-muted);
  padding: var(--space-1) 0;
  transition: color var(--transition-fast);
}

.comment-actions .btn-ghost:hover {
  color: var(--brand);
}

.comment-replies {
  margin-top: var(--space-2);
  margin-left: 28px;
  padding-left: 16px;
  border-left: 2px solid var(--color-surface-strong);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  position: relative;
}

.comment-replies:empty {
  border-left: none;
  padding-left: 0;
  margin-left: 0;
}

.comment-main {
  position: relative;
}

.thread-dot {
  position: absolute;
  left: -25px;
  top: 12px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-surface);
  border: 2px solid var(--accent, var(--color-primary));
  box-shadow: 0 0 0 3px var(--color-surface);
  pointer-events: none;
}

.comment-node.depth-0>.comment-main .thread-dot {
  display: none;
}

.inline-reply-form {
  margin-top: var(--space-2);
}

#replyToThreadForm {
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

#replyToThreadForm textarea {
  flex-grow: 1;
  resize: none;
}

#replyToThreadForm textarea,
.comment textarea {
  width: 100%;
  min-height: 90px;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--text);
  transition: all var(--transition-base);
}

#replyToThreadForm textarea:hover,
.comment textarea:hover {
  border-color: color-mix(in oklab, var(--border) 50%, var(--brand) 30%);
}

#replyToThreadForm textarea:focus-visible,
.comment textarea:focus-visible {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--ring);
  background: var(--card);
}

/* Files */
.files {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  margin-top: 10px;
}

.file {
  border: 1px solid var(--border);
  background: var(--card-2);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  transition: all var(--transition-base);
}

.file:hover {
  border-color: var(--brand);
  background: #F4F2ED;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.file .meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.file .name {
  font-weight: 700;
  color: var(--brand-2);
}

.file .size {
  color: var(--muted);
  font-size: 0.9rem;
}

/* Admin form */
.admin-layout {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: var(--space-6);
  margin-top: var(--space-4);
}

.grid-form {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, 1fr);
}

.grid-form input,
.grid-form textarea,
.grid-form select {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--text);
  transition: all var(--transition-base);
}

.grid-form textarea {
  min-height: 110px;
  resize: vertical;
}

.grid-form input:hover,
.grid-form textarea:hover,
.grid-form select:hover {
  border-color: color-mix(in oklab, var(--border) 50%, var(--brand) 30%);
}

.grid-form input:focus-visible,
.grid-form textarea:focus-visible,
.grid-form select:focus-visible {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--ring);
  background: var(--card);
}

.col-span-2 {
  grid-column: span 2;
}

.admin-side {
  display: grid;
  gap: 12px;
  align-content: start;
}

.subheading {
  margin: 10px 0 4px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--brand-2);
}

.slot-item {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
}

.slot-conflicts .conflict-row {
  padding: 6px 0;
  color: var(--color-danger);
}

.muted {
  color: var(--muted-2);
}

/* ========== CALENDAR ========== */
.calendar {
  margin-top: 10px;
}

.calendar.mini {
  margin-top: 0;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 8px;
}

.cal-label {
  font-weight: 800;
  color: var(--brand-2);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  background: linear-gradient(180deg, #FFFFFF, transparent);
  padding: 6px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.calendar-grid .dow {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 4px 0;
  font-weight: 600;
}

.cal-cell {
  min-height: 100px;
  padding: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-1);
  transition: all var(--transition-base);
}

.cal-cell:hover {
  border-color: color-mix(in oklab, var(--brand) 50%, var(--border));
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.cal-day {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: var(--space-1);
  color: var(--muted);
  align-self: flex-end;
}

.cal-event {
  display: block;
  width: 100%;
  padding: var(--space-2);
  margin-top: var(--space-1);
  font-size: 0.8rem;
  line-height: 1.35;
  text-align: left;
  border: none;
  border-radius: var(--radius-1);
  cursor: pointer;
  transition: all var(--transition-base);
  overflow: hidden;
}

.cal-event-title {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: var(--space-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--brand-2);
}

.cal-event-desc {
  font-size: 0.78rem;
  line-height: 1.3;
  opacity: 0.85;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--text);
}

.cal-event.status-scheduled {
  background-color: var(--color-primary-muted);
  color: var(--color-primary);
  border-left: 3px solid var(--color-primary);
}

.cal-event.status-completed {
  background-color: var(--color-success-muted);
  color: var(--color-success);
  border-left: 3px solid var(--color-success);
}

.cal-event.status-canceled {
  background-color: var(--color-danger-muted);
  color: var(--color-danger);
  border-left: 3px solid var(--color-danger);
}

.cal-event:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* Calendar Legend */
.calendar-legend {
  display: none;
}

#schedule.calendar-view .calendar-legend {
  display: flex;
  gap: 10px;
  margin-top: 0;
}

.legend {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 700;
}

.legend.scheduled::before,
.legend.completed::before,
.legend.canceled::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
}

.legend.scheduled::before {
  background: var(--color-primary-muted);
  box-shadow: inset 0 0 0 2px var(--color-primary);
}

.legend.completed::before {
  background: var(--color-success-muted);
  box-shadow: inset 0 0 0 2px var(--color-success);
}

.legend.canceled::before {
  background: var(--color-danger-muted);
  box-shadow: inset 0 0 0 2px var(--color-danger);
}

/* Speakers */
.speakers-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.speaker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: all var(--transition-base);
}

.speaker:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.speaker-name {
  font-weight: 700;
  color: var(--brand-2);
}

/* Edit event panel */
.edit-event {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

/* Empty states */
.empty {
  text-align: center;
  color: var(--muted);
  padding: 36px 10px;
  background: linear-gradient(180deg, #FFFFFF, transparent);
  border-radius: var(--radius-sm);
}

/* ========== FOOTER ========== */
.site-footer {
  border-top: 1px solid var(--border);
  color: #EAF0F6;
  padding: 20px 0;
  margin-top: 0;
  background: var(--brand-2);
}

.site-footer a {
  color: #EAF0F6;
  transition: color var(--transition-fast);
}

.site-footer a:hover {
  color: #FFFFFF;
}

/* ========== FLASH TOAST ========== */
.flash {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--brand-2);
  border: 1px solid color-mix(in oklab, var(--brand-2) 75%, #000);
  color: #fff;
  padding: 12px 16px;
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  display: none;
  z-index: 30;
  animation: toast-in 0.18s ease-out both;
}

@keyframes toast-in {
  from {
    transform: translateX(-50%) translateY(6px);
    opacity: 0;
  }
  to {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }
}

/* ========== MISC / HELPERS ========== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.loader-container {
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

input,
textarea,
select,
button {
  font-family: inherit;
}

input[type='search'] {
  -webkit-appearance: none;
  appearance: none;
}

::placeholder {
  color: color-mix(in oklab, var(--muted) 75%, white 5%);
}

/* Scrollbar (WebKit) */
*::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

*::-webkit-scrollbar-thumb {
  background: #D7D3CA;
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
  transition: background var(--transition-fast);
}

*::-webkit-scrollbar-thumb:hover {
  background: #CFCABF;
  border-width: 2px;
}

*::-webkit-scrollbar-track {
  background: #F1EFEA;
}

/* --- Styles for about.html --- */
main.section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
  box-shadow: var(--shadow);
  margin: var(--space-4) auto;
}

#map {
  height: 500px;
  border-radius: var(--radius-sm);
  background-color: var(--card-2);
  border: 1px solid var(--border);
  margin-bottom: var(--space-6);
}

.leaflet-popup-content-wrapper, .leaflet-popup-tip {
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}

.leaflet-popup-content b {
  color: var(--brand);
}

.leaflet-container a.leaflet-popup-close-button {
  color: var(--muted);
  transition: color var(--transition-fast);
}

.leaflet-container a.leaflet-popup-close-button:hover {
  color: var(--brand-2);
}

.leaflet-control-attribution, .leaflet-control-attribution a {
  color: var(--muted-2) !important;
}

.leaflet-legend {
  padding: 1rem;
  background: color-mix(in oklab, var(--card) 90%, transparent);
  backdrop-filter: blur(5px);
  border-radius: 8px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  line-height: 1.8;
  color: var(--text);
}

.leaflet-legend strong {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 1rem;
  color: var(--brand-2);
}

.leaflet-legend div {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#detailed-sites-wrapper .detailed-content-section {
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--border);
}

#detailed-sites-wrapper .detailed-content-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.alternating-item {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
  align-items: center;
  margin-top: var(--space-4);
}

.alternating-item:nth-child(even) .alternating-item__text {
  order: 2;
}

.alternating-item__image img {
  width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.alternating-item__image img:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-md);
}

.alternating-item__text h3 {margin-top: 0;
}

.alternating-item__text p {
  color: var(--muted);
}

.citation-link {
  font-size: 0.8em;
  vertical-align: super;
  margin: 0 2px;
}

/* Main containers */
main.main-content {
  width: 100%;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-3);
  box-sizing: border-box;
}

/* --- Signin Page Styles --- */
.auth-page-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-grow: 1;
  padding: var(--space-4);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: var(--space-5);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.auth-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.auth-card h1 {
  text-align: center;
  margin-top: 0;
  margin-bottom: var(--space-4);
}

.auth-card .btn-social {
  margin-bottom: var(--space-2);
}

.auth-card .separator {
  margin: var(--space-2) 0;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1024px) {
  .admin-layout {
    grid-template-columns: 1fr;
    gap: var(--space-5);
  }
}

@media (max-width: 960px) {
  /* HEADER & NAV */
  .mobile-menu-btn {
    display: block;
  }
  .header-grid > .nav {
    display: none;
  }
  .mobile-nav-overlay .nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-4);
  }
  .mobile-nav-overlay .link {
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
  }
  .mobile-nav-overlay .divider {
    display: none;
  }
  .mobile-nav-overlay .auth-area {
    margin-top: var(--space-2);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
  }
  .mobile-nav-overlay #userName {
    color: #fff;
  }
  .mobile-nav-overlay .profile-button {
    border-color: #fff;
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
  }
  .mobile-nav-overlay .auth-area .btn-primary,
  .mobile-nav-overlay .auth-area .btn-ghost {
    background: transparent;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.8);
    padding: 10px 24px;
    min-width: 120px;
  }
  .mobile-nav-overlay .auth-area .btn-primary:hover,
  .mobile-nav-overlay .auth-area .btn-ghost:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #fff;
  }
  body.menu-open {
    overflow: hidden;
  }

  /* EVENT DETAIL VIEW */
  #discussion-layout {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }
  .sidebar-container,
  #discussion-main {
    overflow-y: visible;
  }
}

@media (max-width: 840px) {
  #eventsList,
  #archiveList {
    grid-template-columns: 1fr;
  }
  .alternating-item {
    grid-template-columns: 1fr;
  }
  .alternating-item:nth-child(even) .alternating-item__text {
    order: 0;
  }
  .search-controls {
    flex-grow: 1;
    justify-content: space-between;
  }
}

@media (max-width: 680px) {
  .grid-form {
    grid-template-columns: 1fr;
  }
  .header-grid {
    gap: var(--space-2);
  }
  .nav {
    gap: 6px;
  }
}

@media (max-width: 768px) {
  .title {
    flex-direction: column;
    align-items: flex-start !important;
    gap: var(--space-1) !important;
  }
  #siteBanner {
    font-size: 0.85rem !important;
    padding: 3px 10px !important;
    white-space: normal !important;
    max-width: 100%;
  }
}

/* ========== EDIT/DELETE & FILE STYLES ========== */

/* Small icon buttons for edit/delete */
.btn-icon {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  color: var(--color-text-muted);
  opacity: 0.7;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}
.btn-icon:hover {
  opacity: 1;
  transform: scale(1.1);
  color: var(--brand-2);
  background-color: var(--color-surface-hover);
}
.btn-icon.delete {
  color: var(--color-danger);
}
.btn-icon.delete:hover {
  color: #fff;
  background-color: var(--color-danger);
}

/* Thread list item styling */
.thread-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.thread-content {
  display: flex;
  gap: var(--space-2);
  flex-grow: 1;
  align-items: center;
  min-width: 0;
}
.thread-info {
  flex-grow: 1;
  min-width: 0;
}
.thread-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--transition-fast);
  flex-shrink: 0;
}
.thread-list-item:hover .thread-actions {
  opacity: 1;
}

/* Comment action buttons */
.comment-action-buttons {
  margin-left: auto;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--transition-fast);
}
.comment-node:hover .comment-action-buttons,
.comment-bubble:hover .comment-action-buttons {
  opacity: 1;
}

/* Inline edit forms */
.inline-edit-form {
  display: flex;
  gap: var(--space-1);
  align-items: center;
  margin: var(--space-1) 0;
  width: 100%;
}
.edit-input {
  flex-grow: 1;
  padding: var(--space-1);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: inherit;
  font-family: inherit;
  background: var(--card-2);
  transition: all var(--transition-base);
}
.edit-input:focus-visible {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--ring);
  background: var(--card);
}
.edit-textarea {
  width: 100%;
  padding: var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: inherit;
  font-family: inherit;
  min-height: 60px;
  resize: vertical;
  background: var(--card-2);
  transition: all var(--transition-base);
}
.edit-textarea:focus-visible {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--ring);
  background: var(--card);
}
.edit-buttons {
  display: flex;
  gap: 4px;
  margin-top: var(--space-1);
}

/* File card with small delete button */
.file-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--card-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: var(--space-2);
  transition: all var(--transition-base);
}
.file-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--brand);
}
.file-icon {
  font-size: 2em;
  flex-shrink: 0;
  color: var(--brand-2);
}
.file-info {
  flex-grow: 1;
  min-width: 0;
}
.file-name {
  font-weight: 700;
  word-break: break-word;
  color: var(--brand-2);
}
.file-meta {
  font-size: 0.9em;
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}
.file-actions {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  flex-shrink: 0;
}
@media (max-width: 640px) {
  .file-card {
    flex-direction: column;
    align-items: flex-start;
  }
  .file-actions {
    width: 100%;
    justify-content: flex-end;
    margin-top: var(--space-2);
  }
  .thread-actions,
  .comment-action-buttons {
    opacity: 1;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.02);
    opacity: 0.95;
  }
}