/* Reading Log v2 preview - layered on ../assets/app.css */

/* Navy dark theme (chart colours validated against the #111a2e card surface) */
html[data-theme="dark"] body.v2 {
  --page: #0a1120; --surface: #111a2e; --surface-2: #19243c; --side: #0d1526;
  --ink: #e8eef8; --ink-2: #a9b6cc; --muted: #7d8aa3;
  --grid: #1e2a42; --axis: #2c3a56;
  --border: rgba(148, 170, 210, 0.13); --hover: rgba(148, 170, 210, 0.07);
  --accent: #3987e5; --accent-ink: #7fb2f0;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300;
  --other: #56627a; --star: #f2b829; --star-off: #33415c;
  --heat-0: #19243c; --heat-1: #143d73; --heat-2: #1c5cab; --heat-3: #3987e5; --heat-4: #86b6ef;
  --good: #22c55e; --bad: #f87171;
  --shadow: none;
}
body.v2 { --side: #f1f0ec; --other: #b3b1a8; --star: #e3a008; --star-off: #dcdad3; --s5: #e87ba4; --s6: #008300; }

/* Shell */
.v2 .shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.v2 .side { position: sticky; top: 0; height: 100vh; background: var(--side); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 20px 14px; gap: 22px; }
.v2 .ic { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.v2 .side-brand { display: flex; gap: 10px; align-items: center; color: var(--ink); text-decoration: none; padding: 0 8px; }
.v2 .side-brand .ic { color: var(--accent-ink); }
.v2 .side-brand b { display: block; font-size: 1.1rem; line-height: 1.1; }
.v2 .side-brand small { color: var(--accent-ink); font-size: 0.82rem; }
.v2 .side-nav { display: flex; flex-direction: column; gap: 3px; }
.v2 .side-nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--ink-2); text-decoration: none; font-size: 0.94rem; }
.v2 .side-nav a:hover { background: var(--hover); color: var(--ink); }
.v2 .side-nav a.on { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--ink); font-weight: 600; }
.v2 .side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; padding: 0 8px; }
.v2 blockquote { margin: 0; font-style: italic; color: var(--ink-2); font-size: 0.9rem; line-height: 1.5; }
.v2 blockquote cite { display: block; margin-top: 6px; font-size: 0.8rem; color: var(--muted); }
.v2 .side-tools { display: flex; gap: 6px; flex-wrap: wrap; }
.v2 .side-v1 { font-size: 0.82rem; color: var(--muted); text-decoration: none; }
.v2 .side-v1:hover { color: var(--ink); }
.v2 .chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--ink-2); font-size: 0.82rem; text-decoration: none; cursor: pointer; white-space: nowrap; }
.v2 .chip:hover { color: var(--ink); }
.v2 .chip.on { border-color: var(--accent); color: var(--ink); }
.v2 .chip.warn { border-color: var(--s4); color: var(--ink); }

.v2 .main { padding: 24px 28px 56px; min-width: 0; }
.v2 .main-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.v2 .main-head h1 { font-size: 1.75rem; }
.v2 .main-head .sub { margin: 4px 0 0; color: var(--ink-2); }
.v2 .head-tools { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 900px) {
  .v2 .shell { display: block; }
  .v2 .side { position: sticky; z-index: 20; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 12px; gap: 8px 12px; border-right: none; border-bottom: 1px solid var(--border); }
  .v2 .side-brand { flex: 1; padding: 0; }
  .v2 .side-brand .ic { width: 24px; height: 24px; }
  .v2 .side-nav { order: 3; flex-basis: 100%; flex-direction: row; overflow-x: auto; scrollbar-width: none; }
  .v2 .side-nav a { padding: 7px 10px; white-space: nowrap; font-size: 0.88rem; }
  .v2 .side-nav a .ic { display: none; }
  .v2 .side-foot { margin: 0; flex-direction: row; align-items: center; padding: 0; }
  .v2 .side-foot blockquote, .v2 .side-v1 { display: none; }
  .v2 .main { padding: 18px 16px 48px; }
  .v2 .main-head h1 { font-size: 1.4rem; }
}

/* Grids */
.v2 .row { display: grid; gap: 16px; margin-top: 16px; }
.v2 .row-3 { grid-template-columns: minmax(0, 2fr) minmax(0, 1.25fr) minmax(0, 1fr); }
.v2 .row-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.v2 .row-21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.v2 .row-12 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
@media (max-width: 1200px) { .v2 .row-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .v2 .row-3 > .span-all { grid-column: 1 / -1; } }
@media (max-width: 760px) { .v2 .row-3, .v2 .row-2, .v2 .row-21, .v2 .row-12 { grid-template-columns: minmax(0, 1fr); } }
.v2 .card { border-radius: 14px; }
.v2 .card-head h2 { font-size: 1.05rem; }
.v2 .card-head a.meta { color: var(--accent-ink); }

/* KPI tiles */
.v2 .kpis { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); }
.v2 .kpi { display: flex; gap: 14px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px; min-width: 0; }
.v2 .kpi-ic { width: 44px; height: 44px; border-radius: 11px; display: flex; align-items: center; justify-content: center; flex: none; }
.v2 .kpi-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.v2 .kpi .label { font-size: 0.86rem; color: var(--ink-2); }
.v2 .kpi .value { font-size: 1.75rem; font-weight: 650; line-height: 1.15; white-space: nowrap; }
.v2 .kpi .value small { font-size: 0.8rem; font-weight: 500; color: var(--muted); }
.v2 .kpi .foot { font-size: 0.78rem; color: var(--muted); }
.v2 .tone-green { background: color-mix(in srgb, var(--s3) 22%, transparent); color: var(--s3); }
.v2 .tone-blue { background: color-mix(in srgb, var(--s1) 22%, transparent); color: var(--accent-ink); }
.v2 .tone-violet { background: color-mix(in srgb, #8b7cf0 24%, transparent); color: #a99df5; }
.v2 .tone-amber { background: color-mix(in srgb, var(--star) 20%, transparent); color: var(--star); }
.v2 .tone-orange { background: color-mix(in srgb, var(--s2) 22%, transparent); color: var(--s2); }
.v2 .tone-pink { background: color-mix(in srgb, var(--s5) 22%, transparent); color: var(--s5); }
.v2 .tone-gray { background: var(--surface-2); color: var(--ink-2); }
.v2 .keep { color: var(--star); font-weight: 600; }

/* Stars */
.v2 .stars { font-size: 0.95rem; letter-spacing: 1px; background: linear-gradient(90deg, var(--star) var(--r), var(--star-off) var(--r)); -webkit-background-clip: text; background-clip: text; color: transparent; white-space: nowrap; }
.v2 .stars-num { font-size: 0.8rem; color: var(--ink-2); }
.v2 .stars-none { font-size: 0.78rem; color: var(--muted); }

/* Covers */
.v2 .cover-md { width: 100%; aspect-ratio: 2 / 3; height: auto; border-radius: 4px 8px 8px 4px; }
.v2 .cover-md span { font-size: 1.6rem; }
.v2 .cover-xl { width: 170px; height: 255px; }
.v2 .cover-xl span { font-size: 2.6rem; }
.v2 .cv-grid { display: grid; gap: 18px 16px; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
.v2 .cv-row { display: grid; gap: 16px; grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 760px) { .v2 .cv-row { grid-template-columns: repeat(3, minmax(0, 1fr)); } .v2 .cv-row > :nth-child(n+4) { display: none; } }
.v2 .cv-card { display: flex; flex-direction: column; gap: 3px; color: inherit; text-decoration: none; min-width: 0; }
.v2 .cv-card .cover { margin-bottom: 6px; transition: transform .15s; }
.v2 .cv-card:hover .cover { transform: translateY(-3px); }
.v2 .cv-card b { font-size: 0.9rem; line-height: 1.25; overflow-wrap: anywhere; }
.v2 .cv-card .note { font-size: 0.8rem; }

/* Lists inside cards */
.v2 .rank { display: flex; flex-direction: column; }
.v2 .rank li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--grid); font-size: 0.9rem; list-style: none; }
.v2 .rank li:last-child { border-bottom: none; }
.v2 .rank { margin: 0; padding: 0; }
.v2 .rank .n { width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); color: var(--ink-2); font-size: 0.75rem; display: flex; align-items: center; justify-content: center; flex: none; }
.v2 .rank .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v2 .rank b { font-variant-numeric: tabular-nums; }
.v2 .qs { display: flex; flex-direction: column; }
.v2 .qs-item { display: flex; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--grid); }
.v2 .qs-item:last-child { border-bottom: none; }
.v2 .qs-item .ic-box { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex: none; }
.v2 .qs-item .grow { flex: 1; min-width: 0; font-size: 0.86rem; }
.v2 .qs-item .grow span { display: block; color: var(--muted); font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v2 .qs-item > b { white-space: nowrap; font-size: 0.92rem; }

/* Donut */
.v2 .donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.v2 .donut { width: 150px; height: 150px; flex: none; }
.v2 .donut circle { fill: none; stroke-width: 18; }
.v2 .donut .d-num { font-size: 26px; font-weight: 700; fill: var(--ink); }
.v2 .donut .d-sub { font-size: 11px; fill: var(--muted); }
.v2 .donut-legend { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 150px; display: flex; flex-direction: column; gap: 7px; font-size: 0.86rem; }
.v2 .donut-legend li { display: grid; grid-template-columns: 12px 1fr auto 3.2em; gap: 8px; align-items: center; }
.v2 .donut-legend i { width: 10px; height: 10px; border-radius: 50%; }
.v2 .donut-legend b { font-weight: 600; font-variant-numeric: tabular-nums; }
.v2 .donut-legend em { font-style: normal; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }

/* Goal bars & rings */
.v2 .bar { display: block; height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.v2 .bar i { display: block; height: 100%; border-radius: 4px; }
.v2 .tone-bg-accent { background: var(--accent); }
.v2 .tone-bg-green { background: var(--s3); }
.v2 .tone-bg-violet { background: #8b7cf0; }
.v2 .tone-bg-amber { background: var(--star); }
.v2 .goal { display: flex; flex-direction: column; gap: 6px; padding: 8px 0; }
.v2 .goal-top { display: flex; justify-content: space-between; font-size: 0.88rem; gap: 8px; }
.v2 .goal-top span { color: var(--ink-2); }
.v2 .goal-top b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.v2 .goal-wrap { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.v2 .goal-wrap .goals { flex: 1; min-width: 180px; }
.v2 .ring-track { stroke: var(--surface-2); }
.v2 .ring-fill { stroke: var(--s3); }
.v2 .ring-val { font-size: 17px; }

/* Current book */
.v2 .cur { display: flex; gap: 16px; align-items: flex-start; }
.v2 .cur .cover { width: 82px; height: 123px; }
.v2 .cur-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.v2 .cur-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--grid); font-size: 0.8rem; color: var(--muted); }
.v2 .cur-meta b { display: block; color: var(--ink); font-weight: 500; font-size: 0.88rem; }
.v2 .btn-wide { display: block; text-align: center; margin-top: 14px; padding: 11px; border-radius: 10px; background: var(--accent); color: #fff; text-decoration: none; font-weight: 600; }
.v2 .btn-wide:hover { filter: brightness(1.1); }
.v2 .btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Tables */
.v2 .tbl th { border-bottom-color: var(--axis); }
.v2 .tbl tr.hl td { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.v2 .month-tables { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }
@media (max-width: 760px) { .v2 .month-tables { grid-template-columns: minmax(0, 1fr); } }

/* "Needs data" placeholder */
.v2 .needs { border: 1px dashed var(--axis); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--ink-2); }
.v2 .needs b { color: var(--ink); }
.v2 .needs code { font-size: 0.8rem; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }

/* Tabs */
.v2 .tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--grid); margin-bottom: 16px; overflow-x: auto; }
.v2 .tab-btn { background: none; border: none; padding: 10px 14px; color: var(--ink-2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.v2 .tab-btn.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }

/* Book detail */
.v2 .bd-head { display: flex; gap: 24px; align-items: flex-start; }
.v2 .bd-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.v2 .bd-info h2 { font-size: 1.8rem; }
.v2 .bd-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; margin-top: 12px; font-size: 0.8rem; color: var(--muted); }
.v2 .bd-facts b { display: block; color: var(--ink); font-weight: 500; font-size: 0.92rem; }
.v2 .bd-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.v2 .desc { color: var(--ink-2); line-height: 1.65; font-size: 0.93rem; }
@media (max-width: 640px) { .v2 .bd-head { flex-direction: column; } .v2 .cover-xl { width: 130px; height: 195px; } }

/* Diary calendar */
.v2 .dcal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; text-align: center; }
.v2 .dcal .dow { font-size: 0.72rem; color: var(--muted); padding: 4px 0; }
.v2 .dcal a, .v2 .dcal span.blank { aspect-ratio: 1; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-decoration: none; color: var(--ink-2); font-size: 0.88rem; position: relative; }
.v2 .dcal a:hover { background: var(--hover); }
.v2 .dcal a.read { color: var(--ink); font-weight: 600; }
.v2 .dcal a .dot { width: 6px; height: 6px; border-radius: 50%; margin-top: 3px; }
.v2 .dcal a.sel { background: var(--accent); color: #fff; }
.v2 .dcal a.sel .dot { background: #fff !important; }
.v2 .dcal a.today { box-shadow: inset 0 0 0 1px var(--accent); }
.v2 .day-entry { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--grid); }
.v2 .day-entry:last-child { border-bottom: none; }
.v2 .day-entry .cover { width: 46px; height: 69px; }
.v2 .day-entry .cover span { font-size: 0.8rem; }
.v2 .kv2 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; font-size: 0.78rem; color: var(--muted); margin-top: 4px; }
.v2 .kv2 b { display: block; color: var(--ink); font-size: 0.95rem; font-weight: 600; }
.v2 .quote-note { font-style: italic; color: var(--ink-2); font-size: 0.86rem; margin-top: 4px; }

/* Lists */
.v2 .list-row { display: flex; align-items: center; gap: 12px; padding: 10px 6px; border-radius: 10px; color: inherit; text-decoration: none; }
.v2 .list-row:hover { background: var(--hover); }
.v2 .list-row .grow { flex: 1; }
.v2 .list-row .ic-box { width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center; }
.v2 details.lst { border-bottom: 1px solid var(--grid); }
.v2 details.lst:last-child { border-bottom: none; }
.v2 details.lst summary { list-style: none; cursor: pointer; }
.v2 details.lst summary::-webkit-details-marker { display: none; }
.v2 details.lst[open] .cv-grid { padding: 8px 6px 16px; }

/* Filters on My Books */
.v2 .filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.v2 .filters .search { flex: 1; min-width: 200px; position: relative; }
.v2 .filters .search .ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.v2 .filters .search input { padding-left: 36px; }
.v2 .filters select { min-width: 130px; }
.v2 .input { background: var(--surface); }
.v2 .tabs { scrollbar-width: none; } .v2 .tabs::-webkit-scrollbar { display: none; }
.v2 .row { align-items: stretch; padding: 0; border-bottom: none; } .v2 .row:hover { background: none; }
@media (max-width: 520px) {
  .v2 .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .v2 .kpi { padding: 12px; gap: 10px; flex-direction: column; }
  .v2 .kpi-ic { width: 34px; height: 34px; }
  .v2 .kpi .value { font-size: 1.35rem; }
}
.v2 .dcal a.fin { box-shadow: inset 0 0 0 2px var(--s3); }
.v2 .dcal a.fin.today { box-shadow: inset 0 0 0 2px var(--s3), inset 0 0 0 3px var(--accent); }
.v2 .heat-legend .fin-key { width: 12px; height: 12px; border-radius: 4px; box-shadow: inset 0 0 0 2px var(--s3); margin: 0; }
.v2 .heat-legend { justify-content: flex-start; flex-wrap: wrap; }
.v2 .kpi .value { white-space: normal; } .v2 .kpi .value small { white-space: nowrap; }
