/* Bible Tracker — styles ported from the original Replit app (client/src/index.css).
   Same palette (warm paper light theme, dark theme), DM Sans body, Playfair Display headings. */
:root {
  --font-sans: 'DM Sans', system-ui, sans-serif;
  --font-serif: 'Playfair Display', Georgia, serif;
  --radius: 0.625rem;
  --background: 40 33% 96%;
  --foreground: 20 25% 20%;
  --card: 40 40% 98%;
  --card-foreground: 20 25% 20%;
  --popover: 40 40% 99%;
  --popover-foreground: 20 25% 20%;
  --primary: 350 45% 35%;
  --primary-foreground: 40 33% 96%;
  --secondary: 35 30% 90%;
  --secondary-foreground: 20 25% 25%;
  --muted: 35 20% 92%;
  --muted-foreground: 20 15% 45%;
  --accent: 38 70% 50%;
  --accent-foreground: 20 25% 15%;
  --destructive: 0 65% 50%;
  --destructive-foreground: 0 0% 100%;
  --success: 142 50% 40%;
  --success-foreground: 0 0% 100%;
  --border: 30 20% 88%;
  --input: 30 20% 85%;
  --ring: 350 45% 35%;
}
.dark {
  --background: 20 20% 10%;
  --foreground: 40 20% 92%;
  --card: 20 18% 14%;
  --card-foreground: 40 20% 92%;
  --popover: 20 18% 12%;
  --popover-foreground: 40 20% 92%;
  --primary: 350 50% 55%;
  --primary-foreground: 20 20% 10%;
  --secondary: 20 15% 20%;
  --secondary-foreground: 40 20% 88%;
  --muted: 20 15% 18%;
  --muted-foreground: 40 15% 55%;
  --accent: 38 70% 55%;
  --accent-foreground: 20 20% 10%;
  --destructive: 0 60% 55%;
  --success: 142 50% 45%;
  --border: 20 15% 22%;
  --input: 20 15% 25%;
  --ring: 350 50% 55%;
}
* { box-sizing: border-box; border-color: hsl(var(--border)); }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, .font-display { font-family: var(--font-serif); }
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }
.container { max-width: 80rem; margin: 0 auto; padding: 0 1rem; }
main .wrap { max-width: 64rem; margin: 0 auto; }
main { padding: 1.5rem 0 5rem; }
.stack > * + * { margin-top: 2rem; }
.muted { color: hsl(var(--muted-foreground)); }
.small { font-size: 0.875rem; }
.xsmall { font-size: 0.75rem; }

/* Header */
header.topbar {
  position: sticky; top: 0; z-index: 50;
  border-bottom: 1px solid hsl(var(--border) / 0.6);
  background: hsl(var(--background) / 0.8);
  backdrop-filter: blur(12px);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 0; }
.brand { display: flex; align-items: center; gap: 0.75rem; }
.brand-badge {
  display: flex; height: 2.5rem; width: 2.5rem; align-items: center; justify-content: center;
  border-radius: 0.75rem; background: hsl(var(--primary)); color: hsl(var(--primary-foreground));
  font-family: var(--font-serif); font-weight: 700; font-size: 1.15rem;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}
.brand h1 { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.brand p { margin: 0; font-size: 0.75rem; color: hsl(var(--muted-foreground)); }
.topbar-actions { display: flex; align-items: center; gap: 0.5rem; position: relative; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  border-radius: var(--radius); border: 1px solid transparent;
  padding: 0.5rem 1rem; font-size: 0.875rem; font-weight: 500;
  background: hsl(var(--primary)); color: hsl(var(--primary-foreground));
  transition: all 0.2s;
}
.btn:hover { opacity: 0.92; }
.btn-lg { padding: 0.625rem 1.5rem; font-size: 1rem; }
.btn-outline { background: transparent; color: hsl(var(--foreground)); border-color: hsl(var(--input)); }
.btn-outline:hover { background: hsl(var(--muted)); opacity: 1; }
.btn-ghost { background: transparent; color: hsl(var(--foreground)); }
.btn-ghost:hover { background: hsl(var(--muted)); opacity: 1; }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }
.btn-icon { padding: 0.5rem; width: 2.25rem; height: 2.25rem; }
.btn-success { background: hsl(var(--success)); color: hsl(var(--success-foreground)); }
.btn-destructive-outline {
  background: transparent; color: hsl(var(--destructive));
  border-color: hsl(var(--destructive) / 0.5);
}
.btn-destructive-outline:hover { background: hsl(var(--destructive) / 0.1); opacity: 1; }
.btn-destructive { background: hsl(var(--destructive)); color: hsl(var(--destructive-foreground)); }

/* Cards */
.card {
  background: hsl(var(--card)); color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border) / 0.6); border-radius: calc(var(--radius) + 4px);
}
.progress { height: 0.5rem; border-radius: 999px; background: hsl(var(--muted)); overflow: hidden; }
.progress > div { height: 100%; border-radius: 999px; background: hsl(var(--primary)); transition: width 0.3s; }
.progress.thin { height: 0.375rem; }
.progress > div.success { background: hsl(var(--success)); }

/* Continue Reading / Today hero cards */
.hero {
  position: relative; overflow: hidden; border-radius: 1rem; padding: 1.5rem;
  border: 1px solid hsl(var(--primary) / 0.2);
  background: linear-gradient(135deg, hsl(var(--primary) / 0.15), hsl(var(--primary) / 0.05), transparent);
}
.hero.today { border-color: hsl(var(--accent) / 0.35); background: linear-gradient(135deg, hsl(var(--accent) / 0.16), hsl(var(--accent) / 0.05), transparent); }
.hero.complete { border-color: hsl(var(--success) / 0.3); background: linear-gradient(135deg, hsl(var(--success) / 0.2), hsl(var(--success) / 0.1), transparent); text-align: center; }
.hero-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; position: relative; z-index: 1; }
.hero-main { display: flex; align-items: flex-start; gap: 1rem; }
.hero-icon {
  display: flex; height: 3rem; width: 3rem; flex-shrink: 0; align-items: center; justify-content: center;
  border-radius: 0.75rem; background: hsl(var(--primary) / 0.2); color: hsl(var(--primary));
  font-size: 1.4rem;
}
.hero h2 { margin: 0; font-size: 1.6rem; font-weight: 600; }
.hero h2.clickable { cursor: pointer; }
.hero h2.clickable:hover { text-decoration: underline; }
.hero .kicker { font-size: 0.875rem; font-weight: 500; color: hsl(var(--muted-foreground)); margin: 0 0 0.25rem; }
.today-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.chip {
  border: 1px solid hsl(var(--border)); background: hsl(var(--card));
  border-radius: 999px; padding: 0.3rem 0.75rem; font-size: 0.8125rem; font-weight: 500;
}
.chip.done { background: hsl(var(--success)); color: hsl(var(--success-foreground)); border-color: transparent; }
.chip button { background: none; border: none; color: inherit; font: inherit; padding: 0; }
.pace-line { margin-top: 0.75rem; font-size: 0.875rem; color: hsl(var(--muted-foreground)); }
.pace-line strong { color: hsl(var(--foreground)); }

/* Stats grid */
.stats-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 640px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .stats-grid { grid-template-columns: repeat(3, 1fr); } }
.stat-card { padding: 1.25rem; }
.stat-icon {
  display: flex; height: 2.25rem; width: 2.25rem; align-items: center; justify-content: center;
  border-radius: 0.5rem; font-size: 1rem; margin-bottom: 0.75rem;
  background: hsl(var(--primary) / 0.1); color: hsl(var(--primary));
}
.stat-card h3 { font-family: var(--font-sans); font-size: 0.875rem; font-weight: 500; color: hsl(var(--muted-foreground)); margin: 0 0 0.5rem; }
.stat-big { font-size: 1.5rem; font-weight: 700; }
.stat-sub { font-size: 0.875rem; color: hsl(var(--muted-foreground)); }

/* Monthly chart + weekday pattern */
.bars { display: flex; align-items: flex-end; gap: 4px; height: 90px; margin-top: 0.5rem; }
.bars .bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.bars .bar { width: 100%; max-width: 26px; border-radius: 3px 3px 0 0; background: hsl(var(--primary)); min-height: 2px; }
.bars .bar-label { font-size: 0.6rem; color: hsl(var(--muted-foreground)); }
.bars.horizontal { flex-direction: column; align-items: stretch; height: auto; }
.bars.horizontal .bar-row { display: flex; align-items: center; gap: 0.5rem; }
.bars.horizontal .bar-row .bar-label { width: 2rem; font-size: 0.7rem; }
.bars.horizontal .bar-track { flex: 1; height: 10px; background: hsl(var(--muted)); border-radius: 999px; overflow: hidden; }
.bars.horizontal .bar-fill { height: 100%; background: hsl(var(--primary)); border-radius: 999px; }
.bars.horizontal .bar-val { width: 2rem; text-align: right; font-size: 0.75rem; }

/* Heatmap (GitHub-style) */
.heatmap-wrap { overflow-x: auto; padding-bottom: 0.25rem; }
.heatmap { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 11px); gap: 3px; width: max-content; }
.heatmap .cell { width: 11px; height: 11px; border-radius: 2px; background: hsl(var(--muted)); }
.heatmap .cell.l1 { background: hsl(142 50% 78%); }
.heatmap .cell.l2 { background: hsl(142 50% 62%); }
.heatmap .cell.l3 { background: hsl(142 50% 48%); }
.heatmap .cell.l4 { background: hsl(var(--success)); }
.dark .heatmap .cell.l1 { background: hsl(142 40% 30%); }
.dark .heatmap .cell.l2 { background: hsl(142 45% 38%); }
.dark .heatmap .cell.l3 { background: hsl(142 50% 45%); }
.heatmap-legend { display: flex; align-items: center; gap: 3px; font-size: 0.7rem; color: hsl(var(--muted-foreground)); margin-top: 0.5rem; justify-content: flex-end; }
.heatmap-legend .cell { width: 11px; height: 11px; border-radius: 2px; background: hsl(var(--muted)); display: inline-block; }
.heatmap-legend .cell.l1 { background: hsl(142 50% 78%); }
.heatmap-legend .cell.l2 { background: hsl(142 50% 62%); }
.heatmap-legend .cell.l3 { background: hsl(142 50% 48%); }
.heatmap-legend .cell.l4 { background: hsl(var(--success)); }

/* Book list */
.testament-head { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1rem; }
.testament-head .rule { height: 1px; flex: 1; }
.testament-head .rule.l { background: linear-gradient(to right, hsl(var(--border)), transparent); }
.testament-head .rule.r { background: linear-gradient(to left, hsl(var(--border)), transparent); }
.testament-head h2 { font-size: 1.125rem; font-weight: 600; color: hsl(var(--muted-foreground)); margin: 0; }
.book-card { overflow: hidden; margin-bottom: 0.75rem; }
.book-head {
  display: flex; align-items: center; gap: 0.75rem; width: 100%; text-align: left;
  padding: 0.75rem 1rem; background: none; border: none; color: inherit;
}
.book-head:hover { background: hsl(var(--muted) / 0.5); }
.book-count-badge {
  display: flex; height: 2rem; width: 2rem; flex-shrink: 0; align-items: center; justify-content: center;
  border-radius: 0.5rem; font-size: 0.75rem; font-weight: 600;
  background: hsl(var(--muted)); color: hsl(var(--muted-foreground));
}
.book-count-badge.complete { background: hsl(var(--success) / 0.2); color: hsl(var(--success)); }
.book-head .book-meta { flex: 1; min-width: 0; }
.book-head .book-name-row { display: flex; align-items: center; gap: 0.5rem; }
.book-head h3 { font-family: var(--font-sans); font-weight: 500; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 1rem; }
.book-head .count { font-size: 0.75rem; color: hsl(var(--muted-foreground)); flex-shrink: 0; }
.book-head .chevron { color: hsl(var(--muted-foreground)); transition: transform 0.2s; flex-shrink: 0; }
.book-card.open .book-head .chevron { transform: rotate(180deg); }
.book-head .bar-track { margin-top: 0.375rem; height: 0.25rem; border-radius: 999px; background: hsl(var(--muted)); overflow: hidden; }
.book-head .bar-fill { height: 100%; border-radius: 999px; background: hsl(var(--primary)); transition: width 0.3s; }
.book-head .bar-fill.complete { background: hsl(var(--success)); }
.book-body { display: none; padding: 0.75rem 1rem 1rem; border-top: 1px solid hsl(var(--border) / 0.6); }
.book-card.open .book-body { display: block; }
.book-body-top { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.chapter-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.5rem; }
@media (min-width: 640px) { .chapter-grid { grid-template-columns: repeat(8, 1fr); } }
@media (min-width: 768px) { .chapter-grid { grid-template-columns: repeat(10, 1fr); } }
.chapter-btn {
  aspect-ratio: 1; border-radius: 0.5rem; font-size: 0.875rem; font-weight: 500;
  border: 1px solid transparent; transition: all 0.2s; position: relative;
  background: hsl(var(--muted) / 0.8); color: hsl(var(--muted-foreground));
}
.chapter-btn:hover { background: hsl(var(--muted)); color: hsl(var(--foreground)); border-color: hsl(var(--border)); }
.chapter-btn.read { background: hsl(var(--success)); color: hsl(var(--success-foreground)); box-shadow: 0 1px 2px rgb(0 0 0 / 0.1); }
/* Compact view: denser rows and chapter grid */
.compact .book-card { margin-bottom: 0.375rem; }
.compact .book-head { padding: 0.4rem 0.75rem; }
.compact .book-count-badge { height: 1.5rem; width: 1.5rem; font-size: 0.65rem; }
.compact .chapter-grid { grid-template-columns: repeat(8, 1fr); gap: 0.3rem; }
@media (min-width: 640px) { .compact .chapter-grid { grid-template-columns: repeat(12, 1fr); } }
.compact .chapter-btn { font-size: 0.75rem; border-radius: 0.375rem; }
.compact .stat-card { padding: 0.75rem; }

/* Search popover */
.search-pop {
  position: absolute; right: 0; top: calc(100% + 0.5rem); width: 20rem; max-width: 90vw; z-index: 60;
  background: hsl(var(--popover)); color: hsl(var(--popover-foreground));
  border: 1px solid hsl(var(--border)); border-radius: calc(var(--radius) + 4px);
  box-shadow: 0 10px 25px rgb(0 0 0 / 0.15); display: none;
}
.search-pop.open { display: block; }
.search-pop .search-input-row { border-bottom: 1px solid hsl(var(--border)); padding: 0.75rem; }
.search-pop input[type="text"] {
  width: 100%; padding: 0.5rem 0.75rem; border-radius: var(--radius);
  border: 1px solid hsl(var(--input)); background: hsl(var(--background)); color: hsl(var(--foreground));
  font-size: 0.875rem; outline: none;
}
.search-pop input[type="text"]:focus { border-color: hsl(var(--ring)); box-shadow: 0 0 0 2px hsl(var(--ring) / 0.25); }
.search-results { max-height: 20rem; overflow-y: auto; padding: 0.5rem; }
.search-results .group-label { padding: 0.5rem 0.5rem 0.25rem; font-size: 0.7rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; color: hsl(var(--muted-foreground)); }
.search-result {
  display: flex; width: 100%; align-items: center; justify-content: space-between;
  border-radius: 0.375rem; padding: 0.375rem 0.5rem; text-align: left; font-size: 0.875rem;
  background: none; border: none; color: inherit;
}
.search-result:hover { background: hsl(var(--muted)); }
.search-result .abbr { font-size: 0.75rem; color: hsl(var(--muted-foreground)); }
.search-hint { padding: 0 0.75rem 0.6rem; font-size: 0.7rem; color: hsl(var(--muted-foreground)); }

/* Settings sheet */
.overlay {
  position: fixed; inset: 0; background: rgb(0 0 0 / 0.5); z-index: 80;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.overlay.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; top: 0; right: 0; bottom: 0; width: 24rem; max-width: 92vw; z-index: 90;
  background: hsl(var(--background)); border-left: 1px solid hsl(var(--border));
  transform: translateX(100%); transition: transform 0.25s ease; overflow-y: auto; padding: 1.5rem;
}
.sheet.open { transform: translateX(0); }
.sheet h2 { margin: 0 0 0.25rem; font-size: 1.25rem; }
.sheet h3 { font-family: var(--font-sans); font-size: 0.875rem; font-weight: 600; margin: 0 0 0.75rem; }
.sheet .section { margin-top: 1.5rem; }
.sheet hr { border: none; border-top: 1px solid hsl(var(--border)); margin: 1.5rem 0 0; }
.sheet .close-x { position: absolute; top: 1rem; right: 1rem; }
.theme-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.theme-opt {
  display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
  border-radius: 0.5rem; border: 1px solid hsl(var(--border)); padding: 0.75rem;
  background: none; color: inherit; font-size: 0.75rem; font-weight: 500;
}
.theme-opt.active { border-color: hsl(var(--primary)); background: hsl(var(--primary) / 0.05); color: hsl(var(--primary)); }
.theme-opt .theme-ico { font-size: 1.2rem; }
.check-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.3rem 0; font-size: 0.875rem; cursor: pointer; }
.check-row input { width: 1rem; height: 1rem; accent-color: hsl(var(--primary)); }
.goal-row { display: flex; align-items: center; gap: 0.75rem; }
.goal-row input[type="number"] {
  width: 5.5rem; padding: 0.5rem; border-radius: var(--radius); border: 1px solid hsl(var(--input));
  background: hsl(var(--background)); color: hsl(var(--foreground)); font-size: 0.9rem;
}
.seg { display: flex; border: 1px solid hsl(var(--input)); border-radius: var(--radius); overflow: hidden; }
.seg button { flex: 1; padding: 0.5rem; background: none; border: none; font-size: 0.8125rem; color: inherit; }
.seg button.active { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }
.full { width: 100%; }
.danger h3 { color: hsl(var(--destructive)); }

/* Dialog (reset confirmation — kept from the original) */
.dialog-backdrop {
  position: fixed; inset: 0; background: rgb(0 0 0 / 0.5); z-index: 100;
  display: none; align-items: center; justify-content: center; padding: 1rem;
}
.dialog-backdrop.open { display: flex; }
.dialog {
  background: hsl(var(--popover)); color: hsl(var(--popover-foreground));
  border-radius: calc(var(--radius) + 4px); border: 1px solid hsl(var(--border));
  max-width: 28rem; width: 100%; padding: 1.5rem; box-shadow: 0 20px 40px rgb(0 0 0 / 0.25);
}
.dialog h2 { margin: 0 0 0.5rem; font-size: 1.15rem; font-family: var(--font-sans); font-weight: 600; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1.25rem; }

/* Reader */
.reader {
  position: fixed; inset: 0; z-index: 95; background: hsl(var(--background)); color: hsl(var(--foreground));
  display: none; flex-direction: column;
}
.reader.open { display: flex; }
.reader-top {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 0.75rem 1rem; border-bottom: 1px solid hsl(var(--border) / 0.6);
  background: hsl(var(--background) / 0.85); backdrop-filter: blur(10px); flex-wrap: wrap;
}
.reader-top h2 { margin: 0; font-size: 1.25rem; }
.reader-body { flex: 1; overflow-y: auto; padding: 1.5rem 1rem 3rem; }
.reader-inner { max-width: 42rem; margin: 0 auto; }
.reader .translation-tag {
  display: inline-block; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.06em;
  border: 1px solid hsl(var(--border)); border-radius: 999px; padding: 0.15rem 0.6rem;
  color: hsl(var(--muted-foreground)); margin-bottom: 1rem;
}
.verse { line-height: 1.85; font-size: 1.05rem; margin: 0 0 0.25rem; font-family: Georgia, 'Times New Roman', serif; }
.verse .vnum { font-size: 0.7rem; vertical-align: super; color: hsl(var(--primary)); font-weight: 700; margin-right: 0.3rem; font-family: var(--font-sans); }
.reader-bottom {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 0.75rem 1rem; border-top: 1px solid hsl(var(--border) / 0.6); flex-wrap: wrap;
}
.reader-loading { text-align: center; padding: 3rem 0; color: hsl(var(--muted-foreground)); }

/* Undo toast */
.toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translate(-50%, 150%); z-index: 120;
  background: hsl(20 25% 18%); color: hsl(40 33% 96%);
  border-radius: var(--radius); padding: 0.75rem 1rem; display: flex; align-items: center; gap: 1rem;
  box-shadow: 0 10px 25px rgb(0 0 0 / 0.3); transition: transform 0.25s ease; max-width: 92vw;
  font-size: 0.875rem;
}
.toast.show { transform: translate(-50%, 0); }
.toast button {
  background: none; border: none; color: hsl(var(--accent)); font-weight: 700; font-size: 0.875rem;
  text-transform: uppercase; letter-spacing: 0.03em; padding: 0.25rem;
}
.skeleton { border-radius: 0.75rem; background: hsl(var(--muted)); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.heatmap .cell.blank { background: transparent; }
