/* Minimal, e-ink friendly: pure black on white, no animation, transitions, shadows or gradients. */
*, *::before, *::after { box-sizing: border-box; transition: none !important; animation: none !important; box-shadow: none !important; }
html { -webkit-text-size-adjust: 100%; background: #fff; }
body {
  margin: 0 auto; background: #fff; color: #000; max-width: 1280px;
  font: 17px/1.25 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: env(safe-area-inset-top) 12px env(safe-area-inset-bottom);
  -webkit-tap-highlight-color: transparent; overscroll-behavior: none;
}
button, input, select { font: inherit; color: #000; }
a { color: #000; }
.foot a { align-self: center; }
button {
  background: #fff; border: 2px solid #000; border-radius: 0; min-height: 36px; min-width: 36px;
  padding: 0 10px; cursor: pointer; touch-action: manipulation;
}
button:active { background: #000; color: #fff; }
input, select {
  border: 2px solid #000; border-radius: 0; background: #fff; min-height: 36px; padding: 0 6px; min-width: 0;
  -webkit-appearance: none; appearance: none;
}
input:focus, select:focus, button:focus-visible { outline: 2px solid #000; outline-offset: 1px; }

header { display: flex; align-items: center; gap: 10px; padding: 8px 0 6px; border-bottom: 3px solid #000; }
h1 { font-size: 22px; margin: 0; flex: 1; }
#status { font-size: 14px; }

main { display: grid; gap: 0 28px; align-items: start; }
@media (min-width: 640px) { main { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
main > section { min-width: 0; }

.sec-head { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; border-bottom: 2px solid #000; padding-bottom: 2px; }
h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .06em; margin: 0; flex: 1; }
.sec-head button { min-height: 30px; min-width: 30px; padding: 0 8px; font-weight: 700; }
ul { list-style: none; margin: 0; padding: 0; }
li { border-bottom: 1px solid #000; }
.row { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 2px 0; }
.name { flex: 1; min-width: 0; overflow-wrap: break-word; cursor: pointer; padding: 6px 0; }
.habit .name, body.edit .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.todo.done .name { text-decoration: line-through; }

.box { flex: none; width: 32px; height: 32px; min-width: 32px; min-height: 32px; padding: 0; font-size: 20px; line-height: 1; font-weight: 700; }
.box.on { background: #000; color: #fff; }

.bar { flex: none; width: 72px; height: 14px; border: 2px solid #000; background: #fff; }
.bar i { display: block; height: 100%; background: #000; }
.num { flex: none; font-size: 15px; font-variant-numeric: tabular-nums; min-width: 56px; text-align: right; }
.streak { flex: none; font-size: 14px; min-width: 30px; text-align: right; font-variant-numeric: tabular-nums; }

.panel { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0 8px 40px; align-items: center; }
.panel input[type=number], .panel input.n { width: 84px; }
.panel .wide { flex: 1 1 160px; }
.tools { display: flex; gap: 4px; flex: none; }
.tools button { padding: 0 6px; }

form.add { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 0; border-bottom: 1px solid #000; }
form.add .wide { flex: 1 1 160px; }
form.add input.n { width: 84px; }
.empty { padding: 10px 0; font-size: 15px; }
.foot { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; padding: 14px 0; font-size: 14px; }

body.login form { display: flex; flex-direction: column; gap: 10px; max-width: 420px; padding-top: 16px; }

@media (max-width: 420px) { .bar { width: 54px; } .num { min-width: 48px; } body { font-size: 16px; } }

/* ---- nav + Author / Sales pages */
header { flex-wrap: wrap; }
nav { display: flex; gap: 2px; }
nav a { text-decoration: none; padding: 6px 8px; border: 2px solid transparent; font-size: 16px; }
nav a.on { border-color: #000; font-weight: 700; }
.wide-sec { grid-column: 1 / -1; }
.stats { display: flex; flex-wrap: wrap; gap: 4px 20px; padding: 8px 0; }
.stats div { display: flex; flex-direction: column; min-width: 90px; }
.stats b { font-size: 22px; font-variant-numeric: tabular-nums; }
.stats span { font-size: 14px; }
.stats.small b { font-size: 19px; }
form.inline { display: flex; gap: 6px; flex: 1; }
form.inline input { flex: 1; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { border-bottom: 1px solid #000; padding: 6px 4px; text-align: right; white-space: nowrap; }
th { font-size: 14px; border-bottom-width: 2px; }
th.l, td.bk, th:first-child, td:first-child { text-align: left; }
td.bk { white-space: normal; width: 100%; }
td.bk input { width: 100%; }
td.d { font-size: 14px; }
td input.n { width: 96px; }
form.daily { border-bottom: 2px solid #000; padding-bottom: 8px; }
form.daily .row { gap: 8px; }
label { display: inline-flex; align-items: center; gap: 6px; }
.total .big { font-size: 26px; font-variant-numeric: tabular-nums; }
.total .row { border-top: 3px solid #000; margin-top: 8px; padding-top: 6px; }
.total .d { font-size: 15px; min-width: 40px; text-align: right; }
@media (max-width: 420px) {
  nav a { padding: 6px 5px; font-size: 15px; }
  th, td { padding: 6px 2px; }
  td input.n { width: 76px; }
  .stats div { min-width: 70px; }
}
form.daily .add { display: flex; flex-wrap: wrap; gap: 8px 14px; padding: 8px 0; }
form.daily input.n { width: 100px; }
/* Today on the Boox/tablet portrait: give habits (bars + numbers) a bit more width than to-dos. */
@media (min-width: 640px) and (max-width: 1000px) { body[data-page="today"] main { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); } }
/* sparklines (Sales) */
svg.spark { display: block; overflow: visible; }
td.sp { width: 60px; padding-right: 2px; }
table.sales td.bk { width: auto; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.total svg.spark { flex: none; }
@media (max-width: 520px) {
  table.sales .asof { display: none; }
  table.sales td.bk { max-width: 110px; }
}

/* ===================== orientation / device layouts (v1.2.0) =====================
   Phone portrait  (~412x915):  1 column.
   Phone landscape (~915x412):  2 columns, compact header + rows (short-height rule below).
   Boox portrait   (702x936):   2 columns (habits a bit wider).   Boox landscape (936x702): 2 columns, compact rows.
   Tab S8 Ultra    (924x1480 portrait: 2 columns; 1480x924 landscape: 3 columns = habits in 2 + to-dos).
   Page width is capped at 1280 px so rows never get absurdly wide. */

/* Short screens (landscape phone / Boox, small windows): tighter header and rows. */
@media (max-height: 760px) and (orientation: landscape) {
  header { padding: 4px 0 3px; gap: 8px; }
  h1 { font-size: 19px; }
  nav a { padding: 3px 7px; }
  #edit-toggle, header button { min-height: 32px; }
  .sec-head { margin-top: 6px; }
  .row { min-height: 35px; padding: 1px 0; gap: 7px; }
  .name { padding: 4px 0; }
  .box { width: 30px; height: 30px; min-width: 30px; min-height: 30px; font-size: 18px; }
  button, input, select { min-height: 32px; }
  .stats { padding: 4px 0; }
  .stats b { font-size: 20px; }
  th, td { padding: 4px 4px; }
}
/* Very short (phone landscape): keep header on one line, smaller title. */
@media (max-height: 480px) and (orientation: landscape) {
  h1 { font-size: 17px; }
  nav a { font-size: 15px; }
  body { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
}

/* Wide landscape (tablet landscape, desktop): Today gets 3 columns - habits flow in 2, to-dos in 1. */
@media (min-width: 1200px) and (min-height: 600px) {
  body[data-page="today"] main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
  /* Sales: books table on the left, Patreon + total on the right. */
  body[data-page="sales"] main { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
  body[data-page="sales"] .sec-books { grid-column: 1; grid-row: span 2; }
  body[data-page="sales"] .sec-patreon, body[data-page="sales"] .sec-total { grid-column: 2; }
  body[data-page="sales"] .sec-total .row { margin-top: 0; }
  /* Author: monthly table + history side by side */
  body[data-page="author"] main { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
/* Landscape phone/Boox: Sales daily form side by side with the Patreon inputs below fits; keep tables compact. */
@media (orientation: landscape) and (max-height: 760px) {
  table.sales td.bk { max-width: 260px; }
}
th { white-space: normal; vertical-align: bottom; }
@media (max-width: 480px) { table { font-size: 15px; } }
/* Big tablets (Tab S8 Ultra, both orientations): slightly larger type and rows so the 14.6" screen is used well. */
@media (min-width: 900px) and (min-height: 900px) {
  body { font-size: 19px; }
  h1 { font-size: 24px; }
  h2 { font-size: 16px; }
  .row { min-height: 46px; }
  .box { width: 36px; height: 36px; min-width: 36px; min-height: 36px; font-size: 22px; }
  .bar { width: 96px; height: 16px; }
  .num { font-size: 16px; min-width: 64px; }
  .streak { font-size: 15px; }
  button, input, select { min-height: 40px; }
  .panel { padding-left: 46px; }
}

/* ---- v1.3.x: habit sections, streak sparkline, due dates, month calendar */
.part-h { border-bottom: 0; break-after: avoid; -webkit-column-break-after: avoid; }
.part-h h3 { margin: 0; padding: 5px 0 1px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; border-bottom: 1px solid #000; }
.part-empty { border-bottom: 1px dotted #000; }
.part-empty button { border: 0; min-height: 26px; padding: 0 0 0 40px; font-size: 14px; color: #555; background: none; width: 100%; text-align: left; }
.part-empty button:active { background: #000; color: #fff; }
.part-b { flex: none; min-width: 0; padding: 0 6px; font-size: 13px; font-weight: 700; }
.seg { display: inline-flex; flex: 1 1 100%; border: 2px solid #000; }
.seg label { flex: 1; display: flex; align-items: center; justify-content: center; gap: 4px; min-height: 32px; font-size: 14px; cursor: pointer; border-right: 1px solid #000; }
.seg label:last-child { border-right: 0; }
.seg input { min-height: 0; width: 14px; height: 14px; padding: 0; border: 2px solid #000; border-radius: 50%; margin: 0; }
.seg input:checked { background: #000; }
.hsp { flex: none; display: flex; align-items: center; }
.due-l { flex: none; font-size: 13px; white-space: nowrap; }
.due-l.hot { font-weight: 700; }
form.add input[type=date], .panel input[type=date] { flex: 0 1 150px; }
body.edit .due-l, body.edit .hsp, body.edit .cal-sec { display: none; }
@media (min-width: 640px) and (max-width: 1000px) { body.edit[data-page="today"] main { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }

/* Month calendar: always a Monday-first 7-column grid. Each day = a 4x4 pixel "sand" glyph filling from the bottom. */
.cal-sec .sec-head { gap: 12px; }
.cal-sec h2 { flex: none; }
.cal-sum { flex: 1; min-width: 0; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; padding: 4px 0; max-width: 340px; }
.cal .wd { font-size: 11px; text-align: center; line-height: 1; font-weight: 700; }
.cd { position: relative; display: flex; align-items: flex-end; justify-content: center; height: 30px; min-height: 30px; min-width: 0;
      padding: 0 0 3px; border: 1px solid #000; background: #fff; color: #000; }
.cd .dn { position: absolute; left: 2px; top: 1px; font-size: 9px; line-height: 1; font-variant-numeric: tabular-nums; }
.cd svg.px { display: block; }
.cd.today { outline: 3px solid #000; outline-offset: 1px; z-index: 1; }
.cd.today .dn { font-weight: 700; }
.cd.sel { outline: 2px dashed #000; outline-offset: 1px; z-index: 1; }
.cd.future { border-style: dotted; }
.cd:active { background: #fff; color: #000; }
.cd .dot { position: absolute; right: 2px; top: 2px; width: 5px; height: 5px; border-radius: 50%; background: #000; }
/* Landscape 800-1199 px (Boox / phone): calendar is a narrow third column beside the two lists. */
@media (orientation: landscape) and (min-width: 800px) and (max-width: 1199px) {
  body[data-page="today"] main { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) 196px; gap: 0 18px; }
  body[data-page="today"] .cal-sec, body[data-page="today"] .foot { grid-column: 3; grid-row: 1; }
  body[data-page="today"] .foot { flex-direction: column; align-items: flex-start; padding-top: 10px; }
  .cal-sec .sec-head { flex-wrap: wrap; gap: 0 8px; }
  .cal-sec .cal-sum { flex: 1 1 100%; order: 3; white-space: normal; text-align: left; font-size: 13px; line-height: 1.3; padding-bottom: 2px; }
  .cal { max-width: none; gap: 2px; }
}
/* >= 1200 px (tablet landscape, desktop): habits in one column on the left; to-dos + calendar on the right. */
@media (min-width: 1200px) and (min-height: 600px) {
  /* habits: always ONE column on the left (sections stacked); to-dos then the calendar on the right */
  body[data-page="today"]:not(.edit) main { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "h t" "h c"; grid-template-rows: auto 1fr; }
  body[data-page="today"]:not(.edit) .sec-habits { grid-area: h; }
  body[data-page="today"]:not(.edit) .sec-todos { grid-area: t; }
  body[data-page="today"]:not(.edit) .cal-sec { grid-area: c; }
}
@media (min-width: 900px) and (min-height: 900px) { .cal { max-width: 400px; } .cd { height: 36px; min-height: 36px; } .cd .dn { font-size: 11px; } }

/* ===================== v1.3.1: every page + mode fits one screen (no page scrolling) =====================
   Checked by tests/orientation_shots.py on S24 Ultra, Tab S8 Ultra and Boox Go 10.3, portrait + landscape. */
/* Today: forms float over the list (at their natural spot) instead of pushing content down; app.js lifts any
   that would run past the bottom edge (placeOverlays). */
body[data-page="today"] main > section, body[data-page="today"] li { position: relative; }
body[data-page="today"] form.panel, body[data-page="today"] form.add {
  position: absolute; left: 0; right: 0; z-index: 5; background: #fff; border: 2px solid #000; padding: 6px; }
body[data-page="today"] form.panel { padding-left: 6px; }
/* Adaptive paging (Author lists + months): rows that don't fit are hidden, the pager walks through them. */
.ti.cut { display: none; }
.pager { display: flex; align-items: center; gap: 4px; font-size: 13px; flex: none; }
.pager[hidden] { display: none; }
.sec-head .pager button { min-height: 26px; min-width: 30px; padding: 0 4px; }
.hint { font-size: 12px; font-weight: normal; }
/* Sales daily-entry form (replaces the page while open). */
form.daily .dtop { flex-wrap: wrap; border-bottom: 2px solid #000; }
.sp-fill { flex: 1; }
.dgrid { display: grid; gap: 0 24px; }
.drow { display: flex; align-items: center; gap: 6px; border-bottom: 1px solid #000; min-height: 38px; padding: 2px 0; }
.drow.dh { min-height: 22px; font-size: 13px; font-weight: 700; border-bottom-width: 2px; }
.drow .sl { flex: none; width: 18px; }
.drow .bk { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drow input.n, .drow span.n { flex: none; width: 92px; }
.dcol + .dcol .dh { display: none; }
form.daily .dpat { align-items: center; border-bottom: 0; }
body.edit[data-page="sales"] .sec-update { display: none; }
.sec-books .sec-head form.inline { flex: none; }
.sec-books .sec-head form.inline button { min-height: 28px; }

/* Phone portrait (< 640 px): habits full width; to-dos + month calendar side by side below. */
@media (max-width: 639px) {
  body[data-page="today"] main { grid-template-columns: minmax(0, 1fr) 172px; gap: 0 12px; }
  body[data-page="today"] .sec-habits, body[data-page="today"] .foot { grid-column: 1 / -1; }
  body[data-page="today"] .cal-sec { grid-column: 2; grid-row: 2; }
  body.edit[data-page="today"] main { grid-template-columns: minmax(0, 1fr); }
  .todo .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .cal-sec .sec-head { flex-wrap: wrap; gap: 0 8px; }
  .cal-sec .cal-sum { flex: 1 1 100%; order: 3; white-space: normal; text-align: left; font-size: 12px; line-height: 1.3; padding-bottom: 2px; }
  .cal { gap: 2px; max-width: none; }
  .cd { height: 28px; min-height: 28px; }
  .row { min-height: 36px; padding: 1px 0; }
  .name { padding: 3px 0; }
  .sec-head { margin-top: 6px; }
  .part-h h3 { padding-top: 3px; }
  .stats { gap: 2px 14px; padding: 4px 0; }
  .stats b { font-size: 18px; } .stats span { font-size: 12px; }
  .stats.small b { font-size: 17px; }
  form.add { padding: 4px 0; }
  .sec-book .row { min-height: 0; }
  th, td { padding: 4px 2px; }
  th { font-size: 12px; }
  table { font-size: 14px; }
  .drow input.n, .drow span.n { width: 80px; }
}
/* Landscape >= 800 px wide: Sales books left, Patreon + total right; Author in 3 columns; daily form 2 columns. */
@media (orientation: landscape) and (min-width: 800px) {
  body[data-page="sales"] main { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
  body[data-page="sales"] .sec-books { grid-column: 1; grid-row: span 2; }
  body[data-page="sales"] .sec-patreon, body[data-page="sales"] .sec-total { grid-column: 2; }
  body[data-page="sales"] .sec-total .row { margin-top: 0; }
  .dgrid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .dcol + .dcol .dh { display: flex; }
  body[data-page="author"] main { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-areas: "a a a" "b1 b2 m" "r e m"; }
  body[data-page="author"] .sec-all { grid-area: a; } body[data-page="author"] .sec-b1 { grid-area: b1; }
  body[data-page="author"] .sec-b2 { grid-area: b2; } body[data-page="author"] .sec-months { grid-area: m; }
  body[data-page="author"] .sec-rel { grid-area: r; } body[data-page="author"] .sec-ent { grid-area: e; }
  body[data-page="author"] .sec-months table { font-size: 14px; }
  body[data-page="author"] .sec-all .stats { flex-wrap: nowrap; }
}
/* Very short landscape (phone): compact everything. */
@media (orientation: landscape) and (max-height: 480px) {
  header { padding: 2px 0; }
  #edit-toggle, header button, nav a { min-height: 28px; }
  .sec-head { margin-top: 2px; padding-bottom: 1px; }
  h2 { font-size: 13px; }
  .sec-head button { min-height: 24px; min-width: 26px; }
  .row { min-height: 28px; padding: 0; gap: 6px; }
  .name { padding: 2px 0; }
  .box { width: 26px; height: 26px; min-width: 26px; min-height: 26px; font-size: 16px; }
  .part-h h3 { padding: 2px 0 0; font-size: 11px; }
  .part-empty button { min-height: 22px; }
  button, input, select { min-height: 28px; }
  .tools button, .part-b { min-width: 28px; }
  .cd { height: 26px; min-height: 26px; }
  .stats { padding: 2px 0; gap: 2px 14px; }
  .stats b { font-size: 17px; } .stats span { font-size: 12px; } .stats.small b { font-size: 16px; }
  th, td { padding: 2px 3px; }
  th { font-size: 12px; }
  table { font-size: 14px; }
  form.add { padding: 3px 0; gap: 4px; }
  .drow { min-height: 32px; padding: 1px 0; }
  form.daily .add { padding: 3px 0; }
  .total .big { font-size: 22px; }
  .foot { padding: 6px 0; }
}
@media (max-width: 639px) {
  .tools button, .part-b { min-height: 32px; min-width: 32px; }
  .tools { gap: 3px; }
  body.edit .row { min-height: 34px; }
  .foot { padding: 6px 0; }
}
@media (orientation: landscape) and (min-width: 800px) and (max-width: 1199px) {
  body[data-page="author"] .sec-months table { font-size: 12px; }
  body[data-page="author"] .sec-months th, body[data-page="author"] .sec-months td { padding: 3px 2px; }
  body[data-page="author"] .sec-months th { white-space: normal; }
  body[data-page="author"] .sec-months .hint { display: none; }
}
.sec-head .rel-b { flex: none; font-weight: normal; font-size: 14px; }
.sec-book form.add input.n { width: 84px; flex: 0 1 84px; }
.sec-book form.add input[type=date] { flex: 0 1 150px; }
.stats.small div { min-width: 0; }
.stats.small { gap: 2px 18px; }
body.edit .sec-head .rel-b { display: none; }
.sec-head form.inline input { min-width: 0; }
@media (orientation: landscape) and (max-height: 480px) {
  .sec-book form.add input[type=date] { flex: 0 1 132px; width: 132px; padding: 0 2px; }
  .sec-book form.add input.n { width: 72px; flex-basis: 72px; }
}
.part-b { width: 84px; text-align: center; } @media (orientation: landscape) and (max-height: 480px) { .part-b { width: 80px; } }
.sec-rel h2, .sec-ent h2, .sec-months h2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* ---- v1.3.3 Author: release rows (Ch | date | words) and the word-entries table (Date | book 1 | book 2) */
.rel-row .rc { flex: none; width: 66px; font-weight: 700; font-variant-numeric: tabular-nums; }
.rel-row .rd { flex: 1; min-width: 0; white-space: nowrap; }
.rel-row .rd small { font-size: 11px; }
.rel-row .rw { flex: none; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
table.ent td { padding: 0 2px; }
table.ent th { font-size: 13px; }
table.ent td:first-child { white-space: nowrap; padding-left: 0; }
table.ent .cell { width: 100%; min-height: 34px; border: 0; padding: 0 4px; text-align: right; font-variant-numeric: tabular-nums; background: none; }
table.ent .cell.on { outline: 2px solid #000; outline-offset: -2px; }
table.ent .cell small { font-size: 11px; }
tr.cell-edit td { padding: 0; text-align: left; }
tr.cell-edit .panel { padding: 2px 0 4px; flex-wrap: nowrap; }
tr.cell-edit .pl { display: block; font-size: 13px; padding-top: 2px; }
.panel input.n { width: 84px; }
@media (orientation: landscape) and (max-height: 480px) { table.ent .cell { min-height: 28px; } .rel-row .rc { width: 58px; } }
@media (min-width: 900px) and (min-height: 900px) { table.ent .cell { min-height: 42px; } }

/* ---- v1.4.0 Month / Year pages: Habits | Author | Sales reports, ‹ › period stepper ---- */
/* v1.4.1: no Edit on Month/Year, but keep its slot so the header never moves between pages */
body[data-page="month"] #edit-toggle, body[data-page="year"] #edit-toggle { visibility: hidden; pointer-events: none; }
.sec-period .row { gap: 8px; min-height: 0; padding: 4px 0 0; }
.sec-period h2 { flex: none; font-size: 18px; text-transform: none; letter-spacing: 0; min-width: 9em; text-align: center; }
.sec-period button { min-height: 32px; }
.sec-period button[disabled] { border-style: dotted; color: #000; opacity: .35; }
.psum { font-size: 14px; padding: 3px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.psum svg.bars { display: inline-block; vertical-align: middle; margin-left: 6px; }
.sec-head.sub { margin-top: 4px; border-bottom-width: 1px; }
.sec-head.sub h2 { font-size: 13px; }
table.ptab th, table.ptab td { padding: 3px 3px; font-size: 14px; }
table.ptab th { font-size: 12px; }
table.ptab td.bk { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.ptab tr.tot td { font-weight: 700; border-top: 2px solid #000; }
table.ptab small { font-size: 11px; }
table.ptab td.sp, table.ptab th.sp { width: 60px; }
svg.bars, svg.pbar { display: inline-block; vertical-align: middle; }
.sec-pa .rel-row { min-height: 26px; font-size: 14px; }
.sec-pa .rel-row .rc { width: 56px; }
.prow { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 2px 0; border-bottom: 1px solid #000; }
.prow span { width: 64px; flex: none; }
.prow b { flex: 1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pcal { max-width: 300px; gap: 2px; padding: 2px 0; }
.pcal .cd { height: 24px; min-height: 24px; border: 1px solid #000; }
/* Author page pace stat + Sales/Patreon sparklines */
.pace-l { font-size: 14px; margin-top: -4px; padding-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sec-patreon .stats svg.spark { margin-top: 2px; }
table.sales td.sp.rk, table.sales th.sp.rk { width: 48px; }
@media (max-width: 520px) { table.sales td.sp svg.spark { width: 40px; } table.sales td.sp { width: 42px; } }
/* layouts: phone portrait = stacked; >= 640 portrait = habits | author over sales; landscape >= 800 = 3 columns */
body[data-page="month"] main, body[data-page="year"] main { grid-template-columns: minmax(0, 1fr); }
body[data-page="month"] .sec-period, body[data-page="year"] .sec-period { grid-area: p; }
.sec-ph { grid-area: h; } .sec-pa { grid-area: a; } .sec-ps { grid-area: s; }
body[data-page="month"] main, body[data-page="year"] main { grid-template-areas: "p" "h" "a" "s"; }
@media (min-width: 640px) {
  body[data-page="month"] main, body[data-page="year"] main { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "p p" "h a" "h s"; }
}
@media (min-width: 800px) and (orientation: landscape) {
  body[data-page="month"] main, body[data-page="year"] main { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "p p p" "h a s"; gap: 0 18px; }
}
@media (min-width: 900px) and (min-height: 900px) {
  table.ptab th, table.ptab td { padding: 5px 4px; font-size: 16px; }
  .psum, .prow { font-size: 16px; }
  .pcal { max-width: 380px; } .pcal .cd { height: 32px; min-height: 32px; }
  .sec-pa .rel-row { min-height: 32px; font-size: 16px; }
}
@media (max-width: 480px) { nav a { padding: 4px 3px; font-size: 14px; } header { gap: 6px; } h1 { font-size: 18px; } }
h1 { white-space: nowrap; }
@media (max-width: 480px) { h1 .wk { display: none; } #edit-toggle { padding: 0 8px; } .pcal .cd { height: 20px; min-height: 20px; } .pcal { max-width: 320px; } }
/* 3 narrow columns (phone / Boox landscape): drop the slot # and Year avg/day, tighter book names */
@media (orientation: landscape) and (max-width: 1100px) {
  body[data-page="year"] table.ptab .avg, table.ptab .sl { display: none; }
  table.ptab td.bk { max-width: 92px; }
  table.ptab td.sp, table.ptab th.sp { width: 50px; }
  table.ptab th, table.ptab td { padding: 3px 2px; font-size: 13px; }
}
@media (max-width: 480px) { .pace-l { font-size: 13px; } }
@media (max-width: 420px) { .stats { gap: 4px 12px; } .stats div { min-width: 0; } }
/* v1.4.1: identical header on every page. Bold active tab reserves its bold width on every tab (hidden ::after),
   Edit/Done share one fixed-width slot (hidden on Month/Year), header keeps one height. */
nav a { display: inline-flex; flex-direction: column; align-items: center; }
nav a::after { content: attr(data-l); font-weight: 700; height: 0; visibility: hidden; overflow: hidden; pointer-events: none; }
#edit-toggle { flex: none; min-width: 4.4em; text-align: center; }
header { flex-wrap: nowrap; }
nav { flex: none; }
h1 { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
#status { flex: none; }
/* v1.4.1 Author: Daily / Monthly word blocks share the entries table's columns (fixed layout, same widths) */
table.ent { table-layout: fixed; }
table.ent col.c0 { width: 30%; }
table.ent th, table.ent td { overflow: hidden; text-overflow: ellipsis; }
table.wct td { padding: 2px 4px; font-variant-numeric: tabular-nums; }
table.wct td:first-child { font-size: 14px; }
table.wct tr.wch th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; padding: 5px 0 1px; border-bottom: 1px solid #000; font-weight: 700; }
table.wct tr.wch th b { font-size: 14px; text-transform: none; letter-spacing: 0; }
table.wct tbody.wc-mon tr.wch th { border-top: 2px solid #000; }
table.wct thead th { font-size: 13px; }
table.wct tr.wch th { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.wct thead th { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.wct tbody.ent-h th { padding: 0; border-bottom: 0; text-transform: none; letter-spacing: 0; }
table.wct tbody.ent-h .sec-head { margin-top: 8px; }
@media (orientation: landscape) and (max-height: 480px) {
  table.wct td { padding: 1px 4px; }
  table.wct tr.wch th { padding: 3px 0 0; }
  table.wct tbody.ent-h .sec-head { margin-top: 4px; }
}
/* v1.4.1 phone landscape: the word blocks + entries take the roomy right column, months go under book 2 */
@media (orientation: landscape) and (max-height: 480px) and (min-width: 800px) {
  body[data-page="author"] main { grid-template-areas: "a a a" "b1 b2 e" "r m e"; }
}
