:root {
  color-scheme: light;
  --ink: #173b3f;
  --ink-soft: #51666a;
  --paper: #f7f3ea;
  --surface: #fffdf8;
  --surface-2: #f0ece2;
  --line: #ded9cd;
  --teal: #237b76;
  --teal-dark: #155e5b;
  --teal-soft: #dcece8;
  --sage: #9db8a7;
  --amber: #cc8a2e;
  --amber-soft: #f8ead4;
  --coral: #c45546;
  --coral-soft: #f6dfda;
  --shadow: 0 20px 60px rgba(27, 53, 54, 0.09);
  --shadow-small: 0 8px 24px rgba(27, 53, 54, 0.08);
  --radius: 22px;
  --radius-small: 14px;
  --sidebar-width: 310px;
  --transition: 180ms ease;
}

[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e9f0ec;
  --ink-soft: #a7bab6;
  --paper: #0f1f21;
  --surface: #16282a;
  --surface-2: #203437;
  --line: #344b4d;
  --teal: #65bbb1;
  --teal-dark: #8dd1c7;
  --teal-soft: #244541;
  --sage: #789b89;
  --amber: #e0aa5d;
  --amber-soft: #4d3a23;
  --coral: #ee8273;
  --coral-soft: #4b2e2b;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.22);
  --shadow-small: 0 8px 24px rgba(0, 0, 0, 0.18);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  transition: background var(--transition), color var(--transition);
}

[data-platform="android"] body { overscroll-behavior-y: none; }

button, input, select, textarea { font: inherit; }
button, label, select { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--surface);
  transform: translateY(-160%);
}
.skip-link:focus { transform: none; }

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.app-shell { min-height: 100vh; }
.print-week { display: none; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: var(--sidebar-width);
  padding: 34px 26px 24px;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.brand-row { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  position: relative;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px;
  background: var(--ink);
  box-shadow: var(--shadow-small);
}
.brand-mark::before,
.brand-mark::after,
.brand-mark span {
  content: "";
  position: absolute;
  height: 3px;
  border-radius: 4px;
  background: var(--surface);
}
.brand-mark::before { width: 17px; transform: translateY(-7px); }
.brand-mark span { width: 11px; transform: translate(3px, 0); }
.brand-mark::after { width: 14px; transform: translate(1px, 7px); }
.brand-name { font-family: Georgia, "Times New Roman", serif; font-size: 23px; font-weight: 700; letter-spacing: -0.02em; }
.brand-tagline { margin-top: -2px; color: var(--ink-soft); font-size: 12px; }

.week-summary {
  margin: 34px 0 28px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, var(--surface), var(--surface-2));
}
.eyebrow {
  color: var(--teal);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
.week-summary h2 { margin: 4px 0 18px; font-family: Georgia, "Times New Roman", serif; font-size: 25px; }
.date-jump-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: -4px 0 18px;
}
.date-jump-panel label {
  display: grid;
  gap: 5px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.date-jump-panel input,
.date-jump-panel select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  padding: 10px 11px;
  text-transform: none;
}
.progress-lockup { display: flex; align-items: center; gap: 16px; }
.progress-ring {
  display: grid;
  flex: 0 0 84px;
  width: 84px;
  height: 84px;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--teal) calc(var(--progress) * 1%), var(--line) 0);
}
.progress-ring::before { content: ""; position: absolute; width: 68px; height: 68px; border-radius: 50%; background: var(--surface); }
.progress-ring > div { position: relative; display: grid; text-align: center; }
.progress-ring strong { font-size: 18px; line-height: 1.1; }
.progress-ring span { color: var(--ink-soft); font-size: 10px; text-transform: uppercase; }
.progress-stats { display: grid; gap: 9px; }
.progress-stats div { display: grid; grid-template-columns: 28px 1fr; align-items: baseline; gap: 7px; }
.progress-stats strong { font-size: 17px; }
.progress-stats span { color: var(--ink-soft); font-size: 12px; }

.day-nav { display: grid; gap: 4px; }
.day-nav-button {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 13px;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background var(--transition), transform var(--transition);
}
.day-nav-button:hover { background: var(--surface-2); }
.day-nav-button:active { transform: scale(0.985); }
.day-nav-button[aria-current="date"] { background: var(--teal-soft); color: var(--teal-dark); }
.day-nav-date { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 10px; font-weight: 800; }
.day-nav-button[aria-current="date"] .day-nav-date { background: var(--teal); color: #fff; }
.day-nav-copy { display: grid; }
.day-nav-copy strong { font-size: 13px; }
.day-nav-copy span { color: var(--ink-soft); font-size: 11px; }
.day-nav-count { min-width: 24px; padding: 2px 7px; border-radius: 12px; background: var(--surface-2); color: var(--ink-soft); font-size: 11px; text-align: center; }

.sidebar-actions { display: grid; gap: 7px; margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--line); }
.quiet-button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  text-align: left;
}
.quiet-button:hover { background: var(--surface-2); color: var(--ink); }
.button-icon { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 7px; background: var(--surface-2); }
.privacy-note { margin: 18px 12px 0; color: var(--ink-soft); font-size: 11px; }
.privacy-note span { color: var(--teal); font-size: 8px; }

.main-content { min-height: 100vh; margin-left: var(--sidebar-width); padding: 54px 54px 70px; }
.content-width { width: min(100%, 1100px); margin: 0 auto; }
.mobile-header, .mobile-day-strip { display: none; }

.day-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; margin-bottom: 38px; }
.day-header h1 { margin: 5px 0 7px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(36px, 5vw, 58px); line-height: 1.05; letter-spacing: -0.035em; }
.day-header p { max-width: 580px; margin: 0; color: var(--ink-soft); }
.day-score { display: grid; flex: 0 0 auto; min-width: 120px; padding: 17px 20px; border-left: 2px solid var(--teal); }
.day-score strong { font-family: Georgia, "Times New Roman", serif; font-size: 30px; line-height: 1; }
.day-score span { margin-top: 5px; color: var(--ink-soft); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }

.top-three { margin-bottom: 28px; }
.section-title-row, .task-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.section-title-row h2, .task-toolbar h2 { margin: 2px 0 0; font-family: Georgia, "Times New Roman", serif; font-size: 25px; }
.section-hint { color: var(--ink-soft); font-size: 12px; }
.focus-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 14px; }
.focus-card {
  position: relative;
  min-height: 172px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--surface);
  box-shadow: var(--shadow-small);
}
.focus-card { display: grid; grid-template-rows: 1fr auto auto; gap: 9px; align-content: space-between; }
.focus-card:hover { border-color: var(--sage); }
.focus-card-number { position: absolute; top: 14px; right: 16px; color: var(--line); font-family: Georgia, serif; font-size: 34px; font-weight: 700; }
.focus-card h3 { max-width: 85%; margin: 0 0 12px; font-size: 14px; line-height: 1.35; }
.focus-card-meta { color: var(--ink-soft); font-size: 11px; }
.focus-card.completed h3 { color: var(--ink-soft); text-decoration: line-through; }
.focus-card.focus-empty { border-style: dashed; background: transparent; box-shadow: none; }
.focus-task-preview { display: block; width: 100%; padding: 0; border: 0; background: transparent; color: var(--ink); text-align: left; cursor: pointer; }
.focus-task-preview:disabled { cursor: default; }
.focus-select { width: 100%; min-height: 36px; padding: 7px 30px 7px 9px; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); color: var(--ink); font-size: 11px; text-overflow: ellipsis; }
.focus-select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
.focus-create-button { justify-self: start; padding: 0; border: 0; background: transparent; color: var(--teal-dark); font-size: 10px; font-weight: 750; cursor: pointer; }
.focus-create-button:hover { color: var(--teal); }

.task-panel { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.task-toolbar { padding: 24px 26px 18px; }
.primary-button, .secondary-button {
  min-height: 43px;
  padding: 10px 17px;
  border-radius: 12px;
  font-weight: 750;
  cursor: pointer;
  transition: transform var(--transition), background var(--transition), border-color var(--transition);
}
.primary-button { border: 1px solid var(--teal-dark); background: var(--teal-dark); color: #fff; box-shadow: 0 7px 18px rgba(21, 94, 91, 0.18); }
.primary-button:hover { background: var(--teal); }
.primary-button:active, .secondary-button:active { transform: translateY(1px); }
.secondary-button { border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.secondary-button:hover { border-color: var(--sage); background: var(--surface-2); }

.filters { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; padding: 0 26px 18px; }
.search-field, .select-field { position: relative; display: flex; align-items: center; }
.search-field > span[aria-hidden] { position: absolute; left: 13px; color: var(--ink-soft); font-size: 20px; }
.filters input, .filters select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--paper);
  color: var(--ink);
  outline: none;
}
.filters input { padding: 9px 12px 9px 39px; }
.filters select { min-width: 138px; padding: 9px 32px 9px 12px; }
.filters input:focus, .filters select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }

.task-list { border-top: 1px solid var(--line); }
.task-card {
  position: relative;
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 13px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  transition: background var(--transition), opacity var(--transition), transform var(--transition);
}
.task-card:hover { background: color-mix(in srgb, var(--surface), var(--teal-soft) 22%); }
.task-card.dragging { opacity: 0.45; transform: scale(0.99); }
.task-card.overdue { box-shadow: inset 3px 0 var(--coral); }
.task-card.due-soon { box-shadow: inset 3px 0 var(--amber); }
.task-card.carried { background: color-mix(in srgb, var(--surface), var(--teal-soft) 12%); }
.task-card.completed { opacity: 0.62; }
.task-check {
  display: grid;
  width: 26px;
  height: 26px;
  margin-top: 1px;
  place-items: center;
  border: 1.5px solid var(--sage);
  border-radius: 8px;
  background: transparent;
  color: transparent;
  cursor: pointer;
}
.task-check:hover { border-color: var(--teal); background: var(--teal-soft); }
.completed .task-check { border-color: var(--teal); background: var(--teal); color: #fff; }
.task-body { min-width: 0; }
.task-title-row { display: flex; align-items: center; gap: 8px; }
.task-title-row h3 { margin: 0; overflow-wrap: anywhere; font-size: 15px; font-weight: 720; line-height: 1.35; }
.completed .task-title-row h3 { color: var(--ink-soft); text-decoration: line-through; text-decoration-thickness: 1.5px; }
.focus-badge { padding: 2px 7px; border-radius: 10px; background: var(--teal-soft); color: var(--teal-dark); font-size: 9px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.task-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 6px; color: var(--ink-soft); font-size: 11px; }
.task-meta span { display: inline-flex; align-items: center; gap: 4px; }
.task-meta .high { color: var(--coral); }
.task-meta .medium { color: var(--amber); }
.task-meta .overdue-label { color: var(--coral); font-weight: 750; }
.task-meta .due-soon-label { color: var(--amber); font-weight: 750; }
.task-meta .carryover-label { color: var(--teal-dark); font-weight: 750; }
.task-notes { margin: 8px 0 0; color: var(--ink-soft); font-size: 12px; }
.subtask-list { display: grid; gap: 4px; margin-top: 9px; }
.subtask-row { display: flex; align-items: center; gap: 7px; color: var(--ink-soft); font-size: 11px; }
.subtask-row input { accent-color: var(--teal); }
.subtask-row.done span { text-decoration: line-through; }
.task-actions { display: flex; align-items: flex-start; gap: 2px; }
.task-actions button, .icon-button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
}
.task-actions button:hover, .icon-button:hover { background: var(--surface-2); color: var(--ink); }
.task-actions button[data-action="up"], .task-actions button[data-action="down"] { opacity: 0; width: 27px; }
.task-card:hover .task-actions button[data-action="up"], .task-card:hover .task-actions button[data-action="down"], .task-actions button:focus { opacity: 1; }

.empty-state { padding: 54px 24px; border-top: 1px solid var(--line); text-align: center; }
.empty-check { display: grid; width: 58px; height: 58px; margin: 0 auto 15px; place-items: center; border-radius: 18px; background: var(--teal-soft); color: var(--teal-dark); font-size: 25px; }
.empty-state h3 { margin: 0 0 6px; font-family: Georgia, serif; font-size: 21px; }
.empty-state p { margin: 0 0 18px; color: var(--ink-soft); font-size: 13px; }
.task-footer { display: flex; justify-content: space-between; padding: 13px 24px; color: var(--ink-soft); font-size: 11px; }
.task-footer button { padding: 0; border: 0; background: transparent; color: var(--ink-soft); cursor: pointer; }
.task-footer button:hover { color: var(--coral); }

.week-tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 18px; }
.week-tools > button, .file-button {
  display: grid;
  padding: 17px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}
.week-tools > button:hover, .file-button:hover { border-color: var(--sage); background: var(--surface); }
.week-tools strong { font-size: 12px; }
.week-tools span { color: var(--ink-soft); font-size: 10px; }
.file-button input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.task-dialog, .alarm-dialog {
  width: min(680px, calc(100vw - 28px));
  max-height: min(860px, calc(100vh - 28px));
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 30px 100px rgba(12, 30, 31, 0.32);
}
.task-dialog::backdrop, .alarm-dialog::backdrop { background: rgba(10, 28, 30, 0.58); backdrop-filter: blur(4px); }
.task-dialog form { padding: 28px; }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.dialog-header h2 { margin: 3px 0 0; font-family: Georgia, serif; font-size: 27px; }
.close-button { flex: 0 0 auto; background: var(--surface-2); font-size: 22px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 17px; }
.field { display: grid; gap: 6px; }
.field > span { color: var(--ink-soft); font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: 0.07em; }
.field small { font-size: 9px; font-weight: 500; text-transform: none; letter-spacing: normal; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--paper);
  color: var(--ink);
  outline: none;
}
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
.full-field { grid-column: 1 / -1; }
.toggle-stack { display: grid; gap: 10px; }
.toggle-row { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.toggle-row input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-control { position: relative; flex: 0 0 auto; width: 39px; height: 23px; border-radius: 14px; background: var(--line); transition: background var(--transition); }
.toggle-control::after { content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,.15); transition: transform var(--transition); }
.toggle-row input:checked + .toggle-control { background: var(--teal); }
.toggle-row input:checked + .toggle-control::after { transform: translateX(16px); }
.toggle-row input:focus-visible + .toggle-control { outline: 3px solid var(--teal-soft); }
.toggle-row > span:last-child { display: grid; }
.toggle-row strong { font-size: 12px; }
.toggle-row small { color: var(--ink-soft); font-size: 10px; }
.dialog-actions { display: flex; align-items: center; gap: 10px; margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); }
.dialog-spacer { flex: 1; }
.text-button { border: 0; background: transparent; cursor: pointer; }
.danger-text { color: var(--coral); }

.alarm-dialog { width: min(430px, calc(100vw - 28px)); padding: 32px; text-align: center; }
.alarm-visual { display: grid; width: 72px; height: 72px; margin: 0 auto 18px; place-items: center; border-radius: 23px; background: var(--amber-soft); color: var(--amber); font-size: 34px; animation: alarm-pulse 1.5s ease-in-out infinite; }
.alarm-dialog h2 { margin: 4px 0 8px; font-family: Georgia, serif; font-size: 28px; }
.alarm-dialog p { margin: 0; color: var(--ink-soft); }
.alarm-actions { display: flex; justify-content: center; gap: 10px; margin-top: 24px; }
@keyframes alarm-pulse { 50% { transform: scale(1.04); box-shadow: 0 0 0 10px color-mix(in srgb, var(--amber-soft), transparent 55%); } }

.toast-region { position: fixed; z-index: 200; right: 20px; bottom: 20px; display: grid; width: min(360px, calc(100vw - 40px)); gap: 9px; }
.toast { display: flex; align-items: center; gap: 12px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 13px; background: var(--ink); color: var(--surface); box-shadow: var(--shadow); animation: toast-in 200ms ease-out; }
.toast span { flex: 1; font-size: 12px; }
.toast button { border: 0; background: transparent; color: inherit; font-size: 11px; font-weight: 800; cursor: pointer; text-transform: uppercase; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

:focus-visible { outline: 3px solid color-mix(in srgb, var(--teal), transparent 45%); outline-offset: 2px; }

.app-nav { display: grid; gap: 7px; margin: 28px 0 18px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.app-nav-button { display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 10px; width: 100%; padding: 11px 12px; border: 1px solid transparent; border-radius: 14px; background: transparent; color: var(--ink); cursor: pointer; text-align: left; }
.app-nav-button:hover { background: var(--surface-2); }
.app-nav-button.active { border-color: color-mix(in srgb, var(--teal), transparent 70%); background: var(--teal-soft); color: var(--teal-dark); }
.app-nav-button > span:nth-child(2) { display: grid; min-width: 0; }
.app-nav-button strong { font-size: 12px; }
.app-nav-button small { color: var(--ink-soft); font-size: 9px; }
.app-nav-button em { padding: 3px 7px; border-radius: 11px; background: var(--surface); color: var(--teal-dark); font-size: 9px; font-style: normal; font-weight: 800; }
.app-nav-icon { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 11px; background: var(--surface-2); font-weight: 900; }
.app-nav-button.active .app-nav-icon { background: var(--teal); color: #fff; }
.book-icon { font-size: 18px; }
.week-title-row { display: grid; grid-template-columns: 28px 1fr 28px; align-items: center; gap: 4px; margin: 4px 0 18px; }
.week-title-row h2 { margin: 0; text-align: center; font-size: 21px; }
.week-arrow { display: grid; width: 28px; height: 28px; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--ink-soft); cursor: pointer; font-size: 24px; line-height: 1; }
.week-arrow:hover { background: var(--surface-2); color: var(--ink); }
.week-arrow:disabled { opacity: .25; cursor: default; }
.reading-side-summary { margin: 28px 0; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, var(--surface), var(--teal-soft)); text-align: center; }
.reading-side-summary h2 { margin: 4px 0 15px; font-family: Georgia, serif; font-size: 22px; }
.side-reading-ring { position: relative; display: grid; width: 104px; height: 104px; margin: 0 auto 13px; place-items: center; border-radius: 50%; background: conic-gradient(var(--teal) calc(var(--progress) * 1%), var(--line) 0); }
.side-reading-ring::before { content: ""; position: absolute; width: 82px; height: 82px; border-radius: 50%; background: var(--surface); }
.side-reading-ring strong { position: relative; font-family: Georgia, serif; font-size: 22px; }
.reading-side-summary p { margin: 0; font-size: 12px; }
.reading-side-summary > small { color: var(--ink-soft); font-size: 9px; }
.view-panel[hidden], .reading-sidebar[hidden] { display: none !important; }

.reading-content { padding-bottom: 40px; }
.reading-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; margin-bottom: 28px; }
.reading-hero h1 { margin: 5px 0 8px; font-family: Georgia, serif; font-size: clamp(42px, 5vw, 64px); line-height: 1; letter-spacing: -.04em; }
.reading-hero p { max-width: 650px; margin: 0; color: var(--ink-soft); }
.challenge-dates { display: grid; justify-items: end; gap: 9px; color: var(--ink-soft); font-size: 11px; }
.quiet-chip { padding: 8px 11px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--ink); cursor: pointer; font-size: 10px; font-weight: 700; }
.quiet-chip:hover { border-color: var(--teal); }
.reading-dashboard { display: grid; grid-template-columns: 1.18fr .82fr; gap: 16px; margin-bottom: 16px; }
.reading-progress-card, .current-book-card, .reading-timer-card, .reading-insight-card, .reading-calendar-panel, .reading-log-panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-small); }
.reading-progress-card { display: grid; grid-template-columns: 150px 1fr; align-items: center; gap: 22px; min-height: 235px; padding: 27px; }
.reading-ring { position: relative; display: grid; width: 146px; height: 146px; place-items: center; border-radius: 50%; background: conic-gradient(var(--teal) calc(var(--progress) * 1%), var(--line) 0); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--teal), transparent 80%); }
.reading-ring::before { content: ""; position: absolute; width: 116px; height: 116px; border-radius: 50%; background: var(--surface); }
.reading-ring > div { position: relative; display: grid; text-align: center; }
.reading-ring strong { font-family: Georgia, serif; font-size: 34px; line-height: 1; }
.reading-ring span { margin-top: 4px; color: var(--ink-soft); font-size: 9px; letter-spacing: .12em; text-transform: uppercase; }
.reading-progress-copy h2 { margin: 5px 0 8px; font-family: Georgia, serif; font-size: 25px; }
.reading-progress-copy p { margin: 0; color: var(--ink-soft); font-size: 12px; }
.reading-mini-stats { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding-top: 16px; border-top: 1px solid var(--line); }
.reading-mini-stats div { display: grid; text-align: center; }
.reading-mini-stats strong { font-family: Georgia, serif; font-size: 20px; }
.reading-mini-stats span { color: var(--ink-soft); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.current-book-card { display: grid; grid-template-columns: 132px 1fr; gap: 20px; min-height: 235px; padding: 24px; overflow: hidden; background: linear-gradient(135deg, var(--surface), color-mix(in srgb, var(--amber-soft), var(--surface) 55%)); }
.book-cover { position: relative; display: grid; width: 132px; height: 178px; place-items: center; overflow: hidden; border: 0; border-radius: 8px 14px 14px 8px; background: linear-gradient(145deg, var(--ink), var(--teal-dark)); color: #fff; cursor: pointer; box-shadow: 10px 12px 26px rgba(23, 59, 63, .18); }
.book-cover::before { content: ""; position: absolute; inset: 0 auto 0 8px; width: 1px; background: rgba(255,255,255,.2); }
.book-cover img { width: 100%; height: 100%; object-fit: cover; }
.book-cover > span { font-family: Georgia, serif; font-size: 54px; }
.book-cover small { position: absolute; bottom: 12px; font-size: 8px; text-transform: uppercase; letter-spacing: .08em; }
.book-details { min-width: 0; }
.book-details label { display: block; }
.book-details input { width: 100%; border: 0; border-bottom: 1px solid transparent; background: transparent; color: var(--ink); outline: none; }
.book-details input:focus { border-bottom-color: var(--teal); }
#book-title-input { margin: 5px 0 1px; padding: 0; font-family: Georgia, serif; font-size: 22px; font-weight: 700; }
#book-author-input { padding: 3px 0; color: var(--ink-soft); font-size: 11px; }
.book-page-progress { display: flex; align-items: center; gap: 5px; margin-top: 23px; color: var(--ink-soft); font-size: 10px; }
.book-page-progress label { display: flex; align-items: center; gap: 4px; }
.book-page-progress input { width: 45px; padding: 3px; border: 1px solid var(--line); border-radius: 6px; text-align: center; }
.thin-progress { height: 7px; margin-top: 10px; overflow: hidden; border-radius: 6px; background: var(--line); }
.thin-progress span { display: block; height: 100%; border-radius: inherit; background: var(--teal); transition: width var(--transition); }
#book-page-progress-label { display: block; margin-top: 7px; color: var(--ink-soft); font-size: 9px; }
.reading-lower-grid { display: grid; grid-template-columns: 1.35fr .65fr; gap: 16px; margin-bottom: 16px; }
.reading-timer-card, .reading-insight-card { padding: 25px; }
.timer-topline { display: flex; align-items: start; justify-content: space-between; }
.timer-topline h2, .reading-insight-card h2, .reading-calendar-panel h2, .reading-log-panel h2 { margin: 3px 0 0; font-family: Georgia, serif; font-size: 23px; }
.timer-date { padding: 5px 9px; border-radius: 10px; background: var(--teal-soft); color: var(--teal-dark); font-size: 10px; font-weight: 700; }
.timer-display { margin: 17px 0 10px; font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 56px; font-weight: 800; letter-spacing: -.05em; }
.timer-track { height: 9px; overflow: hidden; border-radius: 8px; background: var(--line); }
.timer-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--teal), var(--sage)); transition: width 1s linear; }
.timer-actions { display: flex; align-items: center; gap: 9px; margin-top: 17px; }
.timer-actions .text-button { margin-left: auto; color: var(--teal-dark); font-size: 10px; font-weight: 700; }
.reading-timer-card > p { margin: 15px 0 0; color: var(--ink-soft); font-size: 9px; }
.reading-insight-card { background: linear-gradient(150deg, var(--ink), #285c5f); color: #fff; }
.reading-insight-card .eyebrow { color: #99d5cc; }
.reading-insight-card p { color: rgba(255,255,255,.72); font-size: 11px; }
.milestone-row { display: flex; gap: 7px; margin-top: 22px; }
.milestone { display: grid; width: 37px; height: 37px; place-items: center; border: 1px solid rgba(255,255,255,.25); border-radius: 11px; color: rgba(255,255,255,.45); font-size: 10px; font-weight: 800; }
.milestone.earned { border-color: #a7dfd4; background: rgba(167,223,212,.16); color: #fff; }
.reading-calendar-panel, .reading-log-panel { padding: 24px; margin-bottom: 16px; }
.reading-weekdays, .reading-calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 7px; }
.reading-weekdays { margin-top: 22px; color: var(--ink-soft); font-size: 9px; font-weight: 700; text-align: center; text-transform: uppercase; }
.reading-calendar { margin-top: 7px; }
.calendar-day { position: relative; min-height: 74px; padding: 8px; border: 1px solid var(--line); border-radius: 11px; background: var(--paper); cursor: pointer; text-align: left; }
.calendar-day:hover { border-color: var(--teal); }
.calendar-day.outside { visibility: hidden; }
.calendar-day.partial { border-color: color-mix(in srgb, var(--amber), transparent 50%); background: var(--amber-soft); }
.calendar-day.complete { border-color: color-mix(in srgb, var(--teal), transparent 45%); background: var(--teal-soft); }
.calendar-day strong { font-size: 11px; }
.calendar-day span { position: absolute; right: 8px; bottom: 7px; color: var(--ink-soft); font-size: 9px; }
.calendar-day.complete span { color: var(--teal-dark); font-weight: 800; }
.calendar-day.today::after { content: "Today"; position: absolute; top: 7px; right: 7px; color: var(--coral); font-size: 7px; font-weight: 800; text-transform: uppercase; }
.calendar-legend { display: flex; justify-content: flex-end; gap: 15px; margin-top: 12px; color: var(--ink-soft); font-size: 8px; }
.calendar-legend span { display: inline-flex; align-items: center; gap: 5px; }
.calendar-legend i { width: 11px; height: 11px; border: 1px solid var(--line); border-radius: 3px; background: var(--paper); }
.calendar-legend .legend-partial { background: var(--amber-soft); }
.calendar-legend .legend-complete { background: var(--teal-soft); }
.reading-log-list { display: grid; gap: 8px; margin-top: 18px; }
.reading-log-entry { display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: start; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); cursor: pointer; }
.reading-log-entry:hover { border-color: var(--sage); }
.reading-log-date { display: grid; text-align: center; }
.reading-log-date strong { font-family: Georgia, serif; font-size: 19px; }
.reading-log-date span { color: var(--ink-soft); font-size: 8px; text-transform: uppercase; }
.reading-log-copy strong { display: block; font-size: 12px; }
.reading-log-copy p { margin: 3px 0 0; color: var(--ink-soft); font-size: 10px; }
.reading-log-minutes { padding: 5px 8px; border-radius: 9px; background: var(--teal-soft); color: var(--teal-dark); font-size: 9px; font-weight: 800; }
.reading-empty { padding: 28px; border: 1px dashed var(--line); border-radius: 13px; color: var(--ink-soft); font-size: 11px; text-align: center; }

@media (max-width: 1100px) {
  .reading-dashboard, .reading-lower-grid { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  :root { --sidebar-width: 265px; }
  .sidebar { padding-inline: 20px; }
  .main-content { padding-inline: 32px; }
  .focus-grid { grid-template-columns: 1fr; }
  .focus-card { min-height: 154px; }
  .week-tools { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; padding: 0 0 calc(52px + env(safe-area-inset-bottom)); }
  .mobile-header {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
    padding: max(11px, env(safe-area-inset-top)) 17px 11px;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--paper), transparent 5%);
    backdrop-filter: blur(16px);
  }
  .mobile-header .brand-mark { width: 32px; height: 32px; border-radius: 10px; }
  .mobile-header .brand-name { font-size: 20px; }
  .mobile-menu { position: absolute; top: calc(100% - 4px); right: 14px; display: grid; min-width: 210px; padding: 7px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
  .mobile-menu[hidden] { display: none; }
  .mobile-menu button { padding: 11px 12px; border: 0; border-radius: 9px; background: transparent; color: var(--ink); text-align: left; }
  .mobile-menu button:hover { background: var(--surface-2); }
  .mobile-day-strip {
    display: flex;
    gap: 7px;
    padding: 12px 16px;
    overflow-x: auto;
    border-bottom: 1px solid var(--line);
    scrollbar-width: none;
  }
  .mobile-day-strip::-webkit-scrollbar { display: none; }
  .mobile-day-button { display: grid; flex: 1 0 47px; min-width: 47px; padding: 7px 5px; border: 1px solid transparent; border-radius: 12px; background: transparent; color: var(--ink-soft); text-align: center; }
  .mobile-day-button span { font-size: 9px; font-weight: 800; text-transform: uppercase; }
  .mobile-day-button strong { font-size: 15px; }
  .mobile-day-button[aria-current="date"] { border-color: var(--teal); background: var(--teal-soft); color: var(--teal-dark); }
  .content-width { padding: 26px 16px 0; }
  .day-header { align-items: flex-start; margin-bottom: 27px; }
  .day-header h1 { margin-top: 3px; font-size: 37px; }
  .day-header p { font-size: 13px; }
  .day-score { min-width: auto; padding: 8px 0 8px 13px; }
  .day-score strong { font-size: 22px; }
  .day-score span { display: none; }
  .section-hint { display: none; }
  .section-title-row h2, .task-toolbar h2 { font-size: 22px; }
  .focus-grid { display: flex; gap: 10px; padding-bottom: 7px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .focus-grid::-webkit-scrollbar { display: none; }
  .focus-card { flex: 0 0 min(82vw, 320px); min-height: 150px; padding: 13px; scroll-snap-align: start; }
  .focus-card-number { top: 9px; right: 11px; font-size: 25px; }
  .focus-card h3 { max-width: 100%; padding-top: 15px; font-size: 12px; }
  .focus-card-meta { font-size: 9px; }
  .focus-select { font-size: 12px; }
  .task-panel { border-radius: 18px; }
  .task-toolbar { align-items: center; padding: 19px 17px 14px; }
  .primary-button { min-height: 41px; padding-inline: 13px; }
  .filters { grid-template-columns: 1fr 46px 46px; padding: 0 17px 14px; }
  .filters select { min-width: 0; width: 46px; padding: 0; color: transparent; background-image: radial-gradient(circle at center, var(--ink-soft) 2px, transparent 3px); background-size: 8px 8px; background-repeat: repeat-x; background-position: center; }
  .filters select { background-image: none; }
  .select-field::after { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-soft); pointer-events: none; font-size: 17px; }
  .filters .select-field:nth-child(2)::after { content: "☷"; }
  .filters .select-field:nth-child(3)::after { content: "◇"; }
  .task-card { grid-template-columns: 31px 1fr auto; gap: 9px; padding: 16px 13px; }
  .task-actions { display: grid; }
  .task-actions button[data-action="up"], .task-actions button[data-action="down"] { display: none; }
  .task-title-row { align-items: flex-start; }
  .task-title-row h3 { font-size: 14px; }
  .focus-badge { margin-top: 1px; }
  .task-notes { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .task-footer { padding-inline: 16px; }
  .week-tools { margin-bottom: 20px; }
  .task-dialog { width: 100vw; max-width: none; max-height: 94vh; margin: auto 0 0; border-radius: 24px 24px 0 0; }
  .task-dialog form { padding: 22px 17px max(18px, env(safe-area-inset-bottom)); }
  .form-grid { grid-template-columns: 1fr; gap: 14px; }
  .full-field { grid-column: auto; }
  .dialog-actions { position: sticky; bottom: 0; margin-inline: -17px; padding: 14px 17px max(14px, env(safe-area-inset-bottom)); background: var(--surface); }
  .dialog-actions .secondary-button { display: none; }
  .alarm-dialog { padding: 27px 20px; }
  .alarm-actions { flex-direction: column-reverse; }
  .alarm-actions button { width: 100%; }
}

@media (max-width: 420px) {
  .date-jump-panel { grid-template-columns: 1fr; }
  .day-header { gap: 12px; }
  .day-header h1 { font-size: 32px; }
  .task-toolbar .primary-button { font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

@media print {
  :root { --paper: #fff; --surface: #fff; --ink: #142f32; --ink-soft: #536466; --line: #ccd2cf; }
  body { background: #fff; font-size: 11pt; }
  @page { size: letter; margin: 0.45in; }
  .app-shell, .task-dialog, .alarm-dialog, .toast-region { display: none !important; }
  .print-week { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .print-week-header { grid-column: 1 / -1; display: flex; align-items: end; justify-content: space-between; padding-bottom: 12px; border-bottom: 2px solid var(--ink); }
  .print-week-header h1 { margin: 2px 0 0; font-family: Georgia, serif; font-size: 26pt; }
  .print-summary { font-size: 10pt; font-weight: 700; }
  .print-day { break-inside: avoid; min-height: 1.55in; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
  .print-day:last-child { grid-column: 1 / -1; }
  .print-day-title { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; padding-bottom: 5px; border-bottom: 1px solid var(--line); }
  .print-day-title h2 { margin: 0; font-family: Georgia, serif; font-size: 14pt; }
  .print-day-title span { color: var(--ink-soft); font-size: 8pt; }
  .print-task { display: grid; grid-template-columns: 16px 1fr; gap: 7px; align-items: start; padding: 5px 0; }
  .print-check { display: grid; width: 14px; height: 14px; place-items: center; border: 1px solid var(--ink-soft); border-radius: 3px; font-size: 8pt; }
  .print-task div { display: grid; }
  .print-task strong { font-size: 8.5pt; line-height: 1.25; }
  .print-task small { color: var(--ink-soft); font-size: 6.5pt; text-transform: capitalize; }
  .print-task.completed strong { color: var(--ink-soft); text-decoration: line-through; }
  .print-task.completed .print-check { background: var(--teal); color: #fff; print-color-adjust: exact; }
  .print-empty-line { display: grid; grid-template-columns: 14px 1fr; gap: 8px; padding: 7px 0; }
  .print-empty-line span { width: 14px; height: 14px; border: 1px solid var(--ink-soft); border-radius: 3px; }
  .print-empty-line i { border-bottom: 1px solid var(--line); }
}
