/* ============================================================
   Chip Lyeth Paper Group — Stylesheet
   Large, clean, high-contrast design for readability
   ============================================================ */

/* --- Reset & base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --color-primary:    #2c5f2e;   /* deep green — wine country feel */
  --color-primary-dk: #1a3d1c;
  --color-accent:     #8b1a1a;   /* deep red */
  --color-bg:         #f9f6f1;   /* warm off-white */
  --color-surface:    #ffffff;
  --color-border:     #d8cfc4;
  --color-text:       #1a1a1a;
  --color-muted:      #666;
  --color-success:    #2d6a30;
  --color-danger:     #8b1a1a;
  --color-warning:    #7a5a00;
  --color-info:       #1a4a6e;
  --font-body: Georgia, 'Times New Roman', serif;
  --font-ui:   -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius:    6px;
  --shadow:    0 2px 8px rgba(0,0,0,0.10);
  --shadow-lg: 0 4px 20px rgba(0,0,0,0.14);
}

html { font-size: 18px; }  /* Base size—larger for readability */

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

a { color: var(--color-primary); text-decoration: underline; }
a:hover { color: var(--color-primary-dk); }

img { max-width: 100%; height: auto; display: block; }

/* --- Navigation --- */
.navbar {
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0 2rem;
  height: 60px;
  font-family: var(--font-ui);
  font-size: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* Hamburger toggle — hidden on desktop */
.nav-toggle-input { display: none; }
.nav-toggle-label { display: none; }
.nav-toggle-label::before { content: '☰'; }

/* Nav menu groups links + user — flex row on desktop */
.nav-menu {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 1.5rem;
}

.nav-brand a {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.03em;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 0.25rem;
  flex: 1;
}

.nav-links a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius);
  transition: background 0.15s;
}

.nav-links a:hover,
.nav-links a.active {
  background: rgba(255,255,255,0.18);
  color: #fff;
}

/* --- Nav user dropdown --- */
.nav-user {
  position: relative;
  display: flex;
  align-items: center;
  font-size: 0.9rem;
}

/* Mobile-only username label — hidden on desktop */
.nav-user-name { display: none; }

/* Hide the checkbox */
.user-toggle-input { display: none; }

/* Username button */
.user-toggle-label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  color: rgba(255,255,255,0.85);
  cursor: pointer;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius);
  transition: background 0.15s;
  font-family: var(--font-ui);
  user-select: none;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.user-toggle-label:hover { background: rgba(255,255,255,0.18); color: #fff; }
.user-toggle-label:focus { outline: none; }

/* Down-caret rotates when open */
.user-caret {
  font-size: 0.7em;
  display: inline-block;
  transition: transform 0.15s;
}
.user-toggle-input:checked ~ .user-toggle-label .user-caret { transform: rotate(180deg); }

/* Dropdown panel */
.user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 170px;
  z-index: 300;
  overflow: hidden;
}
.user-toggle-input:checked ~ .user-dropdown { display: block; }

.user-dropdown a {
  display: block;
  padding: 0.65rem 1.1rem;
  color: var(--color-text);
  text-decoration: none;
  font-family: var(--font-ui);
  font-size: 0.95rem;
  border-bottom: 1px solid var(--color-border);
  transition: background 0.12s;
}
.user-dropdown a:last-child { border-bottom: none; }
.user-dropdown a:hover,
.user-dropdown a.active { background: #f5f1ec; color: var(--color-primary-dk); }

/* --- Main content --- */
.main-content {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 2rem 3rem;
}

/* --- Flash messages --- */
.flash-messages { margin-bottom: 1.5rem; }

.flash {
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  font-family: var(--font-ui);
  font-size: 0.95rem;
}

.flash-success { background: #d4edda; color: var(--color-success); border: 1px solid #b8dfc0; }
.flash-danger  { background: #f8d7da; color: var(--color-danger);  border: 1px solid #f1b0b7; }
.flash-info    { background: #d1ecf1; color: var(--color-info);    border: 1px solid #a8d8df; }
.flash-warning { background: #fff3cd; color: var(--color-warning); border: 1px solid #ffeaa0; }

/* --- Page header --- */
.page-header {
  display: flex;
  align-items: baseline;
  gap: 1.5rem;
  margin-bottom: 2rem;
  border-bottom: 2px solid var(--color-border);
  padding-bottom: 1rem;
  flex-wrap: wrap;
}

.page-header h1 {
  font-family: var(--font-body);
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-primary-dk);
  flex: 1;
}

/* Wrapper so title stacks above author/date on paper detail page */
.paper-header-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.paper-header-body h1 {
  flex: unset;
}

.section-heading {
  font-size: 1.4rem;
  color: var(--color-primary-dk);
  margin-bottom: 1rem;
  font-family: var(--font-body);
}

/* --- Cards --- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow);
}

.card h2 {
  font-size: 1.3rem;
  color: var(--color-primary-dk);
  margin-bottom: 1rem;
  font-family: var(--font-body);
}

/* --- Buttons --- */
.btn {
  display: inline-block;
  padding: 0.6rem 1.4rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s, transform 0.1s;
  line-height: 1.4;
}

.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0); }

.btn-primary  { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dk); color: #fff; }

.btn-secondary { background: #e8e2d9; color: var(--color-text); }
.btn-secondary:hover { background: #d8cfc4; }

.btn-danger  { background: var(--color-danger); color: #fff; }
.btn-danger:hover { background: #6e1414; color: #fff; }

.btn-warning { background: #c8960a; color: #fff; }
.btn-warning:hover { background: #a67a08; color: #fff; }

.btn-small { padding: 0.3rem 0.75rem; font-size: 0.85rem; }
.btn-sm    { padding: 0.25rem 0.65rem; font-size: 0.82rem; }

/* Colander signup page */
.colander-mine  { font-weight: 600; color: var(--color-primary-dk); }
.colander-taken { color: var(--color-text); }
.btn-remove {
  background: none;
  border: none;
  color: var(--color-danger, #b91c1c);
  font-size: 0.78rem;
  cursor: pointer;
  padding: 0 0 0 0.4rem;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.btn-remove:hover { color: #7f1d1d; }

/* Ghost button — nav-link style: transparent at rest, soft fill on hover */
.btn-ghost {
  background: transparent;
  color: var(--color-primary);
  font-weight: 500;
}
.btn-ghost:hover {
  background: rgba(44, 95, 46, 0.1);
  color: var(--color-primary-dk);
  transform: none;
}
.btn-full  { width: 100%; text-align: center; padding: 0.85rem; font-size: 1.1rem; }

.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }

/* --- Login page --- */
.login-page {
  background: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-container {
  width: 100%;
  max-width: 440px;
  padding: 1.5rem;
}

.login-card {
  background: var(--color-surface);
  border-radius: 10px;
  padding: 2.5rem 2.5rem 2rem;
  box-shadow: var(--shadow-lg);
}

.login-title {
  font-size: 2rem;
  color: var(--color-primary-dk);
  text-align: center;
  margin-bottom: 0.25rem;
  line-height: 1.2;
}

.login-subtitle {
  text-align: center;
  color: var(--color-muted);
  font-size: 0.95rem;
  margin-bottom: 2rem;
  font-family: var(--font-ui);
}

.login-form { margin-top: 1.5rem; }
.form-group-check { margin-bottom: 1rem; }
.check-label { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; cursor: pointer; }
.check-label input[type="checkbox"] { width: auto; margin: 0; }

.login-help {
  text-align: center;
  font-size: 0.9rem;
  color: var(--color-muted);
  margin-top: 1.25rem;
  font-family: var(--font-ui);
}

/* --- Form elements --- */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-family: var(--font-ui);
  font-weight: 600;
  margin-bottom: 0.4rem;
  font-size: 1rem;
  color: var(--color-text);
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group input[type="email"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: var(--font-ui);
  background: #fff;
  color: var(--color-text);
  transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-primary);
}

.form-group textarea { resize: vertical; }

.form-group input[type="checkbox"] {
  width: auto;
  margin-right: 0.5rem;
  transform: scale(1.3);
  cursor: pointer;
}

.form-group input[type="file"] {
  font-family: var(--font-ui);
  font-size: 0.95rem;
  margin-top: 0.25rem;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
  flex-wrap: wrap;
}

.form-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 650px;
  box-shadow: var(--shadow);
}

.field-hint {
  font-size: 0.85rem;
  color: var(--color-muted);
  margin-top: 0.3rem;
  font-family: var(--font-ui);
}

.required { color: var(--color-accent); }

/* --- Dashboard --- */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 700px) { .dashboard-grid { grid-template-columns: 1fr; } }

.meeting-highlight { margin-bottom: 1rem; }

.meeting-date-big {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-primary-dk);
  margin-bottom: 0.75rem;
}

.meeting-detail-row {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 0.3rem;
  font-size: 1rem;
}

.label {
  font-family: var(--font-ui);
  font-weight: 600;
  color: var(--color-muted);
  min-width: 90px;
}

.recent-papers-list {
  list-style: none;
}

.recent-papers-list li {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--color-border);
}

.recent-papers-list li:last-child { border-bottom: none; }

.recent-papers-list a {
  font-size: 1.05rem;
  color: var(--color-primary);
  font-weight: 600;
}

/* --- Members grid --- */
.members-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.5rem;
}

.member-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s;
}

.member-card:hover { box-shadow: var(--shadow-lg); }

.member-photo-wrap {
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  background: #e8e2d9;
}

.member-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.member-info {
  padding: 1rem 1.1rem 1.25rem;
}

.member-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-primary-dk);
  margin-bottom: 0.2rem;
}

.member-year {
  font-size: 0.85rem;
  color: var(--color-muted);
  font-family: var(--font-ui);
  margin-bottom: 0.5rem;
}

.member-bio {
  font-size: 0.95rem;
  color: var(--color-text);
  margin-bottom: 0.5rem;
}

.member-papers-count {
  font-size: 0.9rem;
  font-family: var(--font-ui);
}

.member-edit-link {
  display: inline-block;
  margin-top: 0.65rem;
  font-size: 0.8rem;
  font-family: var(--font-ui);
  color: var(--color-muted);
  text-decoration: none;
  border-bottom: 1px dotted currentColor;
}
.member-edit-link:hover { color: var(--color-primary); }

/* --- Papers archive --- */
.search-bar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.search-controls {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 200px;
  padding: 0.65rem 0.9rem;
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: var(--font-ui);
}

.search-input:focus { outline: none; border-color: var(--color-primary); }

.search-select {
  padding: 0.65rem 0.9rem;
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: var(--font-ui);
  background: #fff;
}

.result-count {
  font-family: var(--font-ui);
  color: var(--color-muted);
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.papers-list { display: flex; flex-direction: column; gap: 0.75rem; }

.paper-row {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.1rem 1.4rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  box-shadow: var(--shadow);
}

.paper-row-main { flex: 1; }

.paper-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-primary);
  display: block;
  margin-bottom: 0.2rem;
  text-decoration: none;
}

a.paper-title:hover { text-decoration: underline; }

.paper-meta {
  font-size: 0.9rem;
  color: var(--color-muted);
  font-family: var(--font-ui);
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.3rem;
}

.paper-meta.large {
  font-size: 1.05rem;
  margin-top: 0.5rem;
  margin-bottom: 0;
}

.paper-description {
  font-size: 0.95rem;
  color: #444;
  margin-top: 0.3rem;
}

.paper-row-actions { flex-shrink: 0; }

.paper-author-photo {
  flex-shrink: 0;
}

.author-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 2px solid var(--color-border);
  transition: border-color 0.15s;
}

.paper-author-photo a { display: block; }
.paper-author-photo a:hover .author-avatar { border-color: var(--color-primary); }

.pdf-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25em;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
  border-radius: 3px;
  padding: 0.15em 0.4em;
  line-height: 1;
  text-decoration: none;
  opacity: 0.75;
  transition: opacity 0.15s;
}
.pdf-badge:hover { opacity: 1; text-decoration: none; }

/* --- Paper detail --- */

/* Mobile CTA hidden on desktop; shown only on mobile */
.pdf-mobile-cta { display: none; }

.pdf-viewer-wrap {
  width: 100%;
  height: 700px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #f0f0f0;
}

.pdf-viewer {
  width: 100%;
  height: 100%;
  border: none;
}

/* --- Meetings table --- */
.meetings-table-wrap { overflow-x: auto; }

.meetings-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-ui);
  font-size: 1rem;
  background: var(--color-surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.meetings-table th {
  background: var(--color-primary);
  color: #fff;
  padding: 0.85rem 1rem;
  text-align: left;
  font-weight: 600;
}

.meetings-table td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}

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

.upcoming-row { background: #f0f7f0; font-weight: 600; }

.past-table { opacity: 0.85; }

.date-cell { white-space: nowrap; }

.essay-cell {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- Next Meeting featured card --- */
.next-meeting-card {
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
}

.next-meeting-label {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.75;
  margin-bottom: 0.35rem;
}

.next-meeting-date {
  font-family: var(--font-body);
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 1rem;
  line-height: 1.2;
}

.next-meeting-details {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
}

.detail-item {
  display: flex;
  gap: 0.45rem;
  align-items: baseline;
  font-size: 0.95rem;
}

.detail-key {
  font-weight: 700;
  opacity: 0.75;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.next-meeting-card a {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* --- Archive link row --- */
.archive-link-row {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 2px solid var(--color-border);
  text-align: center;
}

.archive-link {
  font-family: var(--font-ui);
  font-size: 0.95rem;
  color: var(--color-primary);
  font-weight: 600;
}

/* --- Archive page: decade + year accordions --- */
.archive-decade {
  margin-bottom: 1.25rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.archive-decade-summary {
  font-family: var(--font-body);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-primary-dk);
  padding: 0.85rem 1.25rem;
  cursor: pointer;
  user-select: none;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  list-style: none;
}
.archive-decade-summary::-webkit-details-marker { display: none; }
.archive-decade-summary::before {
  content: '▸ ';
  font-size: 0.8em;
  transition: transform 0.15s;
}
details[open] > .archive-decade-summary::before { content: '▾ '; }

.archive-year {
  border-bottom: 1px solid var(--color-border);
}
.archive-year:last-child { border-bottom: none; }

.archive-year-summary {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.65rem 1.5rem;
  cursor: pointer;
  user-select: none;
  list-style: none;
}
.archive-year-summary::-webkit-details-marker { display: none; }

.archive-year-num {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 1rem;
  color: var(--color-primary);
}

.archive-year-num::before {
  content: '▸ ';
  font-size: 0.75em;
  color: var(--color-muted);
}
details[open] > .archive-year-summary .archive-year-num::before { content: '▾ '; }

.archive-year-count {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  color: var(--color-muted);
}

.archive-table {
  border-radius: 0;
  box-shadow: none;
  margin-left: 1.5rem;
  width: calc(100% - 1.5rem);
}

/* --- Admin dashboard --- */
.admin-stats {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.stat-card {
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--radius);
  padding: 1.25rem 2rem;
  text-align: center;
  min-width: 140px;
  box-shadow: var(--shadow);
}

.stat-number {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 0.25rem;
}

.stat-label {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  opacity: 0.85;
}

.stat-hint {
  display: block;
  font-size: 0.75rem;
  opacity: 0.7;
}

/* Private paper notice */
.paper-private-notice {
  font-size: inherit;
  font-style: italic;
  color: #666;
}

/* Badge sits as a flex child in .paper-meta — no extra left margin needed */
.paper-meta .badge-private {
  margin-left: 0;
}

/* Checkbox row in forms */
.form-group-checkbox {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-weight: 500;
}

.checkbox-label input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  cursor: pointer;
}

/* Admin: private paper badge */
.badge-private {
  display: inline-block;
  margin-left: 0.45rem;
  padding: 0.1rem 0.45rem;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffc107;
  vertical-align: middle;
}

/* Admin: PDF download link in table */
.pdf-dl-icon {
  font-size: 0.85rem;
  font-weight: 600;
  color: #2c5f2e;
  text-decoration: none;
  white-space: nowrap;
}

.pdf-dl-icon:hover {
  text-decoration: underline;
}

.admin-sections {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.5rem;
}

.admin-sections .card {
  display: flex;
  flex-direction: column;
}

.admin-sections .card p {
  color: var(--color-muted);
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.admin-sections .card .btn {
  margin-top: auto;
}

/* --- Admin tables --- */
.admin-table-wrap { overflow-x: auto; margin-bottom: 1.5rem; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-ui);
  font-size: 0.95rem;
  background: var(--color-surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.admin-table th {
  background: var(--color-primary-dk);
  color: #fff;
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
}

.admin-table td {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.admin-table tbody tr:hover { background: #f5f1ec; }
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr.clickable-row { cursor: pointer; }

.inactive-row td { color: #999; }
.inactive-row img { opacity: 0.5; }

/* Delete button pushed to far right in form-actions */
.form-actions .btn-danger { margin-left: auto; }

.admin-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid var(--color-border);
}

.admin-thumb-large {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 2px solid var(--color-border);
  margin-bottom: 0.5rem;
}

.current-photo { margin-bottom: 0.75rem; }

.inline-reset-form {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.inline-input {
  padding: 0.3rem 0.6rem;
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  width: 130px;
  font-family: var(--font-ui);
}

/* --- Badges --- */
.badge-upcoming {
  background: var(--color-primary);
  color: #fff;
  font-size: 0.7rem;
  font-family: var(--font-ui);
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  margin-left: 0.5rem;
  vertical-align: middle;
}

/* --- Misc --- */
.muted { color: var(--color-muted); font-style: italic; }

/* Admin breadcrumb back link — sits inside .page-header left of h1 */
.admin-back {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--color-muted);
  text-decoration: none;
  white-space: nowrap;
  align-self: center;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius);
  transition: background 0.15s, color 0.15s;
}
.admin-back:hover {
  background: rgba(44, 95, 46, 0.08);
  color: var(--color-primary);
  text-decoration: none;
}

.back-link {
  font-family: var(--font-ui);
  font-size: 0.95rem;
  color: var(--color-muted);
  text-decoration: none;
  display: inline-block;
  margin-bottom: 0.5rem;
}

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

.back-link-wrap { margin-top: 1.5rem; }

/* --- Footer --- */
.site-footer {
  background: var(--color-primary-dk);
  color: rgba(255,255,255,0.6);
  text-align: center;
  padding: 1rem;
  font-family: var(--font-ui);
  font-size: 0.85rem;
}
.footer-feedback {
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.45);
}
.footer-link {
  color: rgba(255,255,255,0.65);
  text-underline-offset: 2px;
}
.footer-link:hover {
  color: rgba(255,255,255,0.9);
}

/* --- Responsive --- */
@media (max-width: 600px) {
  html { font-size: 16px; }

  /* Extra top padding so content clears the fixed navbar (≈52px) */
  .main-content { padding: 4rem 1rem 2rem; }

  /* Navbar: fixed at top so brand + hamburger always stay pinned */
  .navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    flex-wrap: wrap;
    height: auto;
    padding: 0 1rem;
    gap: 0;
    align-items: stretch;
    z-index: 200;
  }

  /* Brand sits to the right of the hamburger on the top row */
  .nav-brand {
    display: flex;
    align-items: center;
    height: 52px;
    flex: 1;   /* fill remaining space so nav-menu stays on its own row */
  }

  /* Hamburger icon — visible on mobile */
  .nav-toggle-label {
    display: flex;
    align-items: center;
    color: #fff;
    font-size: 1.7rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 0.4rem;
    user-select: none;
    border-radius: var(--radius);
    transition: background 0.15s;
    height: 52px;
    -webkit-tap-highlight-color: transparent;
    outline: none;
  }
  .nav-toggle-label:hover { background: rgba(255,255,255,0.15); }
  .nav-toggle-label:focus { outline: none; background: transparent; }

  /* Switch ☰ to ✕ when menu is open */
  .nav-toggle-input:checked + .nav-toggle-label::before { content: '✕'; }

  /* Nav menu hidden by default on mobile */
  .nav-menu {
    display: none;
    flex: 0 0 100%;         /* override desktop flex:1 — force full-width new row */
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.25rem 0 0.75rem;
    border-top: 1px solid rgba(255,255,255,0.2);
  }

  /* Show menu when hamburger checkbox is checked */
  .nav-toggle-input:checked ~ .nav-menu { display: flex; }

  /* Nav links stack vertically */
  .nav-links {
    flex-direction: column;
    gap: 0;
    width: 100%;
    flex: none;
  }
  .nav-links li { width: 100%; }
  .nav-links a {
    display: block;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius);
    text-align: left;
  }

  /* Nav user section — flat list inside hamburger menu */
  .nav-user {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 0.5rem 0 0.1rem;
    width: 100%;
    border-top: 1px solid rgba(255,255,255,0.12);
    margin-top: 0.25rem;
    position: static;
  }

  /* Show the mobile username label */
  .nav-user-name {
    display: block;
    color: rgba(255,255,255,0.55);
    font-size: 0.78rem;
    font-family: var(--font-ui);
    padding: 0.35rem 0.75rem 0.15rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

  /* Hide the dropdown button & its checkbox */
  .user-toggle-input,
  .user-toggle-label { display: none; }

  /* Show dropdown links as a flat list */
  .user-dropdown {
    display: flex !important;
    flex-direction: column;
    position: static;
    background: transparent;
    border: none;
    box-shadow: none;
    min-width: unset;
    width: 100%;
    overflow: visible;
  }
  .user-dropdown a {
    display: block;
    padding: 0.45rem 0.75rem;
    color: rgba(255,255,255,0.85);
    border-bottom: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
  }
  .user-dropdown a:hover,
  .user-dropdown a.active { background: rgba(255,255,255,0.15); color: #fff; }

  .page-header { flex-direction: column; gap: 0.75rem; }
  .page-header h1 { font-size: 1.6rem; }

  .form-card { padding: 1.25rem; }
  .card      { padding: 1.25rem; }

  .search-bar { flex-direction: column; gap: 0.5rem; }
  .search-input { min-width: 100%; }
  .search-controls { flex-wrap: nowrap; width: 100%; }
  .search-controls .search-select { flex: 1; min-width: 0; }
  .search-controls .btn { flex-shrink: 0; }

  .members-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }

  /* Hide iframe viewer on mobile; show the open-in-reader CTA instead */
  .pdf-viewer-wrap { display: none; }
  .pdf-download-btn { display: none; }
  .pdf-mobile-cta {
    display: block;
    text-align: center;
    padding: 1.5rem 0 0.5rem;
  }
  .pdf-mobile-msg {
    font-family: var(--font-ui);
    font-size: 0.95rem;
    color: var(--color-muted);
    margin-bottom: 1.25rem;
  }

  /* Stack paper action buttons vertically */
  .paper-row { flex-direction: column; gap: 0.75rem; }
  .paper-row-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
  }
  .paper-row-actions .btn { width: 100%; text-align: center; }

  /* Constrain date input so it doesn't stretch full width */
  .form-group input[type="date"] { max-width: 220px; }

  /* Meetings table → stacked cards on mobile */
  .meetings-table-wrap { overflow-x: unset; }

  .meetings-table,
  .meetings-table tbody,
  .meetings-table tr,
  .meetings-table td { display: block; width: 100%; }

  /* Hide the header row — labels come from data-label */
  .meetings-table thead { display: none; }

  /* Each row becomes a card */
  .meetings-table tr {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
    padding: 0.75rem 1rem;
    box-shadow: var(--shadow);
  }
  .meetings-table.past-table tr { opacity: 0.85; }
  .meetings-table tr.upcoming-row { background: #f0f7f0; }

  /* Each cell: flex row with bold label on the left */
  .meetings-table td {
    display: flex;
    gap: 0.6rem;
    padding: 0.3rem 0;
    border: none;
    font-size: 0.95rem;
    align-items: baseline;
  }
  .meetings-table td::before {
    content: attr(data-label);
    font-family: var(--font-ui);
    font-weight: 700;
    color: var(--color-muted);
    min-width: 80px;
    flex-shrink: 0;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding-top: 0.1rem;
  }
  /* Hide Notes row when it has no content */
  .meetings-table td[data-label="Notes"]:empty { display: none; }
  /* Hide Essay row when no paper is linked */
  .meetings-table td.essay-empty { display: none; }
  /* Let essay titles wrap on small screens */
  .essay-cell { max-width: unset; white-space: normal; }

  /* Next-meeting card on mobile */
  .next-meeting-date { font-size: 1.25rem; }
  .next-meeting-details { flex-direction: column; gap: 0.35rem; }

  /* Archive accordions on mobile */
  .archive-table { margin-left: 0; width: 100%; }
  .archive-year-summary { padding: 0.65rem 1rem; }
  .archive-decade-summary { padding: 0.75rem 1rem; }

  /* ─── Admin list tables → stacked cards on mobile ─── */
  .admin-table-wrap { overflow-x: unset; }

  .admin-table,
  .admin-table tbody,
  .admin-table tr,
  .admin-table td { display: block; width: 100%; box-sizing: border-box; }

  /* Hide the header row — labels come from data-label */
  .admin-table thead { display: none; }

  /* Each row becomes a card */
  .admin-table tr {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    margin-bottom: 0.85rem;
    padding: 0.85rem 1rem 0.6rem;
    box-shadow: var(--shadow);
  }
  .admin-table tr.upcoming-row { background: #f0f7f0; }

  /* Each cell: flex row with bold label on the left */
  .admin-table td {
    display: flex;
    gap: 0.6rem;
    padding: 0.28rem 0;
    border: none;
    font-size: 0.95rem;
    align-items: baseline;
  }
  .admin-table td::before {
    content: attr(data-label);
    font-family: var(--font-ui);
    font-weight: 700;
    color: var(--color-muted);
    min-width: 76px;
    flex-shrink: 0;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding-top: 0.1rem;
  }

  /* No label for photo cell (data-label="") */
  .admin-table td[data-label=""]::before { content: none; min-width: 0; }

  /* Photo cell — show thumbnail without label */
  .admin-table td.photo-cell {
    padding-bottom: 0.35rem;
    margin-bottom: 0.1rem;
    align-items: center;
  }
  .admin-table td.photo-cell .admin-thumb {
    width: 52px;
    height: 52px;
  }

  /* Hide empty Notes cell */
  .admin-table td[data-label="Notes"]:empty { display: none; }
}

/* ── Alumni / In Memoriam section ─────────────────────────────────────── */
.alumni-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--color-border);
}

.alumni-heading {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-muted, #666);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
}

.alumni-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
}

/* Alumni cards: smaller, muted version of the normal member card */
.alumni-card {
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 8px;
  padding: 1rem;
  opacity: 0.8;
}

.alumni-photo-wrap { margin-bottom: 0.6rem; }

.alumni-name {
  font-size: 0.95rem;
}

/* ── Memorial specific ──────────────────────────────────────────────── */
.memorial-card {
  border-color: #c8b8d8;
  background: #faf8fc;
  opacity: 1;
}

.memorial-photo {
  filter: grayscale(60%);
}

.memorial-cross {
  color: #7c5c9a;
  font-size: 0.85em;
}

.memorial-label {
  font-size: 0.75rem;
  font-style: italic;
  color: #7c5c9a;
  margin: 0.1rem 0 0.3rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.memorial-note {
  font-size: 0.82rem;
  font-style: italic;
  color: #555;
  margin-top: 0.35rem;
  line-height: 1.45;
}

/* -----------------------------------------------------------------------
   Announcements
   ----------------------------------------------------------------------- */

/* On the dashboard the announcement sits above the grid, full-width,
   using the standard .card class for consistent look.
   A subtle amber top-border signals "announcement" without a heavy style. */
.announcement-card {
  border-top: 3px solid #c8960c;
  margin-bottom: 1.75rem;
}

.announcement-body {
  font-size: 0.925rem;
  line-height: 1.65;
  color: var(--color-text);
}

.announcement-body a {
  color: var(--color-primary);
  text-decoration: underline;
}

.announcement-body a:hover {
  color: var(--color-primary-dk, #1a4a7a);
}

/* Admin announcement form */
.announcement-textarea {
  min-height: 8rem;
  resize: vertical;
}

/* Keep all three action buttons inline — override the global rule that
   pushes .btn-danger to the far right inside .form-actions */
.announcement-form-actions .btn-danger {
  margin-left: 0;
}

.delete-form {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}
