:root {
  --bg: #f8f7f2;
  --bg-soft: linear-gradient(180deg, #f9fcff 0%, #fff7f6 35%, #f6fbf6 100%);
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: rgba(255, 255, 255, 0.96);
  --line: #d7e2e0;
  --line-strong: #bfd3d0;
  --text: #2f3d40;
  --muted: #6c7d82;
  --primary: #5aa6a6;
  --primary-dark: #3d8385;
  --secondary: #ffe6d9;
  --secondary-dark: #ffd3c0;
  --accent: #f6a6b2;
  --accent-soft: #fff0f3;
  --danger: #d46b72;
  --shadow: 0 18px 40px rgba(116, 145, 148, 0.12);
  --radius: 20px;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  font-family: "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  background: var(--bg-soft);
  color: var(--text);
  overflow-x: hidden;
}
body { min-height: 100vh; }

body.auth-locked .app-shell { display: none; }
.auth-gate {
  min-height: 100vh;
  padding: 24px 18px 28px;
  background-image:
    linear-gradient(90deg, rgba(255, 252, 246, 0.82) 0%, rgba(255, 252, 246, 0.56) 42%, rgba(255, 252, 246, 0.12) 100%),
    linear-gradient(180deg, rgba(252, 247, 237, 0.36) 0%, rgba(249, 242, 229, 0.18) 48%, rgba(247, 239, 224, 0.08) 100%),
    url("./assets/ui/auth-bg-portrait.jpg");
  background-position: center, center, 58% center;
  background-size: cover, cover, cover;
  background-repeat: no-repeat;
}
.auth-gate.hidden { display: none; }
.auth-gate-shell {
  width: min(100%, 540px);
  margin: 0 auto;
  position: relative;
}
.auth-gate-body {
  padding: 138px 8px 0;
}
.auth-gate-welcome {
  display: grid;
  gap: 0;
}
.auth-gate-copy-wrap {
  text-align: left;
  color: #365e5d;
}
.auth-gate-title {
  margin: 0;
  font-size: clamp(35px, 11vw, 54px);
  line-height: 1.12;
  color: #2e6967;
  letter-spacing: 0.02em;
}
.auth-gate-subtitle {
  margin: 18px 0 0;
  font-size: clamp(17px, 5vw, 22px);
  line-height: 1.6;
  color: #41696a;
}
.auth-gate-divider {
  margin: 24px 0 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  color: rgba(114, 130, 113, 0.45);
}
.auth-gate-divider span {
  height: 1px;
  flex: 1;
  background: currentColor;
}
.auth-divider-icon {
  width: 26px;
  height: 26px;
  background: center / contain no-repeat url("./assets/ui/leaf-sand.png");
  opacity: 0.8;
}
.auth-gate-copy {
  display: grid;
  gap: 16px;
  max-width: 292px;
  font-size: clamp(16px, 4.4vw, 20px);
  line-height: 1.82;
  color: #576463;
}
.auth-gate-copy p {
  margin: 0;
}
.auth-gate-actions {
  display: grid;
  gap: 18px;
  margin-top: 78px;
}
.auth-cta {
  width: min(86%, 360px);
  min-height: 64px;
  border-radius: 22px;
  padding: 16px 22px;
  font-size: clamp(18px, 5vw, 24px);
  font-weight: 800;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-inline: auto;
}
.auth-cta-primary {
  background: linear-gradient(180deg, #4b7975 0%, #386866 100%);
  color: #fff;
  box-shadow: 0 14px 24px rgba(60, 101, 98, 0.16);
  border: none;
}
.auth-cta-secondary {
  border: 1px solid rgba(177, 168, 143, 0.55);
  background: rgba(255, 250, 243, 0.72);
  color: #2f4748;
}
.auth-settings-card {
  margin-top: 18px;
  text-align: left;
}
.auth-input-modal {
  z-index: 1400;
}
.auth-input-modal-card {
  width: min(92vw, 520px);
  max-width: calc(100vw - 24px);
  text-align: left;
}
.auth-modal-header {
  margin-bottom: 8px;
}
.auth-modal-actions {
  margin-top: 2px;
}
.auth-modal-secondary-actions {
  margin-top: -2px;
}
.auth-settings-sheet {
  margin-top: 18px;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
textarea { resize: vertical; }
a { color: inherit; }
.app-shell { display: grid; grid-template-columns: 320px 1fr; min-height: 100vh; }
.sidebar {
  padding: 24px;
  border-right: 1px solid rgba(191, 211, 208, 0.55);
  background: linear-gradient(180deg, rgba(255,247,245,0.92) 0%, rgba(240,249,247,0.92) 100%);
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  backdrop-filter: blur(10px);
}
.main { padding: 28px; }
h1 { margin: 0 0 8px; font-size: 28px; color: #2b5055; }
h2 { margin: 0; font-size: 20px; color: #31545a; }
h3 { color: #35585d; }
.panel {
  background: var(--surface);
  border: 1px solid rgba(191, 211, 208, 0.7);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}
.panel.compact { padding: 14px; }
.panel-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.muted { color: var(--muted); }
.caption { color: var(--muted); font-size: 13px; line-height: 1.55; }
.badge {
  display: inline-flex; align-items: center; padding: 6px 10px; border-radius: 999px;
  background: #eef8f7; color: #3c7f82; font-size: 12px; border: 1px solid #cce4e3;
}
.nav-links { display: grid; gap: 8px; }
.nav-link {
  width: 100%; text-align: left; padding: 12px 14px; border: 1px solid rgba(191, 211, 208, 0.8);
  background: rgba(255,255,255,0.8); border-radius: 14px; color: #325157; transition: .2s ease;
}
.nav-link:hover { transform: translateY(-1px); box-shadow: 0 8px 16px rgba(116,145,148,0.08); }
.nav-link.active { background: linear-gradient(135deg, #79c5c0, #5aa6a6); color: #fff; border-color: transparent; }
.topbar { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 20px; }
.grid { display: grid; gap: 18px; }
.grid.two-col { grid-template-columns: 1fr 1fr; }
.grid.layout-books { grid-template-columns: minmax(280px, 0.86fr) minmax(560px, 1.54fr); gap: 22px; }
.align-start { align-items: start; }
.row { display: flex; align-items: center; }
.wrap { flex-wrap: wrap; }
.gap-sm { gap: 10px; }
.mt-md { margin-top: 14px; }
.mt-lg { margin-top: 20px; }
label { display: grid; gap: 6px; font-size: 14px; }
input, textarea, select {
  width: 100%; padding: 11px 12px; border: 1px solid rgba(191, 211, 208, 0.9); border-radius: 14px;
  background: rgba(255,255,255,0.96); color: var(--text);
  font-size: 16px;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: #89c4c3; box-shadow: 0 0 0 4px rgba(121,197,192,0.16);
}
.search { max-width: 220px; }
.primary-btn, .secondary-btn, .ghost-btn, .danger-btn, .support-btn {
  border: none; border-radius: 14px; padding: 10px 16px; font-weight: 700; transition: .2s ease;
}
.primary-btn { background: linear-gradient(135deg, var(--primary), #7cc6c2); color: #fff; }
.primary-btn:hover { background: linear-gradient(135deg, var(--primary-dark), var(--primary)); }
.secondary-btn { background: linear-gradient(135deg, #ffd8cc, #ffece4); color: #734b3c; }
.secondary-btn:hover { background: linear-gradient(135deg, #ffcbb8, #ffe5da); }
.ghost-btn { background: rgba(255,255,255,0.72); border: 1px solid rgba(191,211,208,0.9); color: #35585d; }
.ghost-btn:hover { background: rgba(255,255,255,0.95); }
.primary-btn:disabled,
.secondary-btn:disabled,
.ghost-btn:disabled,
.danger-btn:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  box-shadow: none;
}
.danger-btn { background: linear-gradient(135deg, #d9787f, var(--danger)); color: #fff; }
.support-btn {
  background: linear-gradient(135deg, var(--accent), #f7b8c6);
  color: #fff;
  box-shadow: 0 10px 24px rgba(246, 166, 178, 0.28);
}
.support-btn:hover { transform: translateY(-1px); background: linear-gradient(135deg, #ec90a0, #f6a6b2); }
.small { padding: 6px 10px; font-size: 13px; }
.subtle-action { color: var(--muted); font-weight: 600; }
.form-stack { display: grid; gap: 12px; }
.list-stack { display: grid; gap: 12px; }
.card { border: 1px solid rgba(191,211,208,0.78); border-radius: 16px; padding: 14px; background: rgba(255,255,255,0.9); }
.card h3 { margin: 0 0 8px; font-size: 17px; }
.card-meta { color: var(--muted); font-size: 13px; display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.card-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.note-writing-workspace .grid.two-col {
  grid-template-columns: minmax(0, min(1132px, 100%));
  justify-content: center;
  width: 100%;
  max-width: 100%;
  margin-inline: auto;
}
.note-writing-form-panel {
  width: min(1132px, 100%);
  max-width: 100%;
  margin-inline: auto;
}
.note-writing-list-panel {
  display: none !important;
}
.book-draft-workspace .grid.layout-books { align-items: start; }
.book-draft-form-panel .panel-header { margin-bottom: 8px; }
.book-draft-form { display: grid; gap: 10px; }
.book-draft-form textarea { min-height: 120px; }
.book-draft-submit-btn {
  min-height: 44px;
  padding-inline: 18px;
  background: linear-gradient(135deg, #4ca4a7, #5cb6b8);
  box-shadow: none;
}
.book-draft-form-panel .ghost-btn {
  min-height: 42px;
  padding-inline: 16px;
}
.book-draft-list-panel { min-width: 0; }
.book-draft-modal-open { overflow: hidden; }
.book-draft-modal-backdrop {
  position: fixed;
  inset: 0;
  border: none;
  background: rgba(37, 53, 56, 0.42);
  backdrop-filter: blur(6px);
  z-index: 1280;
  cursor: pointer;
}
.book-draft-modal-shell.is-open {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: min(1040px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  padding: 20px 20px 18px;
  z-index: 1290;
  box-shadow: 0 24px 64px rgba(58, 84, 87, 0.22);
  display: grid !important;
  gap: 14px;
  overflow: hidden;
}
.book-draft-modal-shell.is-open .panel-header {
  position: sticky;
  top: 0;
  z-index: 2;
  margin-bottom: 14px;
  padding-bottom: 12px;
  background: rgba(255,255,255,0.96);
  border-bottom: 1px solid rgba(191,211,208,0.7);
}
.book-draft-overview-body {
  min-height: 0;
  max-height: calc(100vh - 156px);
  overflow: auto;
  display: grid;
  gap: 14px;
  padding-right: 4px;
}
.book-draft-modal-shell.is-open .book-draft-overview-body {
  grid-template-columns: minmax(280px, 0.9fr) minmax(420px, 1.4fr);
  align-items: start;
}
.book-draft-modal-left,
.book-draft-modal-right {
  min-width: 0;
}
.book-draft-modal-left {
  display: grid;
  align-content: start;
  gap: 14px;
}
.book-draft-modal-left-actions {
  margin-top: 2px;
  justify-content: flex-start;
}
.book-draft-modal-left-actions .secondary-btn,
.book-draft-modal-left-actions .ghost-btn {
  min-height: 42px;
}
.book-draft-modal-right {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 14px;
  min-height: 0;
}
.book-draft-modal-right-body {
  min-height: 0;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 12px;
  padding-right: 4px;
}
.book-draft-modal-right-footer {
  display: grid;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid rgba(191,211,208,0.7);
  background: rgba(255,255,255,0.96);
}
.book-draft-modal-right-footer .secondary-btn,
.book-draft-modal-right-footer .ghost-btn {
  justify-self: start;
  min-height: 42px;
}
.book-draft-list { display: grid; gap: 14px; }
.book-draft-card {
  display: grid;
  gap: 10px;
  padding: 16px 18px;
  border-radius: 20px;
}
.book-draft-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.book-draft-card-header h3 {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
}
.book-draft-status-badge {
  flex-shrink: 0;
  align-self: flex-start;
}
.book-draft-status-badge.is-warning {
  background: #fff3dd;
  border-color: #f0d39d;
  color: #8b6420;
}
.book-draft-status-badge.is-ready {
  background: #eef8f7;
  border-color: #cce4e3;
  color: #3c7f82;
}
.book-draft-status-badge.is-muted {
  background: #f3f6f6;
  border-color: #d9e3e2;
  color: #6f8486;
}
.book-draft-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 0;
}
.book-draft-scope,
.book-draft-description {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.book-draft-scope {
  color: #31545a;
  line-height: 1.65;
  -webkit-line-clamp: 2;
}
.book-draft-description {
  margin: 0;
  -webkit-line-clamp: 2;
}
.book-draft-description.is-empty-hint {
  color: #7f5a1b;
}
.book-draft-actions { margin-top: 0; gap: 8px; }
.book-draft-actions .secondary-btn,
.book-draft-actions .ghost-btn {
  min-height: 40px;
  padding-inline: 14px;
}
.book-draft-delete-btn {
  color: #8b4f56;
  border-color: rgba(217, 120, 127, 0.36);
  background: rgba(255, 249, 249, 0.88);
}
.book-draft-delete-btn:hover {
  background: rgba(255, 241, 242, 0.98);
}
.empty-state { color: var(--muted); border: 1px dashed rgba(191,211,208,0.9); border-radius: 16px; padding: 24px; text-align: center; background: rgba(255,255,255,0.45); }
.summary-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.summary-card { border: 1px solid rgba(191,211,208,0.8); border-radius: 16px; padding: 14px 16px; background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(246,251,251,0.85)); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.summary-card span { color: var(--muted); }
.summary-card strong { font-size: 22px; color: #2b6266; }
.steps { margin: 0; padding-left: 18px; line-height: 1.9; }
.status-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.status-list li { display: flex; justify-content: space-between; gap: 10px; }
.sync-panel {
  margin: 12px 0 14px;
  padding: 12px;
  border: 1px solid rgba(191,211,208,0.82);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(248,252,252,0.96), rgba(255,255,255,0.9));
  display: grid;
  gap: 8px;
}
.sync-meta-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  font-size: 14px;
}
.sync-meta-row strong { color: #2f676b; }
.sync-panel .caption { margin: 2px 0 4px; }
.view { display: none; }
.view.active { display: block; }
.hidden { display: none !important; }
.checkbox-row { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 10px; }
.checkbox-row input { width: auto; margin-top: 2px; }
.book-export-options {
  display: grid;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid rgba(191, 211, 208, 0.72);
  border-radius: 16px;
  background: rgba(248, 252, 252, 0.86);
}
.book-export-options h3 {
  margin: 0;
  color: #35585d;
  font-size: 15px;
}
.book-export-option {
  display: grid;
  gap: 8px;
}
.book-export-option-caption {
  margin: -2px 0 0 32px;
}
.book-save-feedback {
  margin: 4px 0 0;
  color: #35585d;
}
.cover-preview {
  min-height: 220px; border-radius: 20px; border: 1px solid rgba(191,211,208,0.85);
  background: linear-gradient(160deg, #f7fdff 0%, #fff4f7 45%, #f2fbf5 100%);
  display: flex; align-items: end; padding: 18px; position: relative; overflow: hidden;
}
.cover-preview img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover-overlay { position: relative; z-index: 1; background: rgba(57, 92, 96, 0.44); color: #fff; padding: 14px; border-radius: 14px; width: 100%; backdrop-filter: blur(3px); }
.book-draft-overview-panel .cover-preview.book-draft-summary {
  min-height: 0;
  padding: 12px;
}
.book-draft-summary .cover-overlay {
  padding: 16px;
  background: rgba(57, 92, 96, 0.34);
}
.book-draft-summary .cover-overlay h2 {
  margin: 2px 0 8px;
  font-size: 22px;
  line-height: 1.2;
}
.book-draft-summary .cover-overlay .caption { line-height: 1.55; }
.chapter-picker { display: grid; gap: 10px; }
.chapter-picker .secondary-btn { justify-self: start; }
.selected-note-preview {
  border: 1px solid rgba(191,211,208,0.78);
  border-radius: 16px;
  padding: 12px 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(246,251,251,0.88));
}
.selected-note-preview h4 {
  margin: 0 0 8px;
  color: #31545a;
  font-size: 15px;
}
.selected-note-preview p {
  margin: 0;
  color: #31484d;
  line-height: 1.65;
}
.empty-note-preview { color: var(--muted); border-style: dashed; background: rgba(255,255,255,0.45); }
.toc-preview {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(191,211,208,0.78);
  border-radius: 16px;
  background: rgba(255,255,255,0.58);
}
.book-draft-preview-panel {
  gap: 8px;
  padding: 12px 14px;
}
.toc-preview h3,
.chapter-list-heading h3 {
  margin: 0;
  font-size: 16px;
  color: #31545a;
}
.toc-preview-list ol {
  margin: 0;
  padding-left: 22px;
  display: grid;
  gap: 8px;
}
.book-draft-preview-panel .toc-preview-list ol { gap: 6px; }
.toc-preview-list li {
  line-height: 1.55;
  color: #31484d;
}
.toc-preview-list li span {
  color: var(--muted);
  margin-right: 8px;
}
.chapter-item { display: grid; gap: 8px; border: 1px solid rgba(191,211,208,0.85); border-radius: 14px; padding: 10px 12px; background: rgba(255,255,255,0.84); }
.book-draft-chapter-heading { margin-top: 14px; }
.book-draft-chapters-list {
  max-height: 280px;
  overflow: auto;
  padding-right: 2px;
}
.book-draft-modal-right-body .book-draft-chapter-heading {
  margin-top: 0;
}
.book-draft-modal-shell.is-open .book-draft-chapters-list {
  max-height: none;
  overflow: visible;
  padding-right: 0;
}
.book-draft-overview-panel .chapter-item {
  gap: 6px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.74);
}
.chapter-row,
.chapter-meta-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.chapter-row input { padding: 8px 10px; border-radius: 10px; font-weight: 700; }
.book-draft-overview-panel .chapter-row input {
  padding: 7px 9px;
  font-size: 15px;
}
.chapter-controls { display: flex; gap: 6px; flex-wrap: nowrap; justify-content: flex-end; }
.chapter-controls .small { min-height: 34px; padding: 6px 9px; }
.book-draft-overview-panel .chapter-controls .small,
.book-draft-overview-panel .danger-btn.small {
  min-height: 32px;
  padding: 5px 8px;
}
.chapter-meta-row .caption { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.book-draft-overview-panel #book-arrangement-status { margin-top: 8px; }
.book-draft-modal-shell.is-open .row.gap-sm.wrap.mt-lg {
  margin-top: 4px;
  justify-content: flex-start;
}
.book-draft-modal-shell.is-open #go-content-library-btn,
.book-draft-modal-shell.is-open #save-book-arrangement-btn {
  min-height: 42px;
}
.book-draft-empty-guide {
  display: grid;
  justify-items: center;
  gap: 10px;
  text-align: center;
  padding: 8px 0;
}
.book-draft-empty-guide h4 {
  margin: 0;
  color: #23454b;
}
.book-draft-empty-guide p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
  max-width: 34ch;
}
.book-draft-empty-guide .secondary-btn {
  min-height: 42px;
}
.toast { position: fixed; right: 24px; bottom: 24px; background: rgba(47,61,64,0.95); color: #fff; padding: 12px 16px; border-radius: 14px; box-shadow: var(--shadow); max-width: 320px; z-index: 9999; isolation: isolate; transform: translateZ(0); }
.site-footer {
  margin-top: 28px;
  padding: 18px 0 26px;
  text-align: center;
  color: var(--muted);
}
.site-footer .support-btn { margin-bottom: 10px; }
.footer-support-text {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.7;
}
.footer-copyright {
  margin: 14px 0 0;
  font-size: 12px;
  color: #7f8f93;
}
.modal {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 1200;
}
.modal-backdrop {
  position: absolute; inset: 0; background: rgba(42, 60, 63, 0.35); backdrop-filter: blur(3px);
}
.modal-card {
  position: relative; width: min(92vw, 480px); background: rgba(255,255,255,0.97); border: 1px solid rgba(191,211,208,0.9);
  border-radius: 22px; padding: 22px; box-shadow: 0 24px 60px rgba(78,110,112,0.24);
}
.book-export-settings-open { overflow: hidden; }
.book-export-settings-modal {
  z-index: 1320;
  padding: 24px;
  overscroll-behavior: contain;
}
.book-export-settings-card {
  width: min(920px, calc(100vw - 48px));
  max-width: min(920px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
}
.book-export-settings-header {
  margin-bottom: 0;
  align-items: start;
  flex-shrink: 0;
}
.book-export-settings-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
}
.book-export-settings-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  padding-bottom: 4px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.book-export-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
}
.book-export-settings-grid textarea {
  min-height: 120px;
}
.book-export-settings-span-2 {
  grid-column: 1 / -1;
}
.book-export-settings-cover-block {
  display: grid;
  gap: 12px;
}
.book-export-settings-cover-preview {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 132px;
  padding: 12px;
  border: 1px solid rgba(191,211,208,0.82);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(244,249,248,0.86));
}
.book-export-settings-cover-preview.is-empty {
  grid-template-columns: minmax(0, 1fr);
}
.book-export-settings-cover-preview img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid rgba(191,211,208,0.82);
}
.book-export-settings-cover-copy {
  display: grid;
  gap: 6px;
  color: #35585d;
}
.book-export-settings-cover-copy strong {
  color: #26474c;
}
.book-export-settings-cover-copy span {
  color: var(--muted);
  line-height: 1.6;
  font-size: 13px;
}
.book-export-settings-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(191,211,208,0.7);
  background: rgba(255,255,255,0.96);
  flex-shrink: 0;
  padding-bottom: max(0px, env(safe-area-inset-bottom));
}
.book-export-settings-actions-primary {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.modal-intro { margin: 0 0 14px; line-height: 1.75; color: #496468; }
body.account-settings-open {
  overflow: hidden;
}
#account-settings-modal {
  padding: 20px;
  overflow: hidden;
  overscroll-behavior: contain;
}
.support-info {
  display: grid; gap: 10px; padding: 16px; border-radius: 18px; background: linear-gradient(180deg, #fff7fa, #f5fcfb);
  border: 1px solid rgba(191,211,208,0.75);
}
.support-info p { margin: 0; }
@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: none; border-bottom: 1px solid rgba(191,211,208,0.55); }
  .grid.two-col, .grid.layout-books { grid-template-columns: 1fr; }
  .book-draft-modal-shell.is-open {
    width: min(980px, calc(100vw - 40px));
  }
}
@media (max-width: 720px) {
  .main { padding: 18px; }
  .topbar { flex-direction: column; align-items: flex-start; }
  .summary-cards { grid-template-columns: 1fr; }
  .book-draft-modal-shell.is-open {
    top: 12px;
    left: 12px;
    transform: none;
    width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
    padding: 18px 16px 16px;
  }
  .book-draft-overview-body {
    max-height: calc(100vh - 136px);
  }
  .book-draft-modal-shell.is-open .book-draft-overview-body {
    grid-template-columns: 1fr;
  }
  .book-draft-modal-right {
    grid-template-rows: minmax(0, 1fr) auto;
  }
  .book-draft-modal-right-body,
  .book-draft-modal-left {
    overflow: visible;
  }
  .book-draft-modal-right-footer .secondary-btn,
  .book-draft-modal-left-actions .secondary-btn,
  .book-draft-modal-left-actions .ghost-btn {
    width: 100%;
  }
  .book-draft-card-header { align-items: flex-start; }
  .book-draft-card-header h3 { font-size: 22px; }
  .book-draft-chapters-list { max-height: none; }
  .chapter-picker .secondary-btn { width: 100%; }
  .chapter-controls .small { min-height: 38px; }
  .site-footer { padding-bottom: 34px; }
  .auth-gate {
    padding-inline: 16px;
    padding-top: 22px;
    padding-bottom: 22px;
    background-position: center, center, 60% center;
  }
  .auth-gate-shell {
    width: min(100%, 430px);
  }
  .auth-gate-body {
    padding-top: 120px;
  }
  .auth-gate-title {
    font-size: clamp(33px, 11.4vw, 47px);
  }
  .auth-gate-subtitle {
    font-size: clamp(16px, 4.9vw, 20px);
  }
  .auth-gate-divider {
    margin: 22px 0 20px;
  }
  .auth-gate-copy {
    max-width: 320px;
    font-size: 15px;
    line-height: 1.84;
  }
  .auth-gate-actions {
    gap: 14px;
    margin-top: 72px;
  }
  .auth-cta {
    width: min(86%, 336px);
    min-height: 60px;
    padding: 16px 20px;
    font-size: 17px;
  }
}

@media (orientation: landscape) {
  .auth-gate {
    background-image:
      linear-gradient(90deg, rgba(255, 252, 246, 0.84) 0%, rgba(255, 252, 246, 0.52) 42%, rgba(255, 252, 246, 0.08) 100%),
      linear-gradient(180deg, rgba(252, 247, 237, 0.28) 0%, rgba(249, 242, 229, 0.14) 48%, rgba(247, 239, 224, 0.06) 100%),
      url("./assets/ui/auth-bg-landscape.jpg");
    background-position: center, center, center center;
  }
}

@media (orientation: landscape) and (min-width: 768px) {
  .auth-gate-copy {
    max-width: none;
    white-space: nowrap;
  }
}

@media (min-width: 1024px) {
  .auth-gate {
    background-image:
      linear-gradient(90deg, rgba(255, 252, 246, 0.84) 0%, rgba(255, 252, 246, 0.5) 40%, rgba(255, 252, 246, 0.06) 100%),
      linear-gradient(180deg, rgba(252, 247, 237, 0.24) 0%, rgba(249, 242, 229, 0.12) 48%, rgba(247, 239, 224, 0.05) 100%),
      url("./assets/ui/auth-bg-landscape.jpg");
    background-position: center, center, center center;
  }

  .auth-gate-copy {
    max-width: none;
    white-space: nowrap;
  }
}

.footer-copyright a {
  color: #4a8b90;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.footer-copyright a:hover {
  color: #2f6f74;
}

.scripture-hint { margin-top: -4px; }
.scripture-tools { margin-top: -2px; }
.checkbox-inline { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.checkbox-inline input { width: auto; }
.scripture-preview {
  display: grid; gap: 10px; padding: 12px; border: 1px solid rgba(191,211,208,0.82);
  border-radius: 16px; background: rgba(255,255,255,0.72);
}
.note-summary-hint {
  margin: -4px 0 2px;
}
.markdown-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 2px 0 4px;
}
.markdown-toolbar-btn {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 7px 12px;
  white-space: nowrap;
}
.markdown-syntax-hint {
  margin: 2px 0 4px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(246, 240, 230, 0.78);
  border: 1px solid rgba(191, 176, 148, 0.44);
  color: #5f4d3f;
  overflow-wrap: anywhere;
}
.note-preview-modal-card {
  width: min(860px, calc(100vw - 160px));
  max-width: calc(100vw - 160px);
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  overflow-x: hidden;
  text-align: left;
  padding: 30px 34px;
}
.note-preview-modal-header {
  margin-bottom: 22px;
  align-items: start;
}
.note-preview-modal-header h2 {
  margin: 0;
  color: #27494d;
  font-size: 28px;
}
.note-preview-modal-header .modal-intro {
  margin: 8px 0 0;
  font-size: 15px;
  line-height: 1.8;
}
.note-preview-article {
  display: grid;
  gap: 22px;
  color: #2c4549;
}
.note-preview-header h4 {
  margin: 0;
  color: #21484c;
  font-size: 38px;
  line-height: 1.22;
}
.note-preview-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
}
.note-preview-meta span {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(236, 245, 244, 0.92);
  border: 1px solid rgba(191,211,208,0.75);
}
.note-preview-summary {
  display: grid;
  gap: 10px;
  padding: 18px 20px;
  border-radius: 20px;
  background: rgba(244, 240, 232, 0.9);
  border: 1px solid rgba(210, 198, 180, 0.5);
}
.note-preview-kicker {
  color: #886d59;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.note-preview-summary p,
.note-preview-content p,
.note-preview-empty,
.note-preview-placeholder {
  margin: 0;
  line-height: 1.95;
}
.note-preview-content {
  display: grid;
  gap: 18px;
  font-size: 17px;
}
.note-preview-content .markdown-spacer {
  height: 1rem;
}
.note-preview-content .markdown-spacer-2 {
  height: 1.8rem;
}
.note-preview-content h2 {
  margin: 0;
  color: #21484c;
  font-size: 24px;
  line-height: 1.45;
}
.note-preview-content blockquote {
  margin: 0;
  padding: 14px 16px;
  border-left: 4px solid rgba(136, 109, 89, 0.48);
  border-radius: 0 16px 16px 0;
  background: rgba(244, 240, 232, 0.82);
  color: #4f4135;
  line-height: 1.9;
}
.note-preview-content hr {
  width: 100%;
  margin: 6px 0;
  border: 0;
  border-top: 1px solid rgba(136, 109, 89, 0.32);
}
.note-preview-content ul {
  margin: 0;
  padding-left: 1.4em;
}
.note-preview-content li {
  margin: 0.4em 0;
  line-height: 1.9;
}
.note-preview-content strong {
  font-weight: 700;
  color: #27494d;
}
.note-preview-content .text-red,
.note-preview-content .text-red strong {
  color: #8a3b3b !important;
}
.note-preview-content .text-blue,
.note-preview-content .text-blue strong {
  color: #355d8d !important;
}
.note-preview-content .text-gold,
.note-preview-content .text-gold strong {
  color: #8a6a1f !important;
}
.note-preview-content .text-purple,
.note-preview-content .text-purple strong {
  color: #6a4a82 !important;
}
.note-preview-empty,
.note-preview-placeholder {
  color: var(--muted);
}
@media (max-width: 760px) {
  .note-preview-modal-card {
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
    padding: 18px;
    border-radius: 20px;
  }

  .note-preview-modal-header {
    gap: 10px;
  }

  .note-preview-modal-header h2 {
    font-size: 20px;
  }

  .book-export-settings-card {
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    padding: 18px;
    border-radius: 20px;
  }

  .book-export-settings-modal {
    padding: 12px;
    align-items: stretch;
  }

  .book-export-settings-grid {
    grid-template-columns: 1fr;
  }

  .book-export-settings-cover-preview {
    grid-template-columns: 1fr;
  }

  .book-export-settings-cover-preview img {
    width: 100%;
    height: auto;
    max-height: 220px;
  }

  .book-export-settings-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .book-export-settings-actions-primary {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .book-export-settings-actions .primary-btn,
  .book-export-settings-actions .secondary-btn,
  .book-export-settings-actions .ghost-btn {
    width: 100%;
  }

  .note-preview-header h4 {
    font-size: 22px;
    line-height: 1.3;
  }

  .note-preview-meta {
    gap: 6px;
  }

  .note-preview-content {
    gap: 14px;
    font-size: 15px;
  }

  .note-preview-content h2 {
    font-size: 20px;
  }

  .note-preview-content blockquote {
    padding: 12px 14px;
  }

  .note-preview-content hr {
    margin: 4px 0;
  }

  .note-preview-summary {
    padding: 14px 15px;
    border-radius: 16px;
  }

  .markdown-toolbar {
    gap: 7px;
  }

  .markdown-toolbar-btn {
    min-height: 38px;
    padding: 8px 12px;
  }

  .markdown-syntax-hint {
    padding: 9px 11px;
    font-size: 12px;
  }
}
.scripture-card {
  border: 1px solid rgba(191,211,208,0.72); border-radius: 14px; padding: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(246,251,251,0.9));
}
.scripture-card h4 { margin: 0 0 8px; color: #35585d; font-size: 15px; }
.scripture-text { margin: 0; line-height: 1.75; color: #31484d; }
.error-text { color: var(--danger); }


#auth-forms > .row {
  margin-top: 8px;
}

.auth-settings-card textarea { min-height: 110px; }

.compact-control { max-width: 220px; }
.library-panel-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.compact-control.compact-control-library,
.library-panel-actions .compact-control {
  display: grid;
  gap: 4px;
}

#view-content-library > .panel {
  padding-top: 20px;
}

#view-content-library .panel-header {
  margin-bottom: 14px;
}

#view-content-library .panel-header .muted {
  margin-bottom: 0;
}

#view-content-library .panel > .row.gap-sm.wrap:has(#content-library-search) {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-items: end;
  gap: 10px 10px;
  margin-bottom: 10px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

#view-content-library .panel > .row.gap-sm.wrap:has(#content-library-selection-count) {
  display: flex;
  align-items: center;
  gap: 8px 10px;
  margin-top: 4px;
  margin-bottom: 8px;
}

#view-content-library .compact-control {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  gap: 5px;
  box-sizing: border-box;
}

#view-content-library .compact-control .caption {
  font-size: 12px;
  line-height: 1.2;
}

#content-library-search,
#content-library-date-from,
#content-library-date-to,
#content-library-category,
#content-library-tag {
  width: 100%;
  inline-size: 100%;
  min-width: 0;
  max-width: 100%;
  max-inline-size: 100%;
  min-height: 48px;
  padding: 9px 12px;
  border-radius: 14px;
  font-size: 15px;
  box-sizing: border-box;
  display: block;
}

#content-library-search {
  grid-column: 1 / -1;
}

#view-content-library .compact-control:has(#content-library-date-from) {
  grid-column: 1 / span 3;
}

#view-content-library .compact-control:has(#content-library-date-to) {
  grid-column: 4 / span 3;
}

#view-content-library .compact-control:has(#content-library-category) {
  grid-column: 7 / span 2;
}

#view-content-library .compact-control:has(#content-library-tag) {
  grid-column: 9 / span 2;
}

#content-library-clear-filters {
  grid-column: 11 / span 2;
  width: 100%;
  max-width: 100%;
  min-height: 48px;
  padding: 9px 14px;
  border-radius: 14px;
  white-space: nowrap;
  box-sizing: border-box;
}

#content-library-selection-count {
  font-size: 15px;
  line-height: 1.2;
}

#content-library-book-hint {
  min-width: 0;
}

#content-library-add-selected,
#content-library-clear-selection {
  min-height: 44px;
  padding: 9px 14px;
  border-radius: 14px;
}

#content-library-list.mt-md {
  margin-top: 8px;
}

@media (max-width: 1023px) {
  #view-content-library .panel > .row.gap-sm.wrap:has(#content-library-search) {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  #view-content-library .compact-control:has(#content-library-date-from) {
    grid-column: 1 / span 3;
  }

  #view-content-library .compact-control:has(#content-library-date-to) {
    grid-column: 4 / span 3;
  }

  #view-content-library .compact-control:has(#content-library-category) {
    grid-column: 1 / span 2;
  }

  #view-content-library .compact-control:has(#content-library-tag) {
    grid-column: 3 / span 2;
  }

  #content-library-clear-filters {
    grid-column: 5 / span 2;
  }
}

@media (max-width: 767px) {
  #view-content-library > .panel {
    padding: 16px 16px 12px;
  }

  #view-content-library .panel-header {
    margin-bottom: 12px;
  }

  #view-content-library .panel > .row.gap-sm.wrap:has(#content-library-search) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px 8px;
    margin-bottom: 8px;
  }

  #view-content-library .compact-control:has(#content-library-date-from) {
    grid-column: 1;
  }

  #view-content-library .compact-control:has(#content-library-date-to) {
    grid-column: 2;
  }

  #view-content-library .compact-control:has(#content-library-category) {
    grid-column: 1;
  }

  #view-content-library .compact-control:has(#content-library-tag) {
    grid-column: 2;
  }

  #content-library-clear-filters {
    grid-column: 1 / -1;
  }

  #content-library-search,
  #content-library-date-from,
  #content-library-date-to,
  #content-library-category,
  #content-library-tag {
    min-height: 42px;
    padding: 8px 10px;
    border-radius: 13px;
    font-size: 14px;
  }

  #view-content-library .compact-control .caption {
    font-size: 11px;
    line-height: 1.15;
  }

  #content-library-clear-filters {
    min-height: 42px;
    padding: 8px 11px;
  }

  #view-content-library .panel > .row.gap-sm.wrap:has(#content-library-selection-count) {
    gap: 7px 8px;
    margin-top: 2px;
    margin-bottom: 6px;
  }

  #content-library-selection-count {
    font-size: 14px;
  }

  #content-library-add-selected,
  #content-library-clear-selection {
    min-height: 42px;
    padding: 8px 12px;
  }
}

@media (max-width: 479px) {
  #view-content-library .panel > .row.gap-sm.wrap:has(#content-library-search) {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  #view-content-library .compact-control:has(#content-library-date-from) {
    grid-column: 1 / span 3;
  }

  #view-content-library .compact-control:has(#content-library-date-to) {
    grid-column: 4 / span 3;
  }

  #view-content-library .compact-control:has(#content-library-category) {
    grid-column: 1 / span 2;
  }

  #view-content-library .compact-control:has(#content-library-tag) {
    grid-column: 3 / span 2;
  }

  #content-library-clear-filters {
    grid-column: 5 / span 2;
    min-width: 0;
    padding-inline: 8px;
    font-size: 13px;
  }
}

@media (max-width: 430px) {
  #view-content-library .panel > .row.gap-sm.wrap:has(#content-library-selection-count) {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  #content-library-book-hint {
    grid-column: 1 / -1;
    order: 2;
  }

  #content-library-add-selected {
    grid-column: 1;
    order: 3;
  }

  #content-library-clear-selection {
    grid-column: 2;
    order: 3;
  }
}
.export-success-actions { margin-top: 14px; padding: 16px; border: 1px solid rgba(90,166,166,0.35); border-radius: 14px; background: rgba(238,248,247,0.88); }
.export-success-actions p { margin: 0 0 12px; color: #2f676b; font-weight: 700; line-height: 1.6; }
.library-panel .panel-header { align-items: start; }
.library-list { display: grid; gap: 14px; }
.manual-panel {
  width: min(1132px, 100%);
  margin-inline: auto;
  display: grid;
  gap: 24px;
}
.manual-panel-header {
  margin-bottom: 0;
}
.manual-hero {
  display: grid;
  gap: 12px;
  padding: 24px 26px;
  border-radius: 22px;
  border: 1px solid rgba(191, 211, 208, 0.72);
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(246,251,251,0.92));
}
.manual-kicker {
  margin: 0;
  color: #5d8a8f;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.manual-hero h1 {
  margin: 0;
  font-size: clamp(28px, 3vw, 38px);
  line-height: 1.2;
}
.manual-hero p {
  margin: 0;
  max-width: 780px;
  color: #4f6b6f;
  line-height: 1.8;
}
.manual-toc {
  padding: 20px 22px;
  border-radius: 20px;
  border: 1px solid rgba(191, 211, 208, 0.72);
  background: rgba(249, 252, 252, 0.94);
}
.manual-toc h3 {
  margin: 0 0 14px;
}
.manual-toc ul {
  margin: 0;
  padding-left: 1.2em;
  display: grid;
  gap: 8px;
}
.manual-toc a {
  color: #245e64;
  text-decoration: none;
  font-weight: 600;
}
.manual-toc a:hover {
  text-decoration: underline;
}
.manual-article {
  display: grid;
  gap: 28px;
  padding: 2px 0 10px;
}
.manual-section {
  display: grid;
  gap: 14px;
  padding: 26px;
  border-radius: 22px;
  border: 1px solid rgba(191, 211, 208, 0.72);
  background: rgba(255,255,255,0.95);
}
.manual-section h2,
.manual-section h3,
.manual-section p,
.manual-section ul,
.manual-section ol {
  margin: 0;
}
.manual-section h2 {
  font-size: 24px;
  line-height: 1.3;
}
.manual-section h3 {
  margin-top: 4px;
  font-size: 18px;
  line-height: 1.45;
}
.manual-section p,
.manual-section li {
  color: #456165;
  line-height: 1.9;
}
.manual-section ul,
.manual-section ol {
  padding-left: 1.35em;
  display: grid;
  gap: 8px;
}
.manual-callout {
  display: grid;
  gap: 8px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(124, 198, 194, 0.45);
  background: linear-gradient(180deg, rgba(238,248,247,0.95), rgba(248,252,251,0.9));
}
.manual-callout strong {
  color: #255f63;
}
.manual-callout p {
  color: #365e61;
}
.manual-install-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.manual-install-card {
  display: flex;
  flex-direction: column;
  align-content: start;
  gap: 10px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(191, 211, 208, 0.72);
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,252,251,0.9));
}
.manual-install-card h3 {
  margin: 0;
}
.manual-install-card p {
  margin: 0;
}
.manual-install-card ol {
  margin: 0;
}
.manual-install-note {
  margin: 2px 0 0;
  color: #5f7375;
  font-size: 14px;
  line-height: 1.75;
}
.library-book { display: grid; grid-template-columns: 112px 1fr; gap: 16px; padding: 14px; border: 1px solid rgba(191,211,208,0.78); border-radius: 16px; background: rgba(255,255,255,0.9); }
.library-book.selected { border-color: rgba(90,166,166,0.62); box-shadow: 0 12px 28px rgba(90,166,166,0.12); }
.library-book.imported-book { border-color: rgba(110, 141, 181, 0.38); }
.library-cover { min-height: 148px; border-radius: 10px; overflow: hidden; background: linear-gradient(160deg, #f7fdff 0%, #fff4f7 45%, #f2fbf5 100%); border: 1px solid rgba(191,211,208,0.75); display: grid; place-items: center; color: #31545a; font-weight: 800; }
.library-cover img { width: 100%; height: 100%; object-fit: cover; }
.library-cover-fallback {
  align-content: center;
  justify-items: center;
  padding: 12px;
  text-align: center;
  gap: 8px;
}
.library-cover-fallback strong {
  font-size: 15px;
  line-height: 1.4;
}
.library-cover-fallback small {
  color: rgba(49, 84, 90, 0.78);
  font-size: 12px;
  line-height: 1.5;
}
.library-book-main { display: grid; gap: 10px; }
.library-book-main h3 { margin: 0 0 6px; }
.library-book-main p { margin: 0; color: var(--muted); line-height: 1.65; }
.library-book-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}
.library-book-top h3 {
  margin: 0;
}
.library-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(88, 110, 141, 0.12);
  color: #526a87;
  font-size: 12px;
  font-weight: 700;
}
.library-badge-imported {
  background: rgba(88, 110, 141, 0.12);
  color: #526a87;
}
.library-badge-system {
  background: rgba(15, 92, 92, 0.12);
  color: #0f5c5c;
}
.library-progress { display: grid; grid-template-columns: 44px 1fr; gap: 10px; align-items: center; color: var(--muted); font-size: 13px; }
.library-progress div, .reader-progress div { height: 8px; border-radius: 999px; background: rgba(191,211,208,0.45); overflow: hidden; }
.library-progress i, .reader-progress i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(135deg, var(--primary), #7cc6c2); }
.reader-view { margin: -28px; min-height: calc(100vh - 56px); background: #fbfaf6; }
.reader-view.reader-dark { background: #171b1d; color: #e7eceb; }
.reader-layout { display: grid; grid-template-columns: 260px 1fr; min-height: calc(100vh - 56px); }
.reader-sidebar { padding: 22px; border-right: 1px solid rgba(191,211,208,0.55); background: rgba(255,255,255,0.72); display: flex; flex-direction: column; gap: 16px; }
.reader-dark .reader-sidebar { background: rgba(27,32,34,0.9); border-color: rgba(255,255,255,0.1); }
.reader-page { width: min(100%, 880px); margin: 0 auto; padding: 42px 34px 80px; }
.reader-header { display: flex; justify-content: space-between; gap: 20px; align-items: start; margin-bottom: 28px; }
.reader-progress { min-width: 150px; display: grid; gap: 8px; color: var(--muted); text-align: right; }
.reader-content { font-family: "Noto Serif TC", "PMingLiU", serif; color: #243437; max-width: 720px; margin: 0 auto; }
.reader-dark .reader-content, .reader-dark .reader-header h2 { color: #edf3f1; }
.reader-dark .muted, .reader-dark .reader-progress { color: #aebcbd; }
.reader-content main { padding: 0; }
.reader-content h1 { font-size: 1.7em; color: inherit; margin: 0 0 1em; }
.reader-content p { margin: 0 0 1em; }
.reader-content .title-page { background: rgba(255,255,255,0.55); border-radius: 12px; padding: 1.4em; }
.reader-dark .reader-content .title-page { background: rgba(255,255,255,0.08); }
@media (max-width: 840px) { .library-panel-actions { width: 100%; justify-content: stretch; } .library-panel-actions > * { flex: 1 1 100%; } .manual-panel { gap: 18px; } .manual-hero, .manual-toc, .manual-section { padding: 20px 18px; border-radius: 18px; } .manual-section h2 { font-size: 22px; } .manual-section h3 { font-size: 17px; } .manual-install-grid { grid-template-columns: 1fr; } .library-book { grid-template-columns: 88px 1fr; } .reader-view { margin: -18px; } .reader-layout { grid-template-columns: 1fr; } .reader-sidebar { border-right: none; border-bottom: 1px solid rgba(191,211,208,0.55); } .reader-page { padding: 28px 20px 60px; } .reader-header { display: grid; } }

/* 4/24 homepage redesign overrides */
:root {
  --bg: #f6f1e8;
  --bg-soft: radial-gradient(circle at top, #fff9ef 0%, #f9f4ea 42%, #f2ede4 100%);
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: rgba(255, 255, 255, 0.96);
  --line: rgba(145, 162, 152, 0.18);
  --line-strong: rgba(100, 129, 120, 0.2);
  --text: #244248;
  --muted: #7a817d;
  --primary: #1f7a78;
  --primary-dark: #145f5d;
  --secondary: #f4d7aa;
  --secondary-dark: #eac894;
  --accent: #efc0b1;
  --accent-soft: #f9ede6;
  --shadow: 0 12px 30px rgba(80, 92, 86, 0.08);
  --radius: 24px;
}

body:not(.auth-locked) .sidebar {
  display: none;
}

body:not(.auth-locked) .app-shell {
  display: block;
  min-height: 100vh;
}

body:not(.auth-locked) .main {
  padding: 16px 18px 140px;
  max-width: 1120px;
  margin: 0 auto;
}

.panel {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.card,
.summary-card,
.chapter-item,
.selected-note-preview,
.toc-preview,
.library-book {
  border-color: var(--line);
  box-shadow: none;
}

.topbar {
  margin-bottom: 14px;
}

.topbar-actions {
  margin-left: auto;
}

.icon-only {
  width: 44px;
  height: 44px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 15px;
}

.icon-only svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.asset-icon {
  display: inline-block;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  flex: 0 0 auto;
}

.asset-sprite-system {
  background-image: url("./assets/ui/system-icons.png");
  background-size: 400% 200%;
}

.asset-sprite-summary {
  background-image: url("./assets/ui/summary-icons.png");
  background-size: 300% 100%;
}

.asset-sprite-leaf {
  background-image: url("./assets/ui/leaf-badges.png");
  background-size: 300% 100%;
}

.icon-cloud-check,
.icon-sync,
.icon-gear,
.icon-home,
.icon-note,
.icon-book,
.icon-library,
.icon-arrow {
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

.icon-cloud-check { background-image: url("./assets/ui/cloud-check.png"); }
.icon-sync { background-image: url("./assets/ui/sync.png"); }
.icon-gear { background-image: url("./assets/ui/gear.png"); }
.icon-home { background-image: url("./assets/ui/home.png"); }
.icon-note { background-image: url("./assets/ui/note.png"); }
.icon-book { background-image: url("./assets/ui/book.png"); }
.icon-library { background-image: url("./assets/ui/library.png"); }
.icon-arrow { background-image: url("./assets/ui/arrow.png"); }

.icon-only .asset-icon {
  width: 18px;
  height: 18px;
}

.dashboard-home {
  display: grid;
  gap: 14px;
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  align-items: start;
  overflow: hidden;
  position: relative;
  z-index: 0;
  isolation: isolate;
  min-height: 212px;
  margin: -8px -12px -8px;
  padding: 12px 18px 2px;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: linear-gradient(180deg, rgba(255, 252, 247, 0.68), rgba(255, 249, 240, 0.3));
  backdrop-filter: none;
}

.home-hero::after {
  display: none;
}

.hero-copy {
  display: grid;
  gap: 6px;
  z-index: 1;
  max-width: 55%;
  padding-top: 20px;
}

.hero-copy h1 {
  margin: 0;
  font-size: clamp(25px, 6.6vw, 36px);
  line-height: 1.06;
  letter-spacing: 0.02em;
  color: #1f5d67;
  font-weight: 700;
}

.hero-copy p {
  margin: 0;
  font-size: clamp(12px, 2.4vw, 15px);
  line-height: 1.34;
  color: #8c7d70;
}

.hero-illustration {
  position: absolute;
  right: -8px;
  bottom: 2px;
  width: min(56%, 388px);
  display: flex;
  justify-content: flex-end;
  align-items: flex-end;
  pointer-events: none;
  z-index: 0;
}

.hero-illustration img {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

.sync-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 9px 6px 16px;
  min-height: 60px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  position: relative;
  z-index: 2;
}

.sync-banner-copy {
  min-width: 0;
}

.sync-banner-main {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sync-banner-main > div {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.sync-banner-main strong {
  display: inline-block;
  margin-bottom: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
}

.sync-banner-main p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.sync-banner-icon {
  width: 26px;
  height: 26px;
  background-size: contain;
}

.sync-detail {
  display: inline-block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.sync-btn {
  min-width: 112px;
  border-radius: 999px;
  padding: 10px 18px;
  box-shadow: none;
}

.sync-btn-content {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 15px;
  font-weight: 700;
}

.sync-btn-content .asset-icon {
  width: 20px;
  height: 20px;
  background-size: contain;
}

.home-summary-cards {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.summary-card {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 8px;
  min-height: 130px;
  padding: 15px 12px 13px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.95);
  text-align: center;
}

.summary-icon {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

.summary-icon-notes { background-image: url("./assets/ui/summary-note.png"); }
.summary-icon-books { background-image: url("./assets/ui/summary-book.png"); }
.summary-icon-library { background-image: url("./assets/ui/summary-library.png"); }

.summary-content {
  display: grid;
  gap: 4px;
  justify-items: center;
}

.summary-content span {
  color: #465655;
  font-size: 14px;
  text-align: center;
}

.summary-content strong {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 3px;
  flex-wrap: wrap;
  font-size: 13px;
  color: #1d5c64;
  text-align: center;
}

.summary-content strong span {
  font-size: clamp(28px, 7.2vw, 38px);
  line-height: 0.95;
  color: inherit;
}

.summary-content strong small {
  font-size: 14px;
  color: #425956;
}

.home-primary-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.hero-action-card {
  border: none;
  border-radius: 22px;
  min-height: 82px;
  padding: 12px 16px 12px 92px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  box-shadow: var(--shadow);
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
}

.hero-action-primary {
  background-image: url("./assets/ui/cta-write-note.png");
  color: #fffaf4;
}

.hero-action-secondary {
  background-image: url("./assets/ui/cta-create-book.png");
  color: #82541d;
}

.hero-action-text {
  display: grid;
  gap: 2px;
}

.hero-action-text strong {
  font-size: 17px;
  line-height: 1.15;
}

.hero-action-text small {
  display: none;
}

.home-recent-panel {
  padding: 16px 18px 12px;
}

.home-recent-panel .panel-header {
  margin-bottom: 10px;
}

.home-recent-panel .panel-header h2 {
  margin: 0;
  color: #35585d;
  font-size: 15px;
  line-height: 1.35;
  font-weight: 700;
}

.home-recent-panel .small {
  padding: 0 18px 0 0;
  border: none;
  background: transparent;
  box-shadow: none;
  color: #7a8088;
  font-size: 14px;
  position: relative;
}

.home-recent-panel .small::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 0;
  width: 12px;
  height: 12px;
  transform: translateY(-50%);
  background: url("./assets/ui/arrow.png") center / contain no-repeat;
  opacity: 0.7;
}

.home-recent-list {
  gap: 0;
}

.home-recent-group {
  display: grid;
  gap: 12px;
}

.home-recent-books-group {
  margin-top: 20px;
}

.home-recent-subtitle {
  margin: 0;
  color: #35585d;
  font-size: 15px;
  line-height: 1.35;
  font-weight: 700;
}

.recent-note-item {
  width: 100%;
  border: none;
  background: transparent;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid rgba(139, 154, 146, 0.1);
  text-align: left;
}

.recent-note-item:first-child {
  border-top: none;
  padding-top: 4px;
}

.recent-note-mark {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

.leaf-badge-1 { background-image: url("./assets/ui/leaf-mint.png"); }
.leaf-badge-2 { background-image: url("./assets/ui/leaf-sand.png"); }
.leaf-badge-3 { background-image: url("./assets/ui/leaf-coral.png"); }

.recent-note-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.recent-note-copy strong {
  font-size: 14px;
  color: #233d40;
}

.recent-note-time {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.recent-note-arrow {
  width: 14px;
  height: 14px;
  opacity: 0.55;
}

.account-summary-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 38px;
  padding: 16px 18px;
}

.account-summary-main {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 auto;
  min-width: 0;
}

.account-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  flex: 0 0 auto;
}

.account-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.account-summary-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}

.account-summary-copy strong {
  font-size: 13px;
  color: #233d40;
  display: block;
  max-width: 100%;
  font-weight: 700;
  line-height: 1.2;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.account-summary-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.account-summary-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
  flex-wrap: wrap;
}

.account-settings-trigger {
  background: #f7f0e6;
  border-color: rgba(160, 147, 128, 0.18);
  min-width: 72px;
  height: 40px;
  padding: 0 14px;
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 700;
  color: #6d5447;
}

.account-signout-btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.home-flow-card .steps {
  margin: 0;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  width: min(calc(100% - 28px), 760px);
  padding: 8px 14px max(12px, env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(128, 148, 139, 0.15);
  border-radius: 26px;
  box-shadow: 0 8px 18px rgba(79, 92, 86, 0.09);
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(68px, 1fr);
  gap: 4px;
  z-index: 1100;
  backdrop-filter: blur(18px);
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.bottom-nav::-webkit-scrollbar { display: none; }

.nav-link {
  border: none;
  background: transparent;
  border-radius: 14px;
  padding: 8px 4px 8px;
  display: grid;
  place-items: center;
  gap: 4px;
  color: #798284;
  text-align: center;
  min-height: 64px;
  font-size: 13px;
}

.nav-link.active {
  background: transparent;
  color: var(--primary);
  box-shadow: none;
  position: relative;
}

.nav-link.active::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 18%;
  right: 18%;
  height: 3px;
  border-radius: 999px;
  background: var(--primary);
}

.nav-icon {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
}

.account-settings-card {
  width: min(92vw, 560px);
  max-height: 90vh;
  max-height: min(90vh, calc(100dvh - 32px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.account-settings-card > .panel-header {
  flex: 0 0 auto;
  margin-bottom: 0;
  padding-bottom: 14px;
}

.account-settings-body {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
  padding-bottom: max(2px, env(safe-area-inset-bottom));
  scrollbar-gutter: stable;
}

.account-settings-section {
  display: grid;
  gap: 10px;
  padding: 16px 0;
  border-top: 1px solid rgba(128, 148, 139, 0.14);
}

.account-settings-section:first-of-type {
  border-top: none;
  padding-top: 4px;
}

.account-settings-label {
  color: var(--muted);
  font-size: 13px;
}

.account-settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.account-password-message {
  margin: 0;
}

.account-settings-signout-section {
  padding-bottom: 2px;
}

@media (max-width: 640px) {
  #account-settings-modal {
    padding: 14px;
  }

  .account-settings-card {
    width: min(100%, 560px);
    max-height: 92vh;
    max-height: min(92vh, calc(100dvh - 20px));
    padding: 18px;
  }
}

.site-footer {
  margin-top: 8px;
  padding: 6px 0 112px;
}

.site-footer .support-btn {
  margin-bottom: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(240, 197, 190, 0.34);
  color: #866862;
  box-shadow: none;
  font-size: 11px;
  font-weight: 500;
}

.site-footer .support-btn:hover {
  transform: none;
  background: rgba(240, 197, 190, 0.72);
}

.footer-copyright {
  margin-top: 10px;
}

body[data-current-view="reader"] .bottom-nav,
body.auth-locked .bottom-nav {
  display: none;
}

@media (max-width: 900px) {
  .hero-illustration {
    justify-content: flex-end;
  }
}

@media (max-width: 720px) {
  body:not(.auth-locked) .main {
    padding: 10px 14px 132px;
  }

  .home-hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    min-height: 180px;
    margin: -10px -14px -4px;
    padding: 10px 14px 2px;
  }

  .hero-kicker {
    display: none;
  }

  .hero-copy {
    gap: 4px;
    max-width: 54%;
    padding-top: 18px;
  }

  .hero-copy h1 {
    font-size: clamp(21px, 6.4vw, 29px);
    line-height: 1.06;
  }

  .hero-copy p {
    font-size: 11px;
    line-height: 1.3;
  }

  .hero-illustration {
    right: -10px;
    bottom: 0;
    width: min(56%, 228px);
  }

  .hero-illustration img {
    width: 100%;
    max-width: 100%;
    height: auto;
    object-fit: contain;
  }

  .sync-banner {
    padding: 5px 8px 5px 14px;
    min-height: 52px;
  }

  .sync-banner-main {
    gap: 8px;
  }

  .sync-banner-main strong {
    font-size: 14px;
  }

  .sync-banner-main p {
    font-size: 11px;
  }

  .sync-banner-icon {
    width: 22px;
    height: 22px;
  }

  .sync-btn {
    min-width: 92px;
    padding: 7px 13px;
  }

  .sync-btn-content {
    font-size: 14px;
    gap: 5px;
  }

  .sync-btn-content .asset-icon {
    width: 18px;
    height: 18px;
  }

  .home-summary-cards {
    gap: 8px;
  }

  .summary-card {
    min-height: 96px;
    padding: 11px 10px 9px;
    border-radius: 20px;
  }

  .summary-icon {
    width: 50px;
    height: 50px;
  }

  .summary-content span {
    font-size: 11px;
  }

  .summary-content strong span {
    font-size: clamp(22px, 6vw, 30px);
  }

  .summary-content strong small {
    font-size: 11px;
  }

  .home-primary-actions {
    gap: 8px;
  }

  .hero-action-card {
    min-height: 68px;
    padding: 10px 12px 10px 74px;
    border-radius: 18px;
    background-size: cover;
  }

  .hero-action-text strong {
    font-size: 14px;
  }

  .home-recent-panel {
    padding: 14px 16px 10px;
  }

  .home-recent-panel .panel-header h2 {
    font-size: 14px;
  }

  .home-recent-panel .small {
    font-size: 12px;
  }

  .home-recent-books-group {
    margin-top: 18px;
  }

  .home-recent-subtitle {
    font-size: 14px;
  }

  .recent-note-copy strong {
    font-size: 12px;
  }

  .recent-note-mark {
    width: 26px;
    height: 26px;
  }

  .recent-note-time {
    font-size: 10px;
  }

  .recent-note-item {
    gap: 8px;
    padding: 8px 0;
  }

  .account-summary-card {
    margin-bottom: 32px;
  }

  .bottom-nav {
    width: min(calc(100% - 28px), 760px);
    padding: 7px 10px max(10px, env(safe-area-inset-bottom));
    border-radius: 24px;
  }

  .nav-link {
    min-height: 52px;
    font-size: 11px;
    gap: 4px;
  }

  .nav-link.active::before {
    top: -8px;
    height: 3px;
  }

  .nav-icon {
    width: 20px;
    height: 20px;
  }
}

/* 4/24 assistant corrective pass: homepage first-screen visual alignment */
body:not(.auth-locked) .main {
  padding: 12px 18px 168px;
}

.dashboard-home {
  gap: 12px;
}

.home-hero {
  min-height: 206px;
  margin: -12px -18px -2px;
  padding: 16px 22px 0;
  background:
    linear-gradient(180deg, rgba(255, 252, 246, 0.54), rgba(248, 240, 226, 0.22)),
    url("./assets/ui/hero-background.png") center top / cover no-repeat;
}

.hero-copy {
  max-width: 56%;
  padding-top: 22px;
  gap: 5px;
}

.hero-copy h1 {
  font-size: clamp(30px, 7.4vw, 44px);
  line-height: 1.04;
  letter-spacing: 0.015em;
  font-weight: 700;
}

.hero-copy p {
  font-size: clamp(13px, 2.9vw, 17px);
  line-height: 1.35;
  color: #8a7768;
}

.hero-illustration {
  right: -10px;
  bottom: 6px;
  width: min(62%, 430px);
  opacity: 0.98;
}

.hero-illustration img,
.summary-icon,
.nav-icon,
.asset-icon {
  object-fit: contain;
}

.sync-banner {
  min-height: 54px;
  padding: 5px 8px 5px 18px;
  margin-top: -2px;
  box-shadow: 0 8px 22px rgba(87, 106, 101, 0.05);
}

.sync-banner-main {
  gap: 9px;
}

.sync-banner-main > div {
  gap: 8px;
}

.sync-banner-icon {
  width: 24px;
  height: 24px;
}

.sync-banner-main strong {
  font-size: 17px;
  letter-spacing: 0.01em;
}

.sync-banner-main p {
  font-size: 13px;
}

.sync-btn {
  min-width: 96px;
  padding: 8px 15px;
}

.sync-btn-content {
  font-size: 16px;
  gap: 6px;
}

.sync-btn-content .asset-icon {
  width: 18px;
  height: 18px;
}

.home-summary-cards {
  gap: 10px;
}

.summary-card {
  min-height: 134px;
  padding: 16px 10px 14px;
  align-content: center;
  gap: 8px;
  border-radius: 24px;
  box-shadow: 0 9px 22px rgba(83, 95, 91, 0.055);
}

.summary-icon {
  width: 70px;
  height: 70px;
}

.summary-content {
  gap: 5px;
}

.summary-content span {
  font-size: 15px;
}

.summary-content strong span {
  font-size: clamp(34px, 8.2vw, 46px);
}

.summary-content strong small {
  font-size: 15px;
}

.home-primary-actions {
  gap: 12px;
}

.hero-action-card {
  min-height: 78px;
  border-radius: 21px;
  padding-left: min(100px, 24vw);
  box-shadow: 0 12px 24px rgba(84, 96, 91, 0.08);
}

.hero-action-text strong {
  font-size: 17px;
}

.home-recent-panel {
  padding: 16px 18px 12px;
  border-radius: 24px;
}

.home-recent-panel .panel-header {
  margin-bottom: 8px;
}

.home-recent-panel .panel-header h2 {
  font-size: 15px;
}

.recent-note-item {
  padding: 9px 0;
  gap: 10px;
}

.recent-note-mark {
  width: 32px;
  height: 32px;
}

.recent-note-copy strong {
  font-size: 15px;
}

.recent-note-time {
  font-size: 12px;
}

.account-summary-card {
  margin-bottom: 92px;
  padding: 14px 18px;
  border-radius: 23px;
}

.account-avatar {
  width: 42px;
  height: 42px;
}

.account-summary-copy strong {
  font-size: 14px;
}

.account-summary-copy p {
  font-size: 12px;
}

.account-settings-trigger {
  min-width: 76px;
  height: 44px;
  padding: 0 16px;
}

.bottom-nav {
  bottom: 12px;
  padding: 8px 12px max(12px, env(safe-area-inset-bottom));
  border-radius: 28px;
  box-shadow: 0 10px 24px rgba(66, 78, 74, 0.11);
}

.nav-link {
  min-height: 62px;
  font-size: 13px;
  gap: 5px;
}

.nav-icon {
  width: 26px;
  height: 26px;
}

@media (max-width: 720px) {
  body:not(.auth-locked) .main {
    padding: 8px 14px 168px;
  }

  .dashboard-home {
    gap: 11px;
  }

  .home-hero {
    min-height: 174px;
    margin: -8px -14px -1px;
    padding: 12px 14px 0;
    background:
      linear-gradient(180deg, rgba(255, 252, 246, 0.48), rgba(248, 240, 226, 0.16)),
      url("./assets/ui/hero-background.png") center top / cover no-repeat;
  }

  .hero-copy {
    max-width: 57%;
    padding-top: 18px;
    gap: 4px;
  }

  .hero-copy h1 {
    font-size: clamp(27px, 7.5vw, 34px);
    line-height: 1.03;
  }

  .hero-copy p {
    font-size: clamp(12px, 3.2vw, 14px);
    line-height: 1.32;
  }

  .hero-illustration {
    right: -8px;
    bottom: 5px;
    width: min(64%, 270px);
  }

  .sync-banner {
    min-height: 48px;
    padding: 5px 7px 5px 14px;
    margin-top: -1px;
  }

  .sync-banner-main {
    gap: 8px;
  }

  .sync-banner-main > div {
    gap: 7px;
  }

  .sync-banner-icon {
    width: 22px;
    height: 22px;
  }

  .sync-banner-main strong {
    font-size: 15px;
  }

  .sync-banner-main p {
    font-size: 12px;
  }

  .sync-btn {
    min-width: 88px;
    padding: 7px 12px;
  }

  .sync-btn-content {
    font-size: 15px;
    gap: 5px;
  }

  .sync-btn-content .asset-icon {
    width: 17px;
    height: 17px;
  }

  .home-summary-cards {
    gap: 9px;
  }

  .summary-card {
    min-height: 118px;
    padding: 13px 8px 12px;
    gap: 7px;
    align-content: center;
    border-radius: 21px;
  }

  .summary-icon {
    width: 62px;
    height: 62px;
  }

  .summary-content {
    gap: 4px;
  }

  .summary-content span {
    font-size: 13px;
  }

  .summary-content strong span {
    font-size: clamp(29px, 8vw, 38px);
  }

  .summary-content strong small {
    font-size: 13px;
  }

  .home-primary-actions {
    gap: 10px;
  }

  .hero-action-card {
    min-height: 72px;
    padding: 10px 12px 10px min(88px, 23vw);
    border-radius: 19px;
    background-size: cover;
  }

  .hero-action-text strong {
    font-size: 15px;
  }

  .home-recent-panel {
    padding: 14px 16px 10px;
    border-radius: 22px;
  }

  .home-recent-panel .panel-header {
    margin-bottom: 7px;
  }

  .home-recent-panel .panel-header h2 {
    font-size: 14px;
  }

  .home-recent-panel .small {
    font-size: 12px;
  }

  .recent-note-item {
    padding: 8px 0;
    gap: 8px;
  }

  .recent-note-mark {
    width: 28px;
    height: 28px;
  }

  .recent-note-copy strong {
    font-size: 13px;
  }

  .recent-note-time {
    font-size: 11px;
  }

  .account-summary-card {
    margin-bottom: 92px;
    padding: 13px 16px;
    border-radius: 22px;
  }

  .account-avatar {
    width: 40px;
    height: 40px;
  }

  .account-summary-copy strong {
    font-size: 13px;
  }

  .account-summary-copy p {
    font-size: 11px;
  }

  .account-settings-trigger {
    min-width: 72px;
    height: 42px;
    padding: 0 14px;
  }

  .bottom-nav {
    bottom: 10px;
    width: min(calc(100% - 28px), 760px);
    padding: 8px 10px max(12px, env(safe-area-inset-bottom));
    border-radius: 26px;
  }

  .nav-link {
    min-height: 58px;
    font-size: 12px;
    gap: 5px;
  }

  .nav-icon {
    width: 24px;
    height: 24px;
  }
}

/* 4/24 final UI correction pass by ChatGPT
   Scope: dashboard homepage first screen only. No app.js / data-flow changes.
   Goal: closer mobile app density, preserved image ratios, no stretched PNGs. */

body:not(.auth-locked) .main {
  padding: 0 15px 128px;
  max-width: 430px;
  width: 100%;
  min-height: 100vh;
  overflow-x: clip;
  background: radial-gradient(circle at 50% -12%, #fffdf8 0%, #fbf4e9 48%, #f1eadf 100%);
}

body:not(.auth-locked) .topbar {
  display: none;
}

.dashboard-home {
  gap: 10px;
  width: 100%;
  overflow-x: clip;
}

.home-hero {
  min-height: 166px;
  margin: 0 -15px 0;
  padding: 22px 15px 0;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(255, 251, 244, 0.95) 0%, rgba(255, 250, 242, 0.74) 42%, rgba(255, 246, 231, 0.28) 100%),
    url("./assets/ui/hero-background.png") center 25% / cover no-repeat;
  position: relative;
}

.hero-copy {
  max-width: 58%;
  padding-top: 7px;
  gap: 4px;
  position: relative;
  z-index: 2;
}

.hero-copy h1 {
  font-size: clamp(31px, 8.8vw, 39px);
  line-height: 1.03;
  letter-spacing: 0.01em;
  color: #155f69;
  font-weight: 800;
}

.hero-copy p {
  font-size: clamp(13px, 3.45vw, 15px);
  line-height: 1.34;
  color: #8b7a69;
  font-weight: 500;
}

.hero-illustration {
  right: -9px;
  bottom: 4px;
  width: min(61%, 270px);
  opacity: 1;
  z-index: 1;
}

.hero-illustration img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

.sync-banner {
  min-height: 46px;
  margin: 5px 0 0;
  padding: 5px 7px 5px 17px;
  border-radius: 999px;
  border-color: rgba(59, 123, 126, 0.25);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 18px rgba(91, 103, 96, 0.045);
}

.sync-banner-main {
  gap: 9px;
}

.sync-banner-main > div {
  gap: 7px;
  flex-wrap: nowrap;
}

.sync-banner-icon {
  width: 22px;
  height: 22px;
}

.sync-banner-main strong {
  font-size: 15px;
  color: #15777a;
  white-space: nowrap;
}

.sync-banner-main p {
  font-size: 12px;
  white-space: nowrap;
}

.sync-btn {
  min-width: 82px;
  padding: 7px 12px;
  border-radius: 999px;
}

.sync-btn-content {
  gap: 5px;
  font-size: 15px;
  font-weight: 800;
}

.sync-btn-content .asset-icon {
  width: 16px;
  height: 16px;
}

.home-summary-cards {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin-top: 7px;
}

.summary-card {
  min-height: 122px;
  padding: 14px 8px 12px;
  border-radius: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 18px rgba(79, 92, 86, 0.052);
}

.summary-icon {
  width: 61px;
  height: 61px;
  background-size: contain;
  flex: 0 0 auto;
}

.summary-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 52px;
}

.summary-content span {
  font-size: 13px;
  line-height: 1.15;
  color: #3a5354;
  display: block;
}

.summary-content strong {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 3px;
  line-height: 1;
  margin: 0;
}

.summary-content strong span {
  font-size: clamp(31px, 8.7vw, 39px);
  line-height: 0.92;
  color: #155f69;
}

.summary-content strong small {
  font-size: 12px;
  color: #29494a;
  font-weight: 800;
}

.home-primary-actions {
  gap: 10px;
  margin-top: 3px;
}

.hero-action-card {
  min-height: 68px;
  border-radius: 18px;
  padding: 10px 12px 10px min(80px, 22vw);
  background-size: cover;
  background-position: center;
  box-shadow: 0 10px 20px rgba(80, 92, 86, 0.07);
}

.hero-action-text strong {
  font-size: 15px;
  line-height: 1.1;
  font-weight: 800;
}

.home-recent-panel {
  margin-top: 4px;
  padding: 14px 17px 9px;
  border-radius: 24px;
  box-shadow: 0 10px 22px rgba(79, 92, 86, 0.06);
}

.home-recent-panel .panel-header {
  margin-bottom: 4px;
}

.home-recent-panel .panel-header h2 {
  font-size: 14px;
}

.home-recent-panel .small {
  font-size: 12px;
  padding-right: 17px;
}

.home-recent-group {
  gap: 10px;
}

.home-recent-books-group {
  margin-top: 16px;
}

.home-recent-subtitle {
  font-size: 14px;
}

.recent-note-item {
  min-height: 44px;
  padding: 7px 0;
  grid-template-columns: 31px minmax(0, 1fr) auto 12px;
  gap: 8px;
}

.recent-note-mark {
  width: 29px;
  height: 29px;
  background-size: contain;
}

.recent-note-copy strong {
  font-size: 13px;
  line-height: 1.2;
}

.recent-note-time {
  font-size: 11px;
}

.recent-note-arrow {
  width: 12px;
  height: 12px;
}

.account-summary-card {
  margin-top: 8px;
  margin-bottom: 84px;
  min-height: 62px;
  padding: 11px 14px;
  border-radius: 22px;
  overflow: visible;
}

.account-summary-main {
  gap: 10px;
}

.account-avatar {
  width: 39px;
  height: 39px;
}

.account-summary-copy {
  gap: 1px;
}

.account-summary-copy strong {
  font-size: 13px;
  line-height: 1.18;
}

.account-summary-copy p {
  font-size: 11px;
  line-height: 1.18;
}

.account-settings-trigger {
  min-width: 70px;
  height: 42px;
  border-radius: 15px;
  padding: 0 14px;
}

.bottom-nav {
  bottom: 8px;
  width: min(calc(100% - 26px), 404px);
  max-width: calc(100vw - 26px);
  padding: 6px 12px max(9px, env(safe-area-inset-bottom));
  border-radius: 25px;
  box-shadow: 0 8px 20px rgba(65, 78, 74, 0.1);
}

.nav-link {
  min-height: 55px;
  padding: 6px 2px 5px;
  gap: 4px;
  font-size: 12px;
}

.nav-link.active::before {
  top: -7px;
  left: 19%;
  right: 19%;
  height: 3px;
}

.nav-icon {
  width: 23px;
  height: 23px;
  background-size: contain;
}

.nav-link.active .nav-icon {
  width: 26px;
  height: 26px;
}

@media (min-width: 721px) {
  body:not(.auth-locked) .main {
    max-width: 430px;
    padding-left: 15px;
    padding-right: 15px;
  }
}

@media (max-width: 380px) {
  body:not(.auth-locked) .main {
    padding-left: 12px;
    padding-right: 12px;
  }

  .home-hero {
    margin-left: -12px;
    margin-right: -12px;
    min-height: 158px;
  }

  .hero-copy h1 {
    font-size: clamp(28px, 8.4vw, 34px);
  }

  .hero-illustration {
    width: min(60%, 238px);
  }

  .summary-card {
    min-height: 112px;
    border-radius: 20px;
  }

  .summary-icon {
    width: 55px;
    height: 55px;
  }

  .hero-action-card {
    min-height: 64px;
    padding-left: min(74px, 21vw);
  }

  .hero-action-text strong {
    font-size: 14px;
  }
}

/* 4/24 final UI correction pass 2
   Fix visible issues from latest screenshot:
   - summary icon PNGs have large transparent/white canvas, so use cover to show the actual icon badge larger without distortion.
   - reduce hero-to-sync vertical gap.
   - tighten statistic card content density and bottom safe area. */

.home-hero {
  min-height: 150px;
  padding-top: 18px;
}

.hero-copy {
  padding-top: 4px;
}

.hero-copy h1 {
  font-size: clamp(29px, 8.35vw, 36px);
}

.hero-copy p {
  font-size: clamp(12px, 3.25vw, 14px);
}

.hero-illustration {
  right: -6px;
  bottom: 3px;
  width: min(58%, 252px);
}

.sync-banner {
  margin-top: 0;
  min-height: 43px;
  padding: 4px 6px 4px 15px;
}

.sync-banner-icon {
  width: 20px;
  height: 20px;
}

.sync-banner-main strong {
  font-size: 14px;
}

.sync-banner-main p {
  font-size: 11px;
}

.sync-btn {
  min-width: 78px;
  padding: 6px 11px;
}

.sync-btn-content {
  font-size: 14px;
}

.home-summary-cards {
  margin-top: 5px;
}

.summary-card {
  min-height: 108px;
  padding: 9px 7px 10px;
  gap: 5px;
}

.summary-icon {
  width: 56px;
  height: 56px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.summary-content {
  gap: 2px;
}

.summary-content span {
  font-size: 12px;
}

.summary-content strong span {
  font-size: clamp(30px, 8.2vw, 36px);
}

.summary-content strong small {
  font-size: 11px;
}

.hero-action-card {
  min-height: 64px;
  padding-left: min(75px, 21vw);
}

.home-recent-panel {
  padding-top: 13px;
}

.recent-note-item {
  min-height: 41px;
  padding: 6px 0;
}

.account-summary-card {
  margin-bottom: 78px;
}

.bottom-nav {
  bottom: 7px;
  padding-top: 5px;
}

.nav-link {
  min-height: 52px;
}

@media (max-width: 380px) {
  .home-hero {
    min-height: 144px;
  }

  .hero-illustration {
    width: min(57%, 230px);
  }

  .summary-card {
    min-height: 108px;
    padding: 13px 8px 11px;
  }

  .summary-icon {
    width: 52px;
    height: 52px;
  }

  .summary-content {
    min-height: 48px;
    gap: 3px;
  }
}

/* 4/24 hero background asset replacement pass
   Scope: use full-scene hero image as background, preserve new icon assets, tighten bottom spacing. */
body:not(.auth-locked) .main {
  padding-bottom: 120px;
}

.home-hero {
  min-height: 236px;
  margin: 0 -15px 0;
  padding: 30px 16px 0;
  background:
    linear-gradient(90deg, rgba(255, 251, 244, 0.94) 0%, rgba(255, 248, 239, 0.78) 34%, rgba(255, 247, 234, 0.28) 58%, rgba(255, 246, 232, 0.08) 100%),
    url("./assets/ui/hero-illustration.png") 74% 50% / 100% auto no-repeat;
}

.hero-copy {
  max-width: 54%;
  padding-top: 20px;
  gap: 6px;
  align-self: start;
}

.hero-copy h1 {
  font-size: clamp(29px, 8.2vw, 36px);
  line-height: 1.04;
  font-weight: 800;
}

.hero-copy p {
  font-size: clamp(12px, 3.25vw, 14px);
  line-height: 1.33;
}

.hero-illustration {
  display: none;
}

.account-summary-card {
  margin-bottom: 22px;
}

.bottom-nav {
  bottom: 8px;
}

@media (max-width: 720px) {
  body:not(.auth-locked) .main {
    padding-bottom: 116px;
  }

  .home-hero {
    min-height: 232px;
    margin: 0 -15px 0;
    padding: 28px 15px 0;
    background:
      linear-gradient(90deg, rgba(255, 251, 244, 0.95) 0%, rgba(255, 248, 239, 0.8) 35%, rgba(255, 247, 234, 0.32) 58%, rgba(255, 246, 232, 0.1) 100%),
      url("./assets/ui/hero-illustration.png") 74% 50% / 102% auto no-repeat;
  }

  .hero-copy {
    max-width: 53%;
    padding-top: 20px;
    gap: 6px;
  }

  .hero-copy h1 {
    font-size: clamp(28px, 8vw, 34px);
    line-height: 1.04;
  }

  .hero-copy p {
    font-size: clamp(12px, 3.2vw, 14px);
    line-height: 1.32;
  }

  .account-summary-card {
    margin-bottom: 20px;
  }

  .bottom-nav {
    bottom: 8px;
  }
}

@media (max-width: 380px) {
  .home-hero {
    min-height: 214px;
    margin-left: -12px;
    margin-right: -12px;
    background:
      linear-gradient(90deg, rgba(255, 251, 244, 0.96) 0%, rgba(255, 248, 239, 0.84) 36%, rgba(255, 247, 234, 0.34) 60%, rgba(255, 246, 232, 0.12) 100%),
      url("./assets/ui/hero-illustration.png") 72% 50% / 106% auto no-repeat;
  }

  .hero-copy {
    max-width: 54%;
  }
}

/* 4/24 first-screen vertical rhythm tightening pass
   Goal: pull the entire card stack upward and make sync banner visually connect to hero. */
body:not(.auth-locked) .main {
  padding-bottom: 112px;
}

.dashboard-home {
  gap: 8px;
}

.home-hero {
  min-height: 228px;
  margin: 0 -15px -12px;
  padding: 28px 16px 0;
}

.sync-banner {
  margin-top: 0;
  min-height: 50px;
  padding: 5px 7px 5px 16px;
}

.home-summary-cards {
  margin-top: 2px;
  gap: 8px;
}

.home-primary-actions {
  gap: 8px;
  margin-top: 0;
}

.home-recent-panel {
  margin-top: 0;
}

.account-summary-card {
  margin-top: 2px;
  margin-bottom: 16px;
}

@media (max-width: 720px) {
  body:not(.auth-locked) .main {
    padding-bottom: 108px;
  }

  .dashboard-home {
    gap: 7px;
  }

  .home-hero {
    min-height: 196px;
    margin: 0 -15px -4px;
    padding: 28px 15px 0;
    background:
      linear-gradient(90deg, rgba(255, 251, 244, 0.96) 0%, rgba(255, 248, 239, 0.82) 35%, rgba(255, 247, 234, 0.34) 58%, rgba(255, 246, 232, 0.1) 100%),
      url("./assets/ui/hero-illustration.png") 74% 46% / 104% auto no-repeat;
  }

  .hero-copy {
    max-width: 53%;
    padding-top: 22px;
    gap: 7px;
  }

  .hero-copy h1 {
    line-height: 1.02;
  }

  .hero-copy p {
    line-height: 1.28;
  }

  .sync-banner {
    display: flex;
    margin-top: 0;
    min-height: 48px;
    padding: 4px 7px 4px 14px;
  }

  .home-summary-cards {
    margin-top: 0;
    gap: 7px;
  }

  .home-primary-actions {
    gap: 7px;
    margin-top: 0;
  }

  .hero-action-card {
    min-height: 84px;
    padding: 14px 14px 14px min(94px, 25vw);
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center center;
  }

  .hero-action-text strong {
    font-size: 13px;
    line-height: 1.08;
    letter-spacing: -0.01em;
    white-space: nowrap;
  }

  .hero-action-primary {
    background-position: 28% center;
  }

  .hero-action-secondary {
    background-position: 31% center;
  }

  .home-recent-panel {
    margin-top: 0;
    padding-top: 12px;
  }

  .account-summary-card {
    margin-top: 0;
    margin-bottom: 14px;
  }
}

@media (max-width: 380px) {
  .home-hero {
    min-height: 188px;
    margin-left: -12px;
    margin-right: -12px;
    margin-bottom: -4px;
    padding-top: 24px;
    background:
      linear-gradient(90deg, rgba(255, 251, 244, 0.97) 0%, rgba(255, 248, 239, 0.84) 36%, rgba(255, 247, 234, 0.35) 60%, rgba(255, 246, 232, 0.12) 100%),
      url("./assets/ui/hero-illustration.png") 73% 44% / 108% auto no-repeat;
  }

  .hero-copy {
    padding-top: 18px;
    max-width: 55%;
  }

  .hero-action-card {
    min-height: 82px;
    padding-left: min(90px, 24vw);
    padding-right: 12px;
  }

  .hero-action-text strong {
    font-size: 12px;
  }
}

.desktop-only-panel {
  display: none;
}

.desktop-copy {
  display: none;
}

.dashboard-lower-grid {
  display: block;
}

.dashboard-side-column {
  display: none;
}

.sidebar-brand,
.desktop-sidebar-nav,
.desktop-sidebar-footer {
  display: none;
}

@media (min-width: 721px) and (max-width: 1023px) {
  body:not(.auth-locked) {
    --intermediate-main-width: 840px;
    --intermediate-main-gutter: clamp(24px, 3.4vw, 32px);
  }

  body:not(.auth-locked) .app-shell {
    display: block;
  }

  body:not(.auth-locked) .main {
    width: min(100%, var(--intermediate-main-width));
    max-width: var(--intermediate-main-width);
    padding: 0 var(--intermediate-main-gutter) 126px;
  }

  .dashboard-home {
    gap: 14px;
    width: 100%;
  }

  .home-hero {
    min-height: 256px;
    margin: 0 calc(var(--intermediate-main-gutter) * -1) -6px;
    padding: 38px calc(var(--intermediate-main-gutter) + 6px) 0;
    background:
      linear-gradient(90deg, rgba(255, 251, 244, 0.96) 0%, rgba(255, 248, 239, 0.78) 35%, rgba(255, 247, 234, 0.32) 58%, rgba(255, 246, 232, 0.08) 100%),
      url("./assets/ui/hero-illustration.png") 74% 48% / 86% auto no-repeat;
  }

  .hero-copy {
    max-width: 48%;
    padding-top: 24px;
    gap: 9px;
  }

  .hero-copy h1 {
    font-size: clamp(38px, 5vw, 44px);
  }

  .hero-copy p {
    max-width: 24ch;
    font-size: 16px;
    line-height: 1.42;
  }

  .sync-banner {
    min-height: 58px;
    padding: 7px 10px 7px 22px;
  }

  .sync-banner-icon {
    width: 26px;
    height: 26px;
  }

  .sync-banner-main strong {
    font-size: 17px;
  }

  .sync-banner-main p {
    font-size: 13px;
  }

  .sync-btn {
    min-width: 104px;
    padding: 9px 17px;
  }

  .home-summary-cards {
    gap: 14px;
    margin-top: 4px;
  }

  .summary-card {
    min-height: 138px;
    padding: 16px 12px 14px;
    border-radius: 24px;
  }

  .summary-icon {
    width: 68px;
    height: 68px;
  }

  .summary-content span {
    font-size: 14px;
  }

  .summary-content strong span {
    font-size: clamp(36px, 5vw, 44px);
  }

  .home-primary-actions {
    gap: 14px;
  }

  .hero-action-card {
    min-height: 92px;
    padding: 16px 18px 16px 118px;
    border-radius: 22px;
  }

  .hero-action-text strong {
    font-size: 17px;
  }

  .home-recent-panel {
    padding: 18px 22px 14px;
    border-radius: 24px;
  }

  .home-recent-panel .panel-header h2,
  .home-recent-subtitle {
    font-size: 16px;
  }

  .recent-note-item {
    min-height: 50px;
    padding: 9px 0;
    grid-template-columns: 34px minmax(0, 1fr) auto 14px;
    gap: 10px;
  }

  .recent-note-mark {
    width: 32px;
    height: 32px;
  }

  .recent-note-copy strong {
    font-size: 14px;
  }

  .bottom-nav {
    width: min(calc(100% - 64px), 720px);
    max-width: calc(100vw - 64px);
    padding: 8px 18px max(11px, env(safe-area-inset-bottom));
    gap: 8px;
  }

  .nav-link {
    min-height: 58px;
    font-size: 12px;
  }
}

@media (min-width: 721px) and (max-width: 1023px) and (max-height: 560px) {
  body:not(.auth-locked) {
    --intermediate-main-width: 820px;
    --intermediate-main-gutter: clamp(20px, 3vw, 28px);
  }

  body:not(.auth-locked) .main {
    padding-bottom: 86px;
  }

  .dashboard-home {
    gap: 8px;
  }

  .home-hero {
    min-height: 142px;
    margin-bottom: -2px;
    padding-top: 18px;
    background:
      linear-gradient(90deg, rgba(255, 251, 244, 0.96) 0%, rgba(255, 248, 239, 0.78) 35%, rgba(255, 247, 234, 0.3) 58%, rgba(255, 246, 232, 0.08) 100%),
      url("./assets/ui/hero-illustration.png") 77% 44% / 68% auto no-repeat;
  }

  .hero-copy {
    max-width: 48%;
    padding-top: 6px;
    gap: 5px;
  }

  .hero-copy h1 {
    font-size: clamp(31px, 4.4vw, 38px);
  }

  .hero-copy p {
    max-width: 22ch;
    font-size: 14px;
    line-height: 1.3;
  }

  .sync-banner {
    min-height: 44px;
    padding-top: 4px;
    padding-bottom: 4px;
  }

  .sync-banner-icon {
    width: 21px;
    height: 21px;
  }

  .sync-banner-main strong {
    font-size: 15px;
  }

  .sync-banner-main p {
    font-size: 12px;
  }

  .sync-btn {
    min-width: 90px;
    padding: 7px 13px;
  }

  .sync-btn-content {
    font-size: 14px;
  }

  .home-summary-cards {
    gap: 10px;
    margin-top: 2px;
  }

  .summary-card {
    min-height: 94px;
    padding: 10px 10px 9px;
    gap: 4px;
  }

  .summary-icon {
    width: 48px;
    height: 48px;
  }

  .summary-content {
    min-height: auto;
  }

  .summary-content span {
    font-size: 12px;
  }

  .summary-content strong span {
    font-size: clamp(28px, 4vw, 34px);
  }

  .home-primary-actions {
    gap: 10px;
  }

  .hero-action-card {
    min-height: 62px;
    padding: 10px 14px 10px 88px;
  }

  .hero-action-text strong {
    font-size: 14px;
  }

  .home-recent-panel {
    padding: 13px 18px 10px;
  }

  .home-recent-panel .panel-header h2,
  .home-recent-subtitle {
    font-size: 14px;
  }

  .recent-note-item {
    min-height: 42px;
    padding: 6px 0;
  }

  .bottom-nav {
    bottom: 7px;
    width: min(calc(100% - 52px), 700px);
    max-width: calc(100vw - 52px);
    padding: 4px 14px max(6px, env(safe-area-inset-bottom));
  }

  .nav-link {
    min-height: 38px;
    font-size: 10px;
    gap: 2px;
  }

  .nav-icon {
    width: 19px;
    height: 19px;
  }

  .nav-link.active .nav-icon {
    width: 21px;
    height: 21px;
  }
}

@media (min-width: 1024px) {
  body:not(.auth-locked) {
    --desktop-main-pad-x: 32px;
    --desktop-main-pad-y: 20px;
    --desktop-main-pad-bottom: 34px;
    --desktop-hero-text-inset: 40px;
  }

  body:not(.auth-locked) .app-shell {
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr);
    min-height: 100vh;
  }

  body:not(.auth-locked) .sidebar {
    display: flex;
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 24px 14px;
    gap: 16px;
    border-right: 1px solid rgba(191, 211, 208, 0.55);
    border-bottom: none;
    background:
      linear-gradient(
        180deg,
        rgba(236, 248, 245, 0.98) 0%,
        rgba(239, 249, 246, 0.96) 32%,
        rgba(248, 252, 250, 0.94) 68%,
        #ffffff 100%
      );
    overflow: auto;
  }

  body:not(.auth-locked) .sidebar::before {
    content: "";
    display: block;
    flex: 0 0 auto;
    width: 100%;
    height: 150px;
    border-radius: 24px;
    background:
      linear-gradient(180deg, rgba(255, 251, 244, 0.1) 0%, rgba(245, 250, 247, 0.2) 66%, rgba(240, 249, 247, 0.9) 100%),
      url("./assets/ui/sidebar-devotion-brand.png") center center / cover no-repeat;
    -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 66%, rgba(0, 0, 0, 0.68) 84%, transparent 100%);
    mask-image: linear-gradient(180deg, #000 0%, #000 66%, rgba(0, 0, 0, 0.68) 84%, transparent 100%);
  }

  body:not(.auth-locked) .sidebar > div:not(.sidebar-brand):not(.desktop-sidebar-footer) {
    display: none;
  }

  body:not(.auth-locked) #auth-card {
    display: none !important;
  }

  .desktop-sidebar-nav,
  .desktop-sidebar-footer {
    display: block;
  }

  .sidebar-brand,
  .desktop-sidebar-link.is-muted {
    display: none;
  }

  .sidebar-brand {
    align-items: center;
    gap: 14px;
    padding: 4px 8px 10px;
  }

  .sidebar-brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 16px;
    background: linear-gradient(135deg, #d8ecea, #eef6f5);
    border: 1px dashed #8eb6b2;
    box-shadow: none;
    color: #5a7f7a;
    display: grid;
    place-items: center;
    font-size: 11px;
    font-weight: 700;
  }

  .sidebar-brand-copy {
    display: grid;
    gap: 4px;
  }

  .sidebar-brand-copy h1 {
    font-size: 22px;
    margin: 0;
  }

  .sidebar-brand-copy .muted {
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .desktop-sidebar-nav {
    display: grid;
    gap: 7px;
  }

  .desktop-sidebar-link {
    width: 100%;
    border: 1px solid rgba(191, 211, 208, 0.8);
    background: rgba(255, 255, 255, 0.82);
    color: #325157;
    border-radius: 15px;
    padding: 11px 13px;
    text-align: left;
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    transition: 0.2s ease;
  }

  .desktop-sidebar-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 18px rgba(116, 145, 148, 0.08);
  }

  .desktop-sidebar-link.active {
    background: linear-gradient(135deg, #79c5c0, #5aa6a6);
    color: #fff;
    border-color: transparent;
  }

  .desktop-sidebar-link.is-muted {
    background: rgba(255, 255, 255, 0.56);
  }

  .desktop-sidebar-link[disabled] {
    cursor: default;
    opacity: 0.72;
    box-shadow: none;
    transform: none;
  }

  .desktop-sidebar-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: rgba(61, 131, 133, 0.44);
    margin-left: 6px;
  }

  .desktop-sidebar-footer {
    margin-top: auto;
    display: grid;
    gap: 10px;
  }

  .desktop-sidebar-footer-label {
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 0;
  }

  .desktop-sidebar-account-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
  }

  .desktop-sidebar-account-main {
    display: block;
    min-width: 0;
  }

  .desktop-sidebar-account-header .account-avatar {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: linear-gradient(135deg, #d8ecea, #eef6f5);
    border: 1px dashed #8eb6b2;
    color: #5a7f7a;
    display: grid;
    place-items: center;
    font-weight: 700;
  }

  .desktop-sidebar-account-header .account-avatar img {
    display: none;
  }

  .desktop-sidebar-account-header .account-avatar::before {
    content: "A";
  }

  .desktop-sidebar-account-copy {
    display: grid;
    gap: 6px;
    min-width: 0;
  }

  .desktop-sidebar-account-copy strong {
    font-size: 14px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .desktop-sidebar-account-copy p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
  }

  .desktop-sidebar-account-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
  }

  .desktop-sidebar-sync-main {
    display: grid;
    gap: 6px;
  }

  .desktop-sidebar-sync-main strong {
    font-size: 16px;
    color: #155f69;
  }

  .desktop-sidebar-sync-main p {
    margin: 0;
    line-height: 1.5;
    color: #496468;
    font-size: 13px;
  }

  body:not(.auth-locked) .main {
    width: 100%;
    max-width: none;
    min-height: 100vh;
    padding: var(--desktop-main-pad-y) var(--desktop-main-pad-x) var(--desktop-main-pad-bottom);
    margin: 0;
    background: radial-gradient(circle at 15% 0%, #fffdf8 0%, #fbf4e9 34%, #f1eadf 100%);
    box-sizing: border-box;
  }

body:not(.auth-locked) .topbar {
  display: flex;
  margin-bottom: 12px;
  align-items: center;
  padding-left: var(--desktop-hero-text-inset);
  box-sizing: border-box;
}

body:not(.auth-locked) .topbar-actions {
  display: none;
}

body:not(.auth-locked)[data-current-view="dashboard"] .topbar {
  display: none;
}

  #view-title {
    font-size: 14px;
    font-weight: 700;
    color: #496468;
    letter-spacing: 0.02em;
  }

  .topbar-actions {
    margin-left: auto;
    flex-wrap: nowrap;
  }

  .desktop-topbar-sync-pill {
    min-width: 220px;
    padding: 10px 14px;
    border: 1px solid rgba(191, 211, 208, 0.9);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.82);
    display: grid;
    gap: 3px;
  }

  .desktop-topbar-sync-pill strong {
    color: #155f69;
    font-size: 14px;
  }

  .desktop-topbar-sync-pill span {
    color: var(--muted);
    font-size: 12px;
  }

  .desktop-topbar-sync-btn {
    min-width: 104px;
  }

  .desktop-topbar-notify {
    position: relative;
  }

  .desktop-topbar-notify-dot {
    width: 18px;
    height: 18px;
    border-radius: 999px;
    border: 2px solid #5a7f7a;
    background: transparent;
    box-shadow: none;
  }

  .desktop-topbar-account-btn {
    min-width: 84px;
    height: 44px;
    padding: 0 14px;
  }

  .desktop-topbar-account-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    color: #35585d;
    font-weight: 700;
    font-size: 13px;
  }

  .dashboard-home {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 20px;
  }

  .home-hero,
  .sync-banner,
  .home-summary-cards,
  .home-primary-actions,
  .dashboard-lower-grid {
    grid-column: 1 / -1;
  }

  .home-hero {
    min-height: 260px;
    max-height: 300px;
    margin: 0;
    padding: 34px var(--desktop-hero-text-inset);
    border-radius: 32px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    border: 1px solid rgba(191, 211, 208, 0.72);
    background:
      linear-gradient(180deg, rgba(255,255,255,0.9), rgba(250,246,239,0.95));
  }

  .home-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    background:
      linear-gradient(90deg, rgba(255, 252, 246, 0.96) 0%, rgba(255, 251, 244, 0.9) 34%, rgba(255, 249, 241, 0.58) 46%, rgba(255,255,255,0.08) 60%),
      linear-gradient(135deg, rgba(255,255,255,0.22), rgba(255,255,255,0));
  }

  /* Future desktop hero asset:
     Use one full-width banner background image for the entire hero.
     Keep the left ~40% visually calm for HTML heading text.
     Place key visual objects in the right ~60%.
     Do not embed text in the image itself. */
  .hero-copy {
    position: relative;
    z-index: 1;
    width: min(43%, 540px);
    padding-top: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
  }

  .hero-copy h1 {
    font-size: clamp(40px, 3.6vw, 56px);
    line-height: 1.04;
  }

  .hero-copy p {
    font-size: 17px;
    line-height: 1.5;
    max-width: 34ch;
  }

  .hero-illustration {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: auto;
    height: auto;
    display: block;
    border-radius: inherit;
    border: none;
    background:
      radial-gradient(circle at 84% 24%, rgba(212, 235, 233, 0.84) 0%, rgba(224, 241, 239, 0.48) 18%, rgba(255,255,255,0) 42%),
      radial-gradient(circle at 76% 78%, rgba(237, 229, 207, 0.42) 0%, rgba(255,255,255,0) 24%),
      linear-gradient(110deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0) 58%, rgba(231, 243, 242, 0.28) 76%, rgba(214, 234, 232, 0.54) 100%),
      repeating-linear-gradient(135deg, rgba(142,182,178,0.04) 0, rgba(142,182,178,0.04) 12px, rgba(255,255,255,0.03) 12px, rgba(255,255,255,0.03) 24px);
    z-index: 0;
  }

  .hero-illustration::after {
    content: "Hero Background Placeholder";
    position: absolute;
    right: 34px;
    bottom: 24px;
    max-width: 240px;
    color: rgba(71, 106, 103, 0.38);
    font-weight: 600;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: right;
  }

  .hero-illustration img {
    display: none;
  }

  .hero-visual-placeholder-label {
    display: none;
  }

  .sync-banner {
    margin: 0;
    min-height: 72px;
    padding: 16px 18px 16px 22px;
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .home-summary-cards {
    margin-top: 0;
    gap: 16px;
  }

  .summary-card {
    min-height: 112px;
    max-height: 128px;
    padding: 18px 18px;
    border-radius: 24px;
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 14px;
    align-items: center;
    justify-content: flex-start;
  }

  .summary-content {
    align-items: flex-start;
    min-height: auto;
    gap: 3px;
  }

  .summary-content strong {
    justify-content: flex-start;
  }

  .summary-icon-placeholder {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    border: 1px dashed #8eb6b2;
    background: linear-gradient(135deg, #d8ecea, #eef6f5);
    color: #5a7f7a;
    display: grid;
    place-items: center;
    font-size: 11px;
    font-weight: 700;
  }

  .summary-helper {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
  }

  .home-primary-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 520px));
    justify-content: center;
    gap: 24px;
    margin-top: 0;
    align-items: stretch;
  }

  .hero-action-card {
    min-height: 210px;
    max-height: none;
    padding: 20px 24px;
    border-radius: 24px;
    background-color: #f6efe4;
    border: none;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    overflow: hidden;
    position: relative;
    width: 100%;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
  }

  .hero-action-primary {
    background-image: url("/assets/ui/cta-write-note-desktop.png");
    color: #fffaf3;
  }

  .hero-action-secondary {
    background-image: url("/assets/ui/cta-create-book-desktop.png");
    color: #6d4c20;
  }

  .hero-action-text strong {
    font-size: 21px;
    line-height: 1.2;
    white-space: normal;
    color: inherit;
  }

  .hero-action-text {
    display: grid;
    gap: 8px;
    align-content: center;
    position: relative;
    z-index: 2;
    margin-left: auto;
    width: 44%;
  }

  .hero-action-description {
    display: block;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
  }

  .hero-action-media-placeholder {
    display: none;
  }

  .dashboard-lower-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(340px, 1fr);
    gap: 20px;
    align-items: start;
  }

  .dashboard-side-column {
    display: grid;
    gap: 20px;
  }

  .desktop-only-panel {
    display: block;
  }

  .home-recent-panel,
  .home-bookshelf-card,
  .home-today-devotion-card {
    margin-top: 0;
    padding: 20px 22px;
    border-radius: 24px;
  }

  .home-bookshelf-card,
  .home-today-devotion-card {
    min-height: 224px;
  }

  .home-recent-panel {
    min-height: 100%;
  }

  .bookshelf-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .bookshelf-book-card,
  .bookshelf-empty-state {
    border: 1px solid rgba(191, 211, 208, 0.72);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.76);
    padding: 14px;
  }

  .bookshelf-book-card {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
  }

  .bookshelf-cover-placeholder {
    width: 56px;
    height: 74px;
    border-radius: 14px;
    border: 1px dashed #8eb6b2;
    background: linear-gradient(135deg, rgba(216,236,234,0.9), rgba(255,255,255,0.95));
    color: #476a67;
    display: grid;
    place-items: center;
    font-size: 11px;
    font-weight: 700;
  }

  .bookshelf-cover-thumb {
    width: 56px;
    height: 74px;
    border-radius: 14px;
    border: 1px solid rgba(191, 211, 208, 0.82);
    object-fit: cover;
    display: block;
    background: #fff;
  }

  .bookshelf-book-copy {
    display: grid;
    gap: 4px;
    min-width: 0;
  }

  .bookshelf-book-copy strong {
    color: #21484c;
    font-size: 15px;
    line-height: 1.3;
  }

  .bookshelf-book-copy span,
  .bookshelf-book-copy small,
  .bookshelf-empty-state p {
    color: var(--muted);
    line-height: 1.45;
  }

  .bookshelf-empty-state {
    grid-column: 1 / -1;
    display: grid;
    gap: 8px;
    align-content: center;
    min-height: 180px;
  }

  .bookshelf-empty-state strong {
    color: #21484c;
    font-size: 16px;
  }

  .bookshelf-empty-state p {
    margin: 0;
  }

  .today-devotion-copy {
    display: grid;
    gap: 14px;
    margin-bottom: 16px;
  }

  .today-devotion-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
  }

  .today-devotion-date {
    margin-left: auto;
    text-align: right;
    color: #667b78;
    font-size: 12px;
    line-height: 1.5;
  }

  .today-devotion-section {
    display: grid;
    gap: 6px;
  }

  .today-devotion-label {
    color: #89a09b;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }

  .today-devotion-theme {
    margin: 0;
    color: #21484c;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.35;
  }

  .today-devotion-quote {
    margin: 0;
    color: #7a5630;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.65;
  }

  .today-devotion-summary {
    margin: 0;
    line-height: 1.7;
    color: #496468;
  }

  .today-devotion-section + .today-devotion-section {
    padding-top: 2px;
    border-top: 1px solid rgba(191, 211, 208, 0.4);
  }

  .account-summary-card {
    display: none;
  }

  .bottom-nav {
    display: none !important;
  }
}

@media (min-width: 1280px) {
  body:not(.auth-locked) {
    --desktop-main-pad-x: 38px;
    --desktop-main-pad-y: 24px;
    --desktop-main-pad-bottom: 40px;
    --desktop-hero-text-inset: 42px;
  }

  body:not(.auth-locked) .main {
    width: 100%;
  }

  .dashboard-home {
    gap: 22px;
  }

  .home-hero {
    min-height: 272px;
    max-height: 292px;
    padding-top: 34px;
    padding-bottom: 34px;
  }

  .hero-copy h1 {
    font-size: clamp(44px, 3.8vw, 60px);
  }

  .hero-visual-placeholder-label {
    right: 32px;
    bottom: 24px;
  }

  .dashboard-lower-grid {
    grid-template-columns: minmax(0, 1.62fr) minmax(360px, 1fr);
    gap: 22px;
  }
}

@media (min-width: 1536px) {
  body:not(.auth-locked) {
    --desktop-main-pad-x: 40px;
    --desktop-main-pad-y: 26px;
    --desktop-main-pad-bottom: 44px;
    --desktop-hero-text-inset: 44px;
  }

  body:not(.auth-locked) .main {
    width: 100%;
  }

  .dashboard-home {
    gap: 22px;
  }

  .home-hero {
    min-height: 284px;
    max-height: 300px;
    padding-top: 36px;
    padding-bottom: 36px;
  }

  .hero-copy p {
    font-size: 18px;
  }

  .home-summary-cards {
    gap: 18px;
  }

  .home-primary-actions {
    grid-template-columns: repeat(2, minmax(0, 560px));
    justify-content: center;
  }

  .hero-action-card {
    min-height: 230px;
    padding: 24px 28px;
  }

  .dashboard-lower-grid {
    grid-template-columns: minmax(0, 1.55fr) minmax(390px, 1fr);
  }
}

/* 4/25 desktop hero skeleton reset
   Scope: desktop dashboard hero only. No image assets, no mobile changes. */
@media (min-width: 1024px) {
  .dashboard-home {
    row-gap: 22px;
  }

  .home-hero {
    min-height: 320px;
    max-height: none;
    margin: 0 calc(var(--desktop-main-pad-x) * -1) 0;
    padding: 36px calc(var(--desktop-main-pad-x) + 10px) 34px calc(var(--desktop-main-pad-x) + 12px);
    display: flex;
    align-items: center;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background-image:
      linear-gradient(
        90deg,
        rgba(251, 246, 238, 0.98) 0%,
        rgba(251, 246, 238, 0.86) 30%,
        rgba(251, 246, 238, 0.25) 55%,
        rgba(251, 246, 238, 0) 100%
      ),
      url("/assets/ui/desktop-hero-background.png");
    background-size: cover;
    background-position: center right;
    background-repeat: no-repeat;
    overflow: hidden;
  }

  .home-hero::before {
    display: none;
  }

  .hero-copy {
    position: relative;
    z-index: 2;
    width: min(45%, 560px);
    max-width: 560px;
    padding-top: 0;
    gap: 14px;
  }

  .hero-copy h1 {
    font-size: clamp(42px, 3.35vw, 56px);
    line-height: 1.02;
    letter-spacing: 0.01em;
    font-weight: 800;
    color: #1b5f62;
  }

  .hero-copy p {
    max-width: 30ch;
    font-size: clamp(16px, 1.35vw, 19px);
    line-height: 1.6;
    color: #756d61;
  }

  .hero-illustration {
    display: none;
  }

  .hero-illustration img {
    display: none;
  }

  .sync-banner {
    margin: 0;
    box-shadow: none;
  }
}

@media (min-width: 1280px) {
  .home-hero {
    min-height: 332px;
    padding-top: 38px;
    padding-bottom: 36px;
  }
}

@media (min-width: 1536px) {
  .dashboard-home {
    row-gap: 24px;
  }

  .home-hero {
    min-height: 352px;
    padding-top: 42px;
    padding-bottom: 40px;
  }

  .hero-copy {
    max-width: 580px;
  }

  .hero-copy h1 {
    font-size: clamp(46px, 3.2vw, 62px);
  }

  .hero-copy p {
    font-size: 19px;
  }
}

.admin-dashboard-panel {
  display: grid;
  gap: 22px;
}

.admin-dashboard-section {
  display: grid;
  gap: 14px;
}

.admin-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.admin-stat-card,
.admin-usage-card {
  border: 1px solid rgba(191, 211, 208, 0.78);
  border-radius: 18px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.92);
  display: grid;
  gap: 8px;
}

.admin-stat-label {
  color: var(--muted);
  font-size: 13px;
}

.admin-stat-value {
  color: #245e64;
  font-size: clamp(22px, 2.2vw, 30px);
  line-height: 1.15;
}

.admin-stat-value-email {
  font-size: 15px;
  line-height: 1.55;
  word-break: break-all;
  overflow-wrap: anywhere;
}

.admin-stat-value-placeholder {
  font-size: 15px;
  line-height: 1.45;
}

.admin-monitoring-stack {
  display: grid;
  gap: 18px;
}

.admin-monitoring-group {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid rgba(191, 211, 208, 0.72);
  background: rgba(248, 252, 252, 0.88);
}

.admin-usage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.admin-usage-card-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 10px;
}

.admin-usage-card h4 {
  margin: 0;
  color: #244248;
  font-size: 16px;
  line-height: 1.4;
}

.admin-usage-card.admin-usage-normal {
  border-color: rgba(96, 177, 126, 0.24);
  box-shadow: inset 0 0 0 1px rgba(96, 177, 126, 0.08);
}

.admin-usage-card.admin-usage-warning {
  border-color: rgba(241, 190, 74, 0.34);
  box-shadow: inset 0 0 0 1px rgba(241, 190, 74, 0.1);
}

.admin-usage-card.admin-usage-danger {
  border-color: rgba(235, 136, 70, 0.34);
  box-shadow: inset 0 0 0 1px rgba(235, 136, 70, 0.1);
}

.admin-usage-card.admin-usage-critical {
  border-color: rgba(212, 107, 114, 0.38);
  box-shadow: inset 0 0 0 1px rgba(212, 107, 114, 0.14);
}

.admin-usage-placeholder {
  margin: 0;
  color: #245e64;
  font-size: 15px;
  font-weight: 700;
}

.admin-health-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-health-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
}

.admin-health-badge.is-normal {
  color: #2d6b54;
  background: rgba(96, 177, 126, 0.14);
  border-color: rgba(96, 177, 126, 0.24);
}

.admin-health-badge.is-attention {
  color: #8d6800;
  background: rgba(241, 190, 74, 0.18);
  border-color: rgba(241, 190, 74, 0.32);
}

.admin-health-badge.is-warning {
  color: #a44f16;
  background: rgba(235, 136, 70, 0.18);
  border-color: rgba(235, 136, 70, 0.3);
}

.admin-health-badge.is-critical {
  color: #9e2e3a;
  background: rgba(212, 107, 114, 0.16);
  border-color: rgba(212, 107, 114, 0.32);
}

@media (max-width: 840px) {
  .admin-monitoring-group {
    padding: 16px;
  }

  .admin-usage-card-head {
    display: grid;
  }
}

@media (max-width: 1023px) {
  body:not(.auth-locked)[data-current-view="dashboard"] .main {
    position: relative;
    background: #fbf6ee;
    isolation: isolate;
  }

  body:not(.auth-locked)[data-current-view="dashboard"] .main::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: clamp(240px, 62vw, 320px);
    background-image:
      linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.76) 0%,
        rgba(255, 255, 255, 0.34) 44%,
        rgba(255, 255, 255, 0.04) 72%,
        rgba(255, 255, 255, 0) 100%
      ),
      url("./assets/ui/desktop-hero-background.png");
    background-size: auto 100%;
    background-position: 72% center;
    background-repeat: no-repeat;
    pointer-events: none;
    z-index: 0;
  }

  body:not(.auth-locked)[data-current-view="dashboard"] .main::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: clamp(240px, 62vw, 320px);
    background: linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0) 0%,
      rgba(255, 255, 255, 0) 86%,
      rgba(255, 255, 255, 0.14) 96%,
      #fbf6ee 100%
    );
    pointer-events: none;
    z-index: 0;
  }

  body:not(.auth-locked)[data-current-view="dashboard"] .main > * {
    position: relative;
    z-index: 1;
  }

  body:not(.auth-locked)[data-current-view="dashboard"] .home-hero {
    min-height: clamp(240px, 62vw, 320px);
    margin: 0;
    padding: 34px 15px 22px;
    background: transparent;
    background-image: none;
    border: none;
    box-shadow: none;
  }

  body:not(.auth-locked)[data-current-view="dashboard"] .home-hero::before,
  body:not(.auth-locked)[data-current-view="dashboard"] .home-hero::after {
    content: none;
  }

  body:not(.auth-locked)[data-current-view="dashboard"] .hero-copy {
    width: min(62%, 300px);
    max-width: 300px;
    padding-top: 0;
    gap: 6px;
  }

  body:not(.auth-locked)[data-current-view="dashboard"] .hero-copy h1 {
    color: #155f69;
    text-shadow: 0 1px 12px rgba(255, 255, 255, 0.82);
  }

  body:not(.auth-locked)[data-current-view="dashboard"] .hero-copy p {
    color: #536d70;
    max-width: 22ch;
    text-shadow: 0 1px 10px rgba(255, 255, 255, 0.78);
  }

  body:not(.auth-locked)[data-current-view="dashboard"] .hero-illustration {
    display: none;
  }

  body:not(.auth-locked)[data-current-view="dashboard"] .sync-banner {
    position: relative;
    z-index: 2;
    margin-top: -54px;
  }

  body:not(.auth-locked)[data-current-view="dashboard"] .home-summary-cards,
  body:not(.auth-locked)[data-current-view="dashboard"] .home-primary-actions {
    position: relative;
    z-index: 2;
  }
}

@media (max-width: 1023px) {
  body:not(.auth-locked),
  body:not(.auth-locked) .app-shell {
    background: #fbf6ee;
  }

  body:not(.auth-locked) .main {
    background: #fbf6ee;
    padding-bottom: max(128px, calc(104px + env(safe-area-inset-bottom)));
  }

  body:not(.auth-locked) .bottom-nav {
    display: grid;
    position: fixed !important;
    left: 50%;
    right: auto;
    bottom: calc(12px + env(safe-area-inset-bottom)) !important;
    transform: translateX(-50%) translateZ(0);
    z-index: 1200 !important;
    margin: 0;
    will-change: transform;
  }
}

@media (min-width: 721px) and (max-width: 1023px) {
  body:not(.auth-locked)[data-current-view="dashboard"] .main::before,
  body:not(.auth-locked)[data-current-view="dashboard"] .main::after,
  body:not(.auth-locked)[data-current-view="dashboard"] .home-hero {
    height: auto;
    min-height: clamp(300px, 42vw, 360px);
  }

  body:not(.auth-locked)[data-current-view="dashboard"] .main::before {
    background-size: cover;
    background-position: right 52%;
  }

  body:not(.auth-locked)[data-current-view="dashboard"] .home-hero {
    padding: 48px 18px 28px;
  }

  body:not(.auth-locked)[data-current-view="dashboard"] .hero-copy {
    width: min(48%, 360px);
    max-width: 360px;
  }

  body:not(.auth-locked)[data-current-view="dashboard"] .sync-banner {
    margin-top: -72px;
  }
}

@media (max-width: 720px) {
  .account-summary-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 10px;
    row-gap: 8px;
  }

  .account-summary-main,
  .account-summary-copy {
    display: contents;
  }

  .account-summary-card .account-avatar {
    grid-column: 1;
    grid-row: 1 / span 2;
    align-self: start;
  }

  .account-summary-copy strong {
    grid-column: 2 / 4;
    grid-row: 1;
    align-self: end;
  }

  .account-summary-copy p {
    grid-column: 2;
    grid-row: 2;
    align-self: center;
    font-size: 11px;
    line-height: 1.2;
    white-space: nowrap;
  }

  .account-summary-actions {
    grid-column: 3;
    grid-row: 2;
    width: auto;
    justify-content: flex-end;
    align-self: center;
  }
}

@media (min-width: 1024px) {
  body:not(.auth-locked) .main {
    position: relative;
    background: #ffffff;
    isolation: isolate;
  }

  body:not(.auth-locked)[data-current-view="dashboard"] .main {
    background: #ffffff;
  }

  body:not(.auth-locked)[data-current-view="dashboard"] .main::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: clamp(360px, 32vw, 420px);
    background-image:
      linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.78) 0%,
        rgba(255, 255, 255, 0.42) 34%,
        rgba(255, 255, 255, 0.08) 58%,
        rgba(255, 255, 255, 0) 100%
      ),
      url("./assets/ui/desktop-hero-background.png");
    background-size: 100% auto;
    background-position: right 58%;
    background-repeat: no-repeat;
    pointer-events: none;
    z-index: 0;
  }

  body:not(.auth-locked)[data-current-view="dashboard"] .main::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: clamp(360px, 32vw, 420px);
    background: linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0) 0%,
      rgba(255, 255, 255, 0) 88%,
      rgba(255, 255, 255, 0.12) 97%,
      #ffffff 100%
    );
    pointer-events: none;
    z-index: 0;
  }

  body:not(.auth-locked)[data-current-view="dashboard"] .main > * {
    position: relative;
    z-index: 1;
  }

  .home-hero {
    min-height: clamp(360px, 32vw, 420px);
    max-height: none;
    display: flex;
    align-items: flex-start;
    padding: 54px var(--desktop-hero-text-inset) 34px;
    border: none;
    border-radius: 0;
    background: transparent;
    background-image: none;
    box-shadow: none;
  }

  .home-hero::before,
  .home-hero::after {
    content: none;
  }

  .hero-copy {
    width: min(46%, 560px);
    max-width: 560px;
    gap: 12px;
  }

  .hero-copy h1 {
    color: #155f69;
    text-shadow: 0 1px 12px rgba(255, 255, 255, 0.8);
  }

  .hero-copy p {
    color: #536d70;
    max-width: 30ch;
    text-shadow: 0 1px 10px rgba(255, 255, 255, 0.76);
  }

  .hero-illustration {
    display: none;
  }

  body:not(.auth-locked)[data-current-view="dashboard"] .sync-banner,
  body:not(.auth-locked)[data-current-view="dashboard"] .home-summary-cards,
  body:not(.auth-locked)[data-current-view="dashboard"] .home-primary-actions,
  body:not(.auth-locked)[data-current-view="dashboard"] .dashboard-lower-grid {
    position: relative;
    z-index: 2;
    transform: translateY(-145px);
  }
}
