:root {
  --highlight-color: yellow;
}

/* Overall layout */
body {
  font-family: 'Segoe UI', 'Helvetica Neue', 'Roboto', sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: #333;
  max-width: 900px;
  margin: 0 auto;
  padding: 30px 20px;
}

/* Displaying the loaded in file  */
#documentDisplay {
  position: relative;      /* so the transcript bar anchors to it */
  padding: 24px;
  background: #f7f7f7;
  border-radius: 6px;
  border: 1px solid #ccc;
  height: calc(75vh - 20px);     /* accounts for padding/margin */
  overflow-y: auto;
  max-height: 55vh;
}

span.highlight,
span.space-highlight {
  background-color: var(--highlight-color);
}

span.space {
  display: inline-block;
  width: 0.5em;
}

p {
  margin-bottom: 1em;
}

/* Color Selection */
.color-swatch {
  width: 24px;
  height: 24px;
  display: inline-block;
  margin: 4px;
  border: 2px solid transparent;
  cursor: pointer;
  border-radius: 4px;
  box-sizing: border-box;
}

.color-swatch.selected {
  border-color: #222;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
}

/* Toggle Switch */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  font-size: 0.9em;
}

.switch input {
  display: none;
}

.slider {
  width: 40px;
  height: 20px;
  background-color: #ccc;
  border-radius: 20px;
  position: relative;
  transition: background-color 0.3s;
  cursor: pointer;
}

.slider::before {
  content: '';
  width: 18px;
  height: 18px;
  background-color: white;
  border-radius: 50%;
  position: absolute;
  top: 1px;
  left: 1px;
  transition: transform 0.3s;
}

.switch input:checked+.slider {
  background-color: #444;
}

.switch input:checked+.slider::before {
  transform: translateX(20px);
}

body.dark {
  background-color: #1e1e1e;
  color: #eee;
}

body.dark #documentDisplay {
  background: #2c2c2c;
  border-color: #444;
  border: 1px solid #444;
}

body.dark .color-swatch.selected {
  border: 2px solid #000;   /* thin black inner border */
  box-shadow: 0 0 0 2px #fff, 0 0 6px rgba(255, 255, 255, 0.4);
}

body.dark .slider {
  background-color: #555;
}

body.dark span.highlight,
body.dark span.space-highlight {
  color: black;
}

/* Buttons */
button {
  padding: 10px 18px;
  font-size: 16px;
  border: none;
  border-radius: 6px;
  background-color: #007acc;
  color: white;
  margin: 8px 8px 8px 0;
  cursor: pointer;
  transition: background-color 0.3s;
}

button:hover {
  background-color: #005f99;
}


/* Auto save toggle */
.auto-save-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auto-save-row .label-text {
  font-size: 16px;
  white-space: nowrap;
}

/* Headings */
h1 {
  font-size: 32px;
  font-weight: 600;
  margin-bottom: 24px;
  color: #222;
}

body.dark h1 {
  color: #f2f2f2;
}

/* Swatch container */
#colorOptions {
  display: flex;
  flex-wrap: wrap;
}

body.dark #controlPanel {
  background: #2a2a2a;
  border: 1px solid #444;
  box-shadow: 0 4px 20px rgba(255, 255, 255, 0.05);
}

/* Start/Stop buttons */
.button-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

/* Make sure the buttons inside don't override this layout */
#controlPanel .button-row button {
  margin: 0;
}

.dark-mode-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* "Highlight Color:" text "*/
.label-text,
.color-label {
  font-size: 15px;
  font-weight: 600;
  color: #444;
}

/* "Highlight Color:" text to colors format "*/
#colorPickerContainer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 0px;  
}

/* Upload Button Format */
.file-upload-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 12px 0 12px 0;
  gap: 12px;
}

/* Better button visuals */
.button-row button:hover {
  background-color: #005f99;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Custom File Input button */
.custom-file-label {
  background-color: #5c5c5c;
  color: white;
  padding: 6px 14px;
  font-size: 17px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.3s, box-shadow 0.3s;
  text-align: center;
}

/* Custom File Input button hover */
.custom-file-label:hover {
  background-color: #444444;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Custom File Input button formatting */
.custom-file-label input[type="file"] {
  display: none;
}

/* dark mode text format */
body.dark .label-text,
body.dark .color-label {
  color: #eee;
}

/* Color swatch hover */
.color-swatch:hover {
  outline: 1px solid rgba(0, 0, 0, 0.2);
  transform: scale(1.1);
  transition: all 0.2s ease;
}

/* recording indicator details */
#recordingIndicator {
  position: absolute;
  top: 10px;
  right: 18px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: #c62828;
  font-size: 14px;
  animation: fadeBlink 1.5s infinite;
  z-index: 999;
}

.recording-dot {
  width: 8px;
  height: 8px;
  background-color: #c62828;
  border-radius: 50%;
  animation: pulse 1.2s infinite ease-in-out;
}

/* recording timer */
#recordingTimer {
  position: absolute;
  top: 30px;
  right: 45px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: #c62828;
  font-size: 14px;
  animation: fadeBlink 1.5s infinite;
  z-index: 999;
  font-size: 14px;
  color: #c62828;
  font-weight: 500;
  text-align: center;
  margin-top: 2px;
}

.recording-hidden {
  display: none !important;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.4);
    opacity: 0.6;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/*  START OF RECORDING AND SAVING FORMATTING  */

/*  Dark Mode control panel Formatting  */
body.dark #controlPanel {
  background: #1e1e1e;
  border-bottom: 1px solid #444;
}

/*  Formatting overall Control Panel  */
#controlPanel {
  position: relative;
  top: 0;
  z-index: 1000;
  padding: 14px 16px;
  max-height: 25vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #fdfdfd;
  border: 1px solid #ddd;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  margin-bottom: 6px;
}

/*  Formatting "EchoScroll" on top  */
#controlPanel h1 {
  font-size: 30px;
  margin: 0px;
  text-align: center;
  margin-top: -8px;
  margin-bottom: -14px;
}

/*  autosave and save row  */
.controls-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  margin: 0 0 -5px 0;
  padding: 0;
  height: 38px;  /* Shrinks vertical height */
  margin-top: -4px;
}

/*  dark mode and color selection */
.colors-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  margin: 0;
  padding: 0;
  margin-top: -4px;
}

html {
  scroll-padding-top: 180px;
}

#saveArea {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
}

#saveArea audio {
  height: 28px;
}

#saveArea button {
  padding: 6px 12px;
  font-size: 14px;
  margin: 0;
}

/* Phone Format Settings */
@media (max-width: 600px) {
  #controlPanel {
    padding: 16px;
    max-height: 25vh;
    overflow-y: scroll;
  }

  h1 {
    font-size: 22px;
    margin-bottom: 10px;
  }

  #recordingIndicator {
    top: 10px;
    right: 12px;
    font-size: 12px;
  }

  #recordingTimer {
    font-size: 14px;
    color: #c62828;
    font-weight: 500;
    text-align: center;
    margin-top: 2px;
  }

  /* FILE + BUTTON ROW LAYOUT */
  .file-upload-container {
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }

  /* BUTTONS SIDE-BY-SIDE */
  .button-row button {
    white-space: nowrap;  /* 🔒 Prevent line breaks */
    flex: 1 1 auto;
    max-width: 140px;
    text-align: center;
    padding: 10px 10px 10px 10px;
  }

  .controls-row {
    flex-direction: row;
    margin: 0 0 -20px 0;
  }

  .colors-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  #colorPickerContainer {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: -10px;
  }

  #colorPickerContainer .color-label {
    white-space: nowrap;
    margin-right: 8px;
  }
  
  button {
    width: 100%;
    font-size: 15px;
  }

  #saveArea {
    display: flex;
    flex-direction: row;
    align-items: flex-start;    /* aligns top of audio with top of toggle */
    gap: 8px;
    width: 100%;
    flex-wrap: wrap;
    margin-top: 6px;    /* shifts the whole row down */
    padding-top: 6px;    /* extra breathing room */
    margin-right: 10px;
  }

  #saveArea audio,
  #saveArea button {
    flex: 1 1 auto;
    min-width: 120px;
    max-width: 100%;
  }

  
  /* save area mobile formatting */
  .auto-save-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin: 0 20px 0 0;
  }
  
  .dark-mode-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin: 8px 20px 0 0;
  }

  .auto-save-row .label-text,
  .dark-mode-toggle .label-text {
    font-size: 16px;
    flex: 1;
  }

  #saveArea audio {
    height: 28px;
    padding-top: 30px;       /* 👈 add this */ 
  }

  #saveArea button {
    margin-top: 0px;      /* or 0 */   
  }

  #wordStats {
    top: 10px;
    left: 12px;
    font-size: 13px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: left;
    line-height: 1.2;
  }

  #wordStats div {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
}

/* Restart button color override */
#restartBtn {
  background-color: #ff7043;
  padding: 11px 18px;
  font-size: 16px;
  border: none;
  border-radius: 6px;
  margin: 8px 8px 8px 0;
  cursor: pointer;
  transition: background-color 0.3s;
}

#restartBtn:hover {
  background-color: #e85c30;
}

#wordStats {
  position: absolute;
  top: 12px;
  left: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 14px;
  font-weight: 500;
  color: #333;
  text-align: left;
  z-index: 999;
}

body.dark #wordStats {
  color: #eee;
}

.hidden {
  display: none !important;
}

.highlight,
.space-highlight {
  background-color: var(--highlight-color);
  box-shadow:
    0 0px 0px rgba(0, 0, 0, 0.15),    /* top */
    0 1px 0px rgba(0, 0, 0, 0.3);  /* bottom */
}

/* Help Button Row (aligns top right above panel) */
#helpButtonRow {
  display: flex;
  justify-content: flex-end;
  max-width: 100%;
  margin: 0 auto 0 auto;
  padding: 0 8px 0 8px;
}

/* Modal Overlay */
.modal {
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.45);
  transition: opacity 0.3s ease;
}

/* Modal Box */
.modal-content {
  background-color: #ffffff;
  color: #222;
  padding: 24px 24px 20px 24px;
  border-radius: 14px;
  max-width: 520px;
  width: 92%;
  max-height: 90vh;   /* ✅ Constrain modal height */
  overflow-y: auto;   /* ✅ Allow internal scroll */
  overscroll-behavior: contain;
  border: 1px solid #ddd;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25);
  position: relative;
  font-size: 16px;
  animation: fadeInUp 0.35s ease;
  line-height: 1.65;
  font-family: 'Segoe UI', 'Helvetica Neue', sans-serif;
}

/* Close button */
.modal-content .close {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 22px;
  font-weight: bold;
  color: #aaa;
  cursor: pointer;
  transition: color 0.25s ease;
  background: inherit;
}

.modal-content .close:hover {
  color: #222;
}

.modal-content::-webkit-scrollbar {
  width: 6px;
}

.modal-content::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

body.dark .modal-content .close {
  background: #2b2b2b;
}

/* Modal Heading with separator */
.modal-content h2 {
  margin-top: 0;
  font-size: 20px;
  font-weight: 700;
  color: #111;
  border-bottom: 1px solid #ddd;
  /* ✅ bar below heading */
  padding-bottom: 10px;
  margin-bottom: 16px;
}

/* Paragraphs and steps */
.modal-content p {
  margin: 12px 0;
}

.modal-content p strong {
  color: #007acc;
  font-weight: 600;
}

.modal-content code {
  background: #f0f0f0;
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 14px;
  font-family: monospace;
}

/* Footer (optional) */
.modal-footer {
  margin-top: 24px;
  font-size: 13px;
  color: #777;
  text-align: center;
}

/* Dark mode improvements */
body.dark .modal-content {
  background-color: #2b2b2b;
  color: #eee;
  border: 1px solid #444;
}

body.dark .modal-content h2 {
  color: #f2f2f2;
  border-bottom: 1px solid #444;
}

body.dark .modal-content code {
  background: #444;
}

body.dark .modal-footer {
  color: #aaa;
}

body.dark .modal-content .close {
  color: #999;
}

body.dark .modal-content .close:hover {
  color: #fff;
}


/* Entry Animation */
@keyframes fadeInUp {
  0% {
    transform: translateY(20px);
    opacity: 0;
  }

  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

/* modal-faq */
.modal-faq {
  margin-top: 28px;
  border-top: 1px solid #ddd;
  padding-top: 10px;
}

.modal-faq h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #333;
}

.faq-item {
  margin-bottom: 0px;
}

.faq-question {
  background: none;
  border: none;
  color: #007acc;
  font-size: 15px;
  font-weight: 600;
  text-align: left;
  width: 100%;
  cursor: pointer;
  padding: 6px 0;
  transition: color 0.2s ease;
}

.faq-question:hover {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  transform: translateY(-1px);
  background: none;
}

.faq-answer {
  margin-top: -15px;
  font-size: 14px;
  color: #444;
  line-height: 1.6;
  padding-left: 8px;
}

.faq-answer.hidden {
  display: none;
}

/* Dark mode support */
body.dark .modal-faq h3 {
  color: #eee;
}

body.dark .faq-answer {
  color: #ccc;
}

body.dark .faq-question {
  color: #66bfff;
}

body.dark .faq-question:hover {
background: none; 
  border-radius: 6px;
}

/* ALL FAQ's fade in */
.modal-faq .faq-item {
  opacity: 0;
  transform: translateY(8px);
  animation: faqFadeIn 0.3s ease forwards;
}
.modal-faq .faq-item:nth-child(2) {
  animation-delay: 0.1s;
}
.modal-faq .faq-item:nth-child(3) {
  animation-delay: 0.2s;
}
.modal-faq .faq-item:nth-child(4) {
  animation-delay: 0.3s;
}
.modal-faq .faq-item:nth-child(5) {
  animation-delay: 0.4s;
}
.modal-faq .faq-item:nth-child(6) {
  animation-delay: 0.5s;
}
.modal-faq .faq-item:nth-child(7) {
  animation-delay: 0.6s;
}
.modal-faq .faq-item:nth-child(8) {
  animation-delay: 0.7s;
}
.modal-faq .faq-item:nth-child(9) {
  animation-delay: 0.8s;
}
.modal-faq .faq-item:nth-child(10) {
  animation-delay: 0.9s;
}

@keyframes faqFadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-content h2 {
  color: #007acc;
}

.early-access-emoji ul li::before {
  content: "✨ ";
}

/* Top controls */
#top-controls {
  font-size: 12px;
  border: none;
  display: flex;
  justify-content: flex-end;  /* Aligns to the left */
  margin: -34px 0px -4px 0;
}

#top-controls button {
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid #ccc;
  background-color: #f7f7f7;
  color: #1a1a1a;
  cursor: pointer;
  height: 32px;
  border-radius: 6px;
  transition: all 0.25s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

#top-controls button:hover {
  background-color: #ebebeb;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  transform: translateY(-1px);
}

/* Dark mode override */
body.dark #top-controls button {
  background-color: #2e2e2e;
  border: 1px solid #555;
  color: #eee;
}

body.dark #top-controls button:hover {
  background-color: #3b3b3b;
  box-shadow: 0 2px 6px rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

/* Login button should look distinct but balanced */
#top-controls .login-button {
  background-color: #004f7c;
  color: #ffffff;
  border: 1px solid #004f7c;
  font-weight: 700;
  transition: all 0.3s ease;
}

#top-controls .login-button:hover {
  background-color: #006aa1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

body.dark #top-controls .login-button {
  background-color: #006aa1;
  color: #fff;
  border: 1px solid #338bd1;
}

body.dark #top-controls .login-button:hover {
  background-color: #1d85c1;
}

/* Feedback Modal */
#feedbackModal textarea {
  font-size: 16px;
  border: 1px solid #ccc;
  padding: 10px;
  border-radius: 6px;
  resize: vertical;
  width: 100%;
  box-sizing: border-box;
}
#feedbackModal button {
  background-color: #007acc;
}
body.dark #feedbackModal textarea {
  background: #333;
  color: #eee;
  border: 1px solid #555;
}
#feedbackModal .modal-content {
  padding: 24px;
}


/* login/logout UI */
#userGreeting {
  margin-right: 12px;
  font-weight: 600;
  font-size: 14px;
}
.modal-content {
  background-color: white;
  border-radius: 10px;
  padding: 24px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}
input,
select {
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 4px;
  width: 100%;
  padding: 10px;
  margin-bottom: 12px;
  box-sizing: border-box;
}

/* chapter sidebar/toggle */
.chapter-toggle {
  background-color: #0066cc;
  color: white;
  border: none;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: bold;
  border-radius: 5px;
  cursor: pointer;
  border: 1px solid #004f7c;
  transition: all 0.3s ease;
  margin: 0px 0 6px 8px;
}
.chapter-toggle:hover {
  background-color: #005f8f;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Sidebar positioning and information below */
.chapter-sidebar {
  position: fixed;
  font-size: 14px;
  top: 140px;
  left: 0;
  width: 250px;
  max-height: 80vh;
  background: #f4f4f4;
  border-right: 1px solid #ccc;
  border-radius: 8px;
  padding: 12px;
  z-index: 999;
  overflow-y: auto;
  border-radius: 0 8px 8px 0;
  box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.1);
  margin-top: 60px; /* Add this line to avoid covering top buttons */
  margin-bottom: 16px;
  z-index: 1001;      /* Raise it above the control panel */
} 

.chapter-entry {
  font-size: 14px;
  margin-bottom: 12px;
  padding: 6px 10px;
  border-radius: 4px;
  border-bottom: 1px solid #ddd;
  transition: background 0.2s ease;
  cursor: pointer;  /* 👈 Add this */
}

.chapter-entry:hover {
  background-color: #dfefff;
  cursor: pointer;
}

body.dark .chapter-entry:hover {
  background-color: #2d3f57;
}

.chapter-sidebar.hidden {
  display: none;
  transform: translateX(-100%);
}

.close-sidebar-btn {
  float: right;
  background: transparent;
  border: none;
  font-size: 16px;
  cursor: pointer;
  margin-bottom: 10px;
}
body.dark #chapterSidebar {
  background: #2a2a2a;
  color: #eee;
  border-color: #444;
}

#chapterSidebar.hidden {
  transform: translateX(-100%);
}

.close-sidebar-btn {
  color: #333;
}

body.dark .close-sidebar-btn {
  color: #eee;
}

#chapterList {
  margin-top: 10px;
}


@media (max-width: 768px) {
  #chapterSidebar {
    width: 85vw;
    top: 120px;
    left: 0;
  }
}

/* Compact spacing just for auth modals */
#loginModal .modal-content input,
#loginModal .modal-content select,
#signupModal .modal-content input,
#signupModal .modal-content select {
  padding: 8px;
  margin-bottom: 6px;
}

/* Chapter sidebar Project progress UI */
.project-progress {
  margin: 6px 0 10px;
}
.progress-bar {
  width: 100%;
  height: 8px;
  background: #e6e6e6;
  border-radius: 6px;
  overflow: hidden;
}
body.dark .progress-bar {
  background: #3a3a3a;
}
.progress-fill {
  height: 100%;
  background: var(--highlight-color);
  transition: width 300ms ease;
}
.progress-text {
  font-size: 12px;
  opacity: 0.8;
  margin-top: 4px;
}
/* Chapter entry: add a right-side status (✓ or percent) */
/* Chapter entry: stack title over meta (status + Export) */
.chapter-entry {
  display: block;
  /* ← no row flex */
}
.chapter-entry .chapter-title {
  display: block;
  /* full-width line */
  font-weight: 600;
  padding-right: 0;
}
.chapter-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  flex-wrap: wrap;
  /* wraps nicely on narrow widths */
}
.chapter-entry .chapter-status {
  font-size: 12px;
  opacity: 0.85;
  white-space: nowrap;
}
.chapter-entry.completed .chapter-status::before {
  content: "✓ ";
}

/* updating chapter sidebar rules */
.chapter-actions {
  display: flex;
  gap: 6px;
}
.chapter-entry button.export-btn {
  padding: 4px 8px;
  font-size: 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
  color: #111;
  cursor: pointer;
}
body.dark .chapter-entry button.export-btn {
  background: #2b2b2b;
  border-color: #444;
  color: #eee;
}

#chapterSidebar {
  position: fixed;
  top: 120px;   /* adjust to match your header height */
  bottom: 16px;   /* keep a small gap from bottom */
  overflow-y: auto;
}

/* export modal */
/* --- Export modal: checkbox + title in a clean 2-column grid --- */
#exportChapterList {
  text-align: left;
}
#exportChapterList .export-row {
  display: grid;
  grid-template-columns: 20px 1fr;
  /* checkbox | title */
  align-items: start;
  column-gap: 10px;
  margin: 8px 0;
  width: 100%;
}
#exportChapterList .export-row input[type="checkbox"] {
  justify-self: start;
  margin-top: 3px;
  /* nice optical align */
}
#exportChapterList .export-title {
  text-align: left;
  white-space: normal;
  /* allow wrapping */
  line-height: 1.4;
}

/* --- Chapter sidebar: stack meta under title --- */
.chapter-title {
  display: block;
  /* ensures it sits on its own line */
  font-weight: 600;
}
.chapter-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  flex-wrap: wrap;
  /* allows small screens to wrap nicely */
}
.chapter-entry .chapter-status {
  font-size: 12px;
  opacity: .85;
}

/* --- profile/logout button support --- */
/* === Account menu (Welcome dropdown) === */
#top-controls {
  position: relative;
  z-index: 2000;
  /* ⬅ ensures header sits above main card */
}
.account-menu {
  position: relative;
  display: inline-block;
  z-index: 2100;
  /* ⬅ above header container */
}
.account-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 180px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
  padding: 6px;
  z-index: 3000;
  /* ⬅ on top of everything below */
}
.account-dropdown.hidden {
  display: none;
}
.account-dropdown button {
  display: block;
  width: 100%;
  padding: 8px 10px;
  text-align: left;
  background: none;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
}
.account-dropdown button:hover {
  background: #f3f4f6;
}
