/* Shelf + book index: book cards, dashboard tiles, activity grid, TOC, finder, state tools. */
.shelf-main { max-width: 1160px; margin: 0 auto; padding: var(--sp-6) var(--sp-5) var(--sp-7); }
.shelf-head { display: flex; flex-wrap: wrap; gap: var(--sp-4); align-items: center; justify-content: space-between; margin-bottom: var(--sp-5); }
.shelf-brand { display: flex; gap: var(--sp-4); align-items: center; }
.brand-mark {
  width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; font-weight: 800; font-size: 1.5rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink);
}
.shelf-head h1 { margin: 0; font-size: var(--fs-3xl); letter-spacing: -0.02em; }
.shelf-sub { margin: 2px 0 0; color: var(--muted); }
.shelf-tools { display: flex; gap: var(--sp-2); align-items: center; min-width: 300px; }
.shelf-tools .search { flex: 1; }

/* resume link */
.resume:empty { display: none; }
.resume { margin: 0 0 var(--sp-4); }
.resume-link {
  display: flex; gap: var(--sp-3); align-items: center; padding: var(--sp-3) var(--sp-4); border-radius: var(--r-lg);
  background: linear-gradient(90deg, var(--accent-soft), transparent); border: 1px solid var(--accent); text-decoration: none; color: var(--text);
}
.resume-link:hover { color: var(--text); filter: brightness(1.08); }
.resume-kicker { font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); }
.resume-title { font-weight: 600; }
.resume-meta { color: var(--muted); font-size: var(--fs-sm); margin-left: auto; }

/* dashboard (after the reader's habit tracker: tiles above a compact activity grid) */
.dash:empty { display: none; }
.dash { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-xl); padding: var(--sp-4); margin: 0 0 var(--sp-5); }
.dash-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-3); }
@media (max-width: 720px) { .dash-tiles { grid-template-columns: repeat(2, 1fr); } }
.tile { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--sp-3) var(--sp-4); display: grid; gap: 2px; }
.tile-icon { font-size: 1.1rem; line-height: 1; color: var(--muted); }
.tile-num { font-size: var(--fs-2xl); font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile-sub { font-size: var(--fs-sm); color: var(--muted); font-weight: 500; }
.tile-label { font-size: var(--fs-xs); color: var(--muted); }
.tile.is-accent { border-color: var(--accent); background: var(--accent-soft); }
.tile.is-accent .tile-num { color: var(--accent); }
.dash-grid-wrap { margin-top: var(--sp-4); display: grid; gap: 6px; }
.dash-grid-head { display: flex; justify-content: space-between; font-size: var(--fs-xs); color: var(--muted); }
.act-grid { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 12px); gap: 3px; overflow-x: auto; padding-bottom: 2px; }
.act-cell { width: 12px; height: 12px; border-radius: 3px; background: var(--panel-3); }
.act-cell.l1 { background: #9b8cff55; } .act-cell.l2 { background: #9b8cff99; } .act-cell.l3 { background: #9b8cffcc; } .act-cell.l4 { background: var(--accent); }
.act-cell.is-today { outline: 1px solid var(--text-2); outline-offset: 1px; }
.act-cell.is-future { background: transparent; }
.dash-note { font-size: var(--fs-xs); color: var(--faint); }

/* shelf: books */
.shelf-books { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: var(--sp-4); margin-bottom: var(--sp-6); }
.book-card {
  position: relative; display: flex; flex-direction: column; gap: var(--sp-2); min-height: 250px;
  padding: var(--sp-4) var(--sp-4) var(--sp-4) calc(var(--sp-4) + 10px); text-decoration: none; color: var(--text);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow); overflow: hidden;
  transition: transform .15s ease, border-color .15s ease;
}
.book-card:hover { transform: translateY(-2px); border-color: var(--accent); color: var(--text); }
.book-spine { position: absolute; inset: 0 auto 0 0; width: 8px; background: var(--accent); }
.b-python { background: linear-gradient(180deg, #ffd43b, #3776ab); }
.b-aws { background: linear-gradient(180deg, #ff9900, #232f3e); }
.b-ai { background: linear-gradient(180deg, #9b8cff, #ff7ab6); }
.b-core-eng { background: linear-gradient(180deg, #6ee7d8, #0f766e); }
.b-system-design { background: linear-gradient(180deg, #6cb4ff, #3b3fb6); }
.b-dsa-patterns { background: linear-gradient(180deg, #4ade9a, #166534); }
.b-sql { background: linear-gradient(180deg, #7dd3fc, #336791); }
.book-order { font-size: var(--fs-xs); font-family: var(--mono); color: var(--muted); }
.book-title { font-size: var(--fs-xl); font-weight: 750; line-height: 1.2; }
.book-card .book-blurb { font-size: var(--fs-sm); color: var(--text-2); margin: 0; flex: 1; }
.book-counts { font-size: var(--fs-xs); color: var(--muted); }
.book-status { align-self: flex-start; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 3px 9px; border-radius: 999px; border: 1px dashed var(--faint); color: var(--muted); }
.book-status.is-live { border: 1px solid var(--ok); color: var(--ok); background: var(--ok-soft); }
.book-progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.book-progress-fill { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .3s ease; }
.book-read { font-size: var(--fs-xs); color: var(--muted); min-height: 1.2em; }
.book-read .rv { color: var(--warn); }

/* finder */
.finder { margin-bottom: var(--sp-6); }
.finder h2 { margin: 0 0 4px; font-size: var(--fs-xl); }
.finder-sub { color: var(--muted); margin: 0; font-size: var(--fs-sm); }
.finder-results { display: grid; gap: var(--sp-2); }
.finder-book { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); }
.finder-book > summary { padding: var(--sp-3) var(--sp-4); font-weight: 600; display: flex; justify-content: space-between; gap: var(--sp-3); }
.finder-book-count { color: var(--muted); font-weight: 500; font-size: var(--fs-sm); }
.finder-list { list-style: none; margin: 0; padding: 0 var(--sp-3) var(--sp-3); }
.finder-more { color: var(--muted); font-size: var(--fs-xs); padding: 6px 10px; }

/* book index TOC (static HTML, decorated by book.js) */
.book-meta { font-size: var(--fs-sm); color: var(--muted); }
.book-note { font-size: var(--fs-sm); background: var(--info-soft); border: 1px solid #6cb4ff40; border-radius: var(--r-md); padding: var(--sp-2) var(--sp-3); }
.toc { display: grid; gap: var(--sp-3); }
.toc-chapter { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--sp-4); }
.toc-chapter.is-planned { background: transparent; border-style: dashed; }
.toc-head { display: flex; gap: var(--sp-3); align-items: baseline; }
.toc-num { font-family: var(--mono); color: var(--muted); font-size: var(--fs-sm); min-width: 1.6em; }
.toc-title { margin: 0; font-size: var(--fs-lg); flex: 1; line-height: 1.3; }
.toc-title a { color: var(--text); text-decoration: none; }
.toc-title a:hover { color: var(--accent); }
.toc-chapter.is-planned .toc-title { color: var(--muted); font-weight: 500; }
.toc-count { font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.toc-count.is-done { color: var(--ok); }
.toc-bar { height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; margin: var(--sp-2) 0; }
.toc-bar-fill { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s ease; }
.toc-cards { list-style: none; margin: var(--sp-2) 0 0; padding: 0; display: grid; gap: 2px; }
.toc-card { display: flex; flex-wrap: wrap; gap: 4px var(--sp-2); align-items: center; padding: 6px 8px; border-radius: var(--r-sm); }
.toc-card:hover { background: var(--panel-2); }
.toc-card-title { flex: 1 1 260px; color: var(--text-2); text-decoration: none; font-size: var(--fs-sm); }
a.toc-card-title:hover { color: var(--accent); }
.toc-chapter.is-planned .toc-card-title { color: var(--muted); }
.toc-pills { display: flex; gap: 4px; flex-wrap: wrap; }
.toc-card.is-bookmarked .toc-card-title::after { content: " \2605"; color: var(--accent); }

/* state tools: export / import / reset */
.state-tools:empty { display: none; }
.state-tools { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; margin: var(--sp-3) 0; font-size: var(--fs-sm); color: var(--muted); }
.state-tools-note { flex-basis: 100%; font-size: var(--fs-xs); color: var(--faint); margin: 0; }
