:root {
  --navy: #211F60;
  --navy-ink: #17153f;
  --accent: #2C8FFA;
  --bg: #F4F5FA;
  --card: #FFFFFF;
  --text: #1A1A2E;
  --muted: #6B6F8C;
  --line: #E1E3EF;
  --success: #1E9E6B;
  --danger: #D6455E;
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
}

.topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--navy);
  color: white;
  padding: 18px 32px;
  border-bottom: 3px solid var(--accent);
}

.topbar .brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
}

.topbar nav a {
  color: white;
  text-decoration: none;
  margin-left: 28px;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 500;
  opacity: 0.7;
  padding-bottom: 4px;
  border-bottom: 2px solid transparent;
}
.topbar nav a:hover { opacity: 1; }

.nav-toggle { display: none; }
.nav-toggle-btn { display: none; }

.page { padding: 32px; max-width: 1200px; margin: 0 auto; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.thumb {
  width: 100%;
  border-radius: 4px;
  margin-bottom: 12px;
  background: var(--navy);
}

.thumb.placeholder {
  aspect-ratio: 1080 / 1350;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.85rem;
  text-align: center;
  padding: 12px;
}

.carousel-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin-bottom: 12px;
}

.carousel-strip .thumb-small {
  width: 90px;
  flex: 0 0 auto;
  margin-bottom: 0;
}

.meta { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }

.badge {
  font-family: var(--font-display);
  font-size: 0.7rem;
  padding: 3px 9px;
  border-radius: 4px;
  background: var(--accent);
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}
.badge.muted { background: var(--muted); }
.badge.accent { background: var(--navy); }
.badge.warn { background: var(--danger); }

.runway-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  padding: 10px 16px;
  border-radius: 8px;
  background: #FBE9ED;
  border: 1px solid var(--danger);
  color: var(--navy-ink);
  font-size: 0.9rem;
}
.runway-banner a { color: var(--danger); font-weight: 600; text-decoration: none; }
.runway-banner a:hover { text-decoration: underline; }

.text { font-size: 0.95rem; line-height: 1.5; }
.source { font-size: 0.8rem; color: var(--muted); font-style: italic; }
.scheduled-at { font-size: 0.85rem; color: var(--navy); font-weight: 600; }

.platform-results { list-style: none; margin: 10px 0 0; padding: 0; font-size: 0.85rem; }
.platform-results li { display: flex; gap: 8px; padding: 3px 0; }
.platform-name { text-transform: capitalize; font-weight: 600; min-width: 70px; }
.platform-ok { color: var(--success); }
.platform-ok a { color: var(--success); }
.platform-fail { color: var(--danger); }

.row { display: flex; gap: 12px; }
.row label { flex: 1; }

label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 10px;
}

input, select, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 0.9rem;
  font-family: inherit;
  margin-top: 4px;
}

.checkbox { display: flex; align-items: center; gap: 8px; }
.checkbox input { width: auto; margin-top: 0; }

button {
  background: var(--navy);
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  width: 100%;
  margin-top: 4px;
}
button:hover { background: var(--navy-ink); }
button.reject { background: transparent; color: #C0392B; border: 1px solid #C0392B; }
button.reject:hover { background: #C0392B; color: white; }

.scout-trigger {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}
.scout-trigger button { width: auto; margin-top: 0; }

.manual-entry {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 24px;
}
.manual-entry summary {
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--navy);
}
.manual-form { margin-top: 16px; }

/* --- Filters: type/theme/day dropdowns (Queue + Scheduled) --- */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.filter-dropdown { position: relative; }

.filter-dropdown summary {
  cursor: pointer;
  list-style: none;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--navy);
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 4px;
  padding: 7px 14px;
  user-select: none;
}
.filter-dropdown summary::-webkit-details-marker { display: none; }
.filter-dropdown summary:hover { border-color: var(--accent); color: var(--accent); }
.filter-dropdown[open] summary { border-color: var(--navy); color: var(--navy); }

.filter-dropdown .chip-row {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 10;
  min-width: 220px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  box-shadow: 0 8px 24px rgba(23, 21, 63, 0.12);
}

.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  font-family: var(--font-display);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--navy);
  background: transparent;
  border: 1.5px solid var(--line);
  border-radius: 4px;
  padding: 5px 12px;
  line-height: 1.3;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.active {
  background: var(--navy);
  border-color: var(--navy);
  color: white;
}

/* --- Scheduled: segmented view control + date navigation --- */

.calendar-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.segmented {
  display: inline-flex;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: var(--card);
}
.segmented-option {
  font-family: var(--font-display);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--navy);
  padding: 8px 18px;
  border-right: 1.5px solid var(--line);
}
.segmented-option:last-child { border-right: none; }
.segmented-option.active { background: var(--navy); color: white; }
.segmented-option:not(.active):hover { background: var(--bg); }

.date-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 6px;
  padding: 4px;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 4px;
  color: var(--navy);
  text-decoration: none;
}
.icon-btn:hover { background: var(--bg); }

.date-label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--navy);
  padding: 0 10px;
  min-width: 170px;
  text-align: center;
}

.today-btn {
  font-family: var(--font-display);
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  padding: 6px 10px;
  border-left: 1.5px solid var(--line);
  margin-left: 4px;
}
.today-btn:hover { color: var(--accent); }

.empty { color: var(--muted); }
.hint { font-size: 0.85rem; color: var(--muted); }

button.secondary {
  background: transparent;
  color: var(--navy);
  border: 1px solid var(--line);
}
button.secondary:hover { border-color: var(--accent); color: var(--accent); background: transparent; }

.design-form { margin-top: 10px; }
.design-form label { margin-bottom: 6px; }
.design-form input[type="file"] { padding: 4px; margin-top: 4px; }

/* --- Plan: weekly slot grid --- */

.plan-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-top: 20px;
  align-items: start;
}

.plan-day {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.plan-slot {
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.plan-slot.filled { border-color: var(--success); border-style: solid; }
.plan-slot.empty { border-style: dashed; }

.plan-slot-waiting {
  font-size: 0.7rem;
  color: var(--muted);
  font-style: italic;
  margin-top: auto;
}

.plan-source {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 6px 0;
  border-top: 2px dashed var(--line);
}

.plan-cell-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }

.plan-cell-day {
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.plan-cell-date {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--navy);
}

/* compact thumbnail + clamped text used throughout Plan (grid cells + tray) */
.thumb-compact {
  width: 100%;
  max-width: 72px;
  border-radius: 4px;
  background: var(--navy);
  margin: 0 auto;
  display: block;
  cursor: zoom-in;
  transition: opacity 0.1s;
}
.thumb-compact:hover { opacity: 0.85; }

.thumb-link { display: block; }

/* CSS-only lightbox: the trigger link points to #lightbox-{id}, which
   becomes visible via :target — no JS, matches the rest of the app. */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  align-items: center;
  justify-content: center;
}
.lightbox:target { display: flex; }

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(23, 21, 63, 0.85);
}

.lightbox-content {
  position: relative;
  z-index: 1;
  max-width: min(90vw, 420px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 78vh;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.lightbox-close {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  color: white;
  text-decoration: none;
  background: var(--navy);
  padding: 8px 18px;
  border-radius: 20px;
}
.lightbox-close:hover { background: var(--navy-ink); }

/* Carousel pager — sits below the slide, not over it, so it never collides
   with in-image text regardless of how long a given slide's copy runs. */
.lightbox-nav {
  display: flex;
  align-items: center;
  gap: 18px;
}

.lightbox-arrow {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--navy);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  line-height: 1;
  text-decoration: none;
  flex-shrink: 0;
}
.lightbox-arrow:hover { background: var(--navy-ink); }

.lightbox-count {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: white;
  min-width: 2.5em;
  text-align: center;
}

.text-compact {
  font-size: 0.72rem;
  line-height: 1.3;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  cursor: help;
}

.plan-item { display: flex; flex-direction: column; gap: 4px; }

.plan-candidate:not(:first-child) { border-top: 1px solid var(--line); padding-top: 6px; margin-top: 2px; }
.plan-candidate form { margin-top: 4px; }
.plan-candidate button, .plan-add-form button { width: 100%; font-size: 0.75rem; padding: 6px 8px; }

.plan-add-link {
  display: inline-block;
  cursor: pointer;
  list-style: none;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
}
.plan-add-link::-webkit-details-marker { display: none; }
.plan-add-link:hover { text-decoration: underline; }

.plan-add-form { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.plan-add-form textarea, .plan-add-form input { font-size: 0.75rem; padding: 6px; margin-top: 0; }

.plan-rescue { margin-top: 8px; }
.plan-rescue .plan-candidate { margin-top: 6px; }
.plan-rescue .hint { display: block; margin-bottom: 4px; }

.plan-more { margin-top: 6px; }
.plan-more-link {
  display: inline-block;
  cursor: pointer;
  list-style: none;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
}
.plan-more-link::-webkit-details-marker { display: none; }
.plan-more-link:hover { color: var(--navy); }
.plan-more form { margin-top: 6px; }
.plan-more button {
  width: 100%;
  font-size: 0.7rem;
  padding: 5px 8px;
}
.plan-design-form input[type="file"] { font-size: 0.7rem; padding: 3px; margin-bottom: 4px; }

.plan-actions { margin: 20px 0; }

.plan-tray {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 20px;
  margin-top: 20px;
}
.plan-tray h3 {
  font-family: var(--font-display);
  font-size: 0.9rem;
  margin: 0 0 12px;
}
.plan-tray-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.plan-tray-item:first-child { border-top: none; }
.plan-tray-item .thumb-compact { flex-shrink: 0; margin: 0; }
.plan-tray-item .text-compact { flex: 1; -webkit-line-clamp: 2; }
.plan-tray-item form { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.plan-tray-item select { width: auto; margin-top: 0; }
.plan-tray-item button { width: auto; margin-top: 0; }

@media (max-width: 900px) {
  .plan-grid {
    grid-template-columns: 1fr;
  }
  .plan-source { border-top: none; padding-top: 0; margin-bottom: 12px; }

  /* .scout-trigger's button kept its desktop width:auto in the flex row
     next to the hint text, so on a narrow screen it got squeezed down to a
     tall column of one-word-per-line text instead of a normal button. */
  .scout-trigger {
    flex-direction: column;
    align-items: stretch;
  }
  .scout-trigger button { width: 100%; }

  .topbar { padding: 14px 16px; }

  .nav-toggle-btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 32px;
    height: 32px;
    cursor: pointer;
  }
  .nav-toggle-btn span {
    display: block;
    height: 2px;
    background: white;
    border-radius: 1px;
    transition: transform 0.15s ease, opacity 0.15s ease;
  }
  /* checkbox+label morphs the three bars into an X while the menu is open —
     cheap way to confirm the tap registered without any JS. */
  .nav-toggle:checked ~ .nav-toggle-btn span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle:checked ~ .nav-toggle-btn span:nth-child(2) { opacity: 0; }
  .nav-toggle:checked ~ .nav-toggle-btn span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  .topbar nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--navy-ink);
    border-bottom: 3px solid var(--accent);
    padding: 8px 16px 16px;
  }
  .nav-toggle:checked ~ nav { display: flex; }
  .topbar nav a { margin-left: 0; padding: 12px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.12); }
  .topbar nav a:last-child { border-bottom: none; }
}

.settings-form {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  max-width: 360px;
}

/* --- Auth (login / forgot-password / reset-password) --- */

.auth-body { margin: 0; }

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.auth-brand {
  position: relative;
  overflow: hidden;
  background: var(--navy);
  color: white;
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.auth-brand .wordmark {
  position: relative;
  z-index: 1;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(3.5rem, 9vw, 6.5rem);
  line-height: 0.88;
  letter-spacing: -0.02em;
  margin: 0;
}

.auth-brand .brand-line {
  position: relative;
  z-index: 1;
  font-family: 'Fraunces', Georgia, serif;
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  line-height: 1.3;
  color: #F0EEE9;
  max-width: 320px;
  margin: 0;
}

.brand-line-mark {
  font-style: normal;
  color: var(--accent);
}

.auth-brand .tagline {
  position: relative;
  z-index: 1;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
}

/* Two teardrop shapes echoing MindPost's quote-mark card motif — an
   oversized decorative accent, not a literal logo, so it reads as brand
   texture rather than clutter. */
.quote-glyph {
  position: absolute;
  top: -6%;
  right: -8%;
  width: 60%;
  aspect-ratio: 1;
  transform: rotate(18deg);
  opacity: 0.16;
  z-index: 0;
}
.quote-glyph span {
  position: absolute;
  top: 0;
  width: 46%;
  height: 66%;
  background: var(--accent);
  border-radius: 0 100% 100% 100%;
}
.quote-glyph span:first-child { left: 0; }
.quote-glyph span:last-child { left: 50%; }

.auth-form-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 32px;
  background: var(--bg);
}

.auth-form-card { width: 100%; max-width: 380px; }

.auth-form-card h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2rem, 4vw, 2.6rem);
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--navy-ink);
  margin: 0 0 10px;
}

.auth-form-card .lede {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 0 0 28px;
}

.auth-form-card form { margin-top: 4px; }

.auth-alert {
  font-size: 0.85rem;
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 20px;
  line-height: 1.4;
}
.auth-alert-error {
  background: #FBE9ED;
  border: 1px solid var(--danger);
  color: var(--navy-ink);
}
.auth-alert-success {
  background: #E4F5EC;
  border: 1px solid var(--success);
  color: var(--navy-ink);
}

.auth-links {
  margin-top: 18px;
  font-size: 0.85rem;
}
.auth-links a { color: var(--accent); text-decoration: none; font-weight: 600; }
.auth-links a:hover { text-decoration: underline; }

@media (max-width: 860px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { padding: 32px; min-height: 220px; }
  .auth-brand .wordmark { font-size: clamp(2.5rem, 12vw, 3.5rem); }
}
