/* © 2026 The Sensible Studio. All rights reserved. Not licensed for copying, reuse or redistribution. */
/* Pagemarks — styles */

:root {
  --paper: #faf8f3;
  --card: #ffffff;
  --ink: #2b2a27;
  --muted: #6f6a60;
  --line: #e4dfd4;
  --accent: #2f5d50;
  --accent-soft: #e6efe9;
  --warn-bg: #fdf3dc;
  --warn-ink: #7a5a12;
  --danger: #a33a2b;
  --radius: 10px;
  --font: "Gentium Plus", Cambria, Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
}

[hidden] { display: none !important; }

h1, h2, h3 { font-weight: 700; line-height: 1.25; margin: 0; }
h1 { font-size: 2rem; }
h2 { font-size: 1.35rem; }
h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 1.5rem 0 0.5rem;
}

a { color: var(--accent); }
.muted { color: var(--muted); }
.error { color: var(--danger); }
.hint { color: var(--muted); font-size: 0.85em; font-weight: 400; }

/* ---------- Buttons & inputs ---------- */

.btn {
  font: inherit;
  font-size: 0.95rem;
  padding: 0.45rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { border-color: var(--line-strong); background: var(--hover-soft); }
.btn.primary { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-fill); }
.btn.primary:hover { background: var(--accent-fill-hover); }
.btn.danger { color: var(--danger); border-color: var(--danger-line); }
.btn.small { padding: 0.3rem 0.7rem; font-size: 0.85rem; }
.btn.large { padding: 0.7rem 1.4rem; font-size: 1.05rem; }
.icon-btn { padding: 0.4rem 0.65rem; font-size: 1.05rem; line-height: 1; }

input[type="text"], input[type="url"], input[type="email"], input[type="search"],
select, textarea {
  font: inherit;
  font-size: 1rem;
  width: 100%;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
}
input:focus, select:focus, textarea:focus, .btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
textarea { resize: vertical; }

.row { display: flex; gap: 0.5rem; align-items: center; }
.row input { flex: 1; }

/* ---------- Screens ---------- */

.screen.center {
  min-height: calc(100vh / var(--z, 1));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 2.5rem 2.75rem;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 2px 14px var(--shadow-sm);
}
.welcome { text-align: center; }
.welcome h1 { margin: 0.5rem 0 0.35rem; }
.welcome p { margin: 0 0 1.5rem; }
.welcome-icon { width: 64px; height: 64px; }

/* ---------- Top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem 1.5rem;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--ink);
  text-decoration: none;
  margin-right: 0.5rem;
}
.search-wrap { flex: 1; max-width: 560px; }

/* ---------- Layout ---------- */

.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 2rem;
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.5rem;
}

.sidebar { position: sticky; top: 76px; align-self: start; max-height: calc(100vh / var(--z, 1) - 96px); overflow-y: auto; }
.sidebar h3:first-of-type { margin-top: 1.75rem; }

.nav-list { list-style: none; margin: 0; padding: 0; }
.nav-item {
  font: inherit;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  text-align: left;
  padding: 0.35rem 0.65rem;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.nav-item:hover { background: var(--hover); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.nav-item .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.count { color: var(--muted); font-size: 0.85rem; font-weight: 400; }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 0.35rem; }

.chip {
  font: inherit;
  font-size: 0.82rem;
  padding: 0.12rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.active { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-fill); }

/* ---------- Main list ---------- */

.main-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}
.filters-btn { display: none; }
.main-head h2 { margin-right: auto; }
.sort { display: flex; align-items: center; gap: 0.5rem; color: var(--muted); font-size: 0.9rem; }
.sort select { width: auto; font-size: 0.9rem; padding: 0.3rem 0.5rem; }

.bm-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }

.bm {
  display: grid;
  grid-template-columns: 18px 36px 1fr auto;
  gap: 0.9rem;
  align-items: start;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.95rem 1.1rem;
}
.bm:hover { border-color: var(--line-strong); }

.fav {
  width: 32px; height: 32px;
  border-radius: 7px;
  background: var(--hover);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  font-weight: 700; color: var(--muted);
}
.fav img { width: 20px; height: 20px; }

.bm-body { min-width: 0; }
.bm-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  word-break: break-word;
}
.bm-title:hover { color: var(--accent); text-decoration: underline; }
.bm-meta { color: var(--muted); font-size: 0.85rem; margin-top: 0.1rem; overflow-wrap: anywhere; }
.bm-desc { margin: 0.35rem 0 0; font-size: 0.93rem; color: var(--ink-2); }
.bm-notes {
  margin: 0.45rem 0 0;
  padding: 0.4rem 0.7rem;
  border-left: 3px solid var(--accent-soft);
  font-size: 0.92rem;
  font-style: italic;
  color: var(--ink-2);
  white-space: pre-wrap;
}
.bm-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.55rem; }
.folder-label { color: var(--accent); }
.later-badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  background: var(--warn-bg);
  color: var(--warn-ink);
  margin-left: 0.4rem;
  vertical-align: 2px;
}

.bm-actions { display: flex; gap: 0.35rem; }

.empty { text-align: center; padding: 3rem 1rem; }
.empty p { margin: 0.3rem 0; }

/* ---------- Dialogs ---------- */

dialog {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0;
  width: min(560px, calc(100vw / var(--z, 1) - 2rem));
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 10px 40px var(--shadow-lg);
}
dialog::backdrop { background: var(--backdrop); }

dialog form, .settings { padding: 1.75rem 2rem; }
dialog h2 { margin-bottom: 1.1rem; }

dialog label {
  display: block;
  font-weight: 700;
  font-size: 0.92rem;
  margin-bottom: 0.95rem;
}
dialog label input, dialog label textarea, dialog label .row { margin-top: 0.3rem; font-weight: 400; }
/* The typed text stays regular weight (the input[type] rule above would otherwise inherit the bold label) */
dialog label input:is([type="text"], [type="url"], [type="email"], [type="search"]) { font-weight: 400; }
dialog label.check { display: flex; align-items: center; gap: 0.5rem; font-weight: 400; }
dialog label.check input { width: auto; margin: 0; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.warning {
  background: var(--warn-bg);
  color: var(--warn-ink);
  border-radius: 8px;
  padding: 0.55rem 0.8rem;
  font-size: 0.9rem;
  margin: -0.4rem 0 0.95rem;
}
.warning button { font: inherit; background: none; border: 0; color: var(--accent); text-decoration: underline; cursor: pointer; padding: 0; }

.dlg-actions { display: flex; gap: 0.5rem; margin-top: 1.4rem; }
.spacer { flex: 1; }

.dlg-title-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.dlg-title-row h2 { margin: 0; }
.settings section { border-top: 1px solid var(--line); padding-top: 0.25rem; margin-top: 1.25rem; }
.settings section p { margin: 0.3rem 0 0.75rem; font-size: 0.92rem; }
.status { font-size: 0.92rem; color: var(--accent); min-height: 1.2em; }

.invite-list { list-style: none; padding: 0; margin: 0.75rem 0 0; }
.invite-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.4rem 0; border-bottom: 1px solid var(--line);
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--on-fill);
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  font-size: 0.95rem;
  z-index: 50;
}

/* ---------- Small screens ---------- */

@media (max-width: 760px) {
  body { font-size: 16px; }
  .topbar { flex-wrap: wrap; gap: 0.6rem; padding: 0.7rem 1rem; }
  .search-wrap { order: 3; flex-basis: 100%; max-width: none; }
  .brand { margin-right: auto; }
  .layout { grid-template-columns: 1fr; padding: 1rem; gap: 1rem; }
  .sidebar { position: static; max-height: none; display: none; border-bottom: 1px solid var(--line); padding-bottom: 1rem; }
  .sidebar.open { display: block; }
  .filters-btn { display: inline-block; }
  .main-head { flex-wrap: wrap; }
  .sidebar h3 { margin-top: 1rem; }
  .bm { grid-template-columns: 18px 32px 1fr; }
  .bm-actions { grid-column: 3; }
  .bulk-bar { flex-wrap: wrap; }
  .two-col { grid-template-columns: 1fr; gap: 0; }
  dialog form, .settings { padding: 1.4rem 1.25rem; }
}

/* ---------- v4: link health, tree, bulk, tidy ---------- */

.dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-right: 0.5rem;
  flex: none;
  vertical-align: 1px;
}
.dot-ok { background: var(--ok); }
.dot-moved { background: var(--amber); }
.dot-broken { background: var(--dot-broken); }
.dot-unknown { background: var(--dim); }
.dot-pending { background: transparent; border: 1.5px solid var(--line-strong); }

.title-line { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 0.1rem; }
.title-line .dot { align-self: center; }

.pill {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  margin-left: 0.4rem;
}
.pill-broken { background: var(--danger-soft); color: var(--danger-ink); }
.pill-moved { background: var(--warn-bg); color: var(--warn-ink); }

.fix-row {
  margin-top: 0.45rem;
  font-size: 0.9rem;
  color: var(--ink-2);
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem;
}
.mono { font-family: Consolas, "Courier New", monospace; font-size: 0.85rem; overflow-wrap: anywhere; }

.small-note { font-size: 0.82rem; margin: 0.35rem 0.65rem 0; }

.tidy-btn { width: 100%; margin-top: 1rem; background: var(--accent-soft); border-color: var(--green-line); color: var(--accent); font-weight: 700; }

.tree-row { display: flex; align-items: center; }
.tree-row .nav-item { flex: 1; min-width: 0; }
.twisty, .twisty-space { flex: none; width: 20px; text-align: center; }
.twisty {
  font: inherit; font-size: 0.8rem; color: var(--muted);
  background: none; border: 0; cursor: pointer; padding: 0.2rem 0;
}
.twisty:hover { color: var(--accent); }

.pick { margin: 0.45rem 0 0; width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.bm.picked { border-color: var(--accent); background: var(--picked); }

.bulk-bar {
  position: sticky;
  top: 72px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.5rem 0.9rem 0.5rem 1.1rem;
  margin-bottom: 0.75rem;
}
.bulk-bar.active { background: var(--accent-soft); border-color: var(--green-line); }
.select-all { display: flex; align-items: center; gap: 0.55rem; cursor: pointer; font-size: 0.95rem; white-space: nowrap; }
.select-all input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.bulk-count { font-size: 0.92rem; margin-left: 0.75rem; }
.bulk-count.hint-text { font-weight: 400; color: var(--muted); font-style: italic; }
.bulk-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn:disabled:hover { background: var(--card); border-color: var(--line); }

.tidy-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin: 0.5rem 0 1.25rem;
  background: var(--paper);
}
.tidy-label { display: block; font-weight: 700; font-size: 0.92rem; margin-bottom: 0.75rem; }
.tidy-label .row { margin-top: 0.3rem; font-weight: 400; }
.tidy-finished { margin: 0; font-size: 1.05rem; }
#dlg-tidy .settings { padding-bottom: 1.5rem; }
@media (max-width: 760px) {
  .bulk-count.hint-text { display: none; }
  .bulk-bar { top: 112px; }
}

.warn-text { color: var(--warn-ink); font-style: italic; }

/* ---------- v8: folder moving ---------- */
.main-head { flex-wrap: wrap; }
.folder-tools { display: flex; gap: 0.4rem; margin-right: auto; }
.main-head h2 { margin-right: 0.5rem; }
.drop-over { outline: 2px dashed var(--accent); outline-offset: -2px; background: var(--accent-soft) !important; }
.drop-root { padding: 0.25rem 0.4rem; margin-left: -0.4rem; border-radius: 6px; }
/* While dragging a folder: the Folders heading becomes a soft lavender drop spot for the top level
   (lavender is only used here; the Librarian keeps its blue). Deepens when a folder is held over it. */
body.dragging-folder .drop-root {
  background: var(--lav-bg); border: 1.5px dashed var(--lav-line); color: var(--lav-ink);
  padding: 0.65rem 0.8rem; margin: 0.4rem 0 0.6rem; border-radius: 10px;
}
body.dragging-folder .drop-root::after {
  content: "Drop here to move it to the top level"; display: block; margin-top: 0.2rem;
  font-size: 0.88rem; text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--lav-ink);
}
body.dragging-folder .drop-root.drop-over { background: var(--lav-over) !important; border-style: solid; outline: none; }
.drag-tip { margin: -0.2rem 0 0.5rem; }
@media (pointer: coarse) { .drag-tip { display: none; } }
.bm[draggable="true"] { cursor: grab; }
.bm a, .bm button, .bm input { cursor: pointer; }
.drag-ghost {
  position: fixed; top: -100px; left: -100px;
  background: var(--accent-fill); color: var(--on-fill); padding: 0.35rem 0.8rem; border-radius: 8px; font-size: 0.9rem;
}
.folder-dest { width: 100%; font: inherit; font-size: 1rem; padding: 0.3rem; border: 1px solid var(--line); border-radius: 8px; margin-top: 0.3rem; }
.folder-dest option { padding: 0.25rem 0.4rem; }

/* ---------- v9: calm view, Organize mode, styled confirm ---------- */
body:not(.editing) .edit-only,
body:not(.editing) .pick,
body:not(.editing) .bm-actions,
body:not(.editing) .fix-row,
body:not(.editing) .pill { display: none !important; }
body:not(.editing) .bm { grid-template-columns: 36px 1fr; padding: 1rem 1.25rem; }
body:not(.editing) .bm[draggable] { cursor: default; }
body:not(.editing) .bm-list { gap: 0.6rem; }
body.editing .bm-list { gap: 0.75rem; }

.dlg-confirm { width: min(420px, calc(100vw / var(--z, 1) - 2rem)); }
.dlg-confirm form { padding: 1.6rem 1.75rem 1.4rem; }
.dlg-confirm h2 { margin-bottom: 0.5rem; font-size: 1.25rem; }
.dlg-confirm p { margin: 0 0 0.5rem; color: var(--ink-2); }
.dlg-confirm .dlg-actions { margin-top: 1.25rem; }
.dlg-notice #toast-text { font-size: 1.08rem; line-height: 1.5; color: var(--ink); margin: 0.2rem 0 0; }
.dlg-notice #toast-ok { min-width: 5rem; }
.btn.danger-solid { background: var(--danger-fill); border-color: var(--danger-fill); color: var(--on-fill); }
.btn.danger-solid:hover { background: var(--danger-fill-hover); }

@media (max-width: 760px) {
  body:not(.editing) .bm { grid-template-columns: 32px 1fr; }
}

/* ---------- v10: new folders ---------- */
.new-folder-btn { margin: 0 0 0.6rem; }
.folder-tools { flex-wrap: wrap; }

/* ---------- v11: sub-folder rows ---------- */
.sub-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.7rem 1.1rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
}
.sub-row:hover, .sub-row:focus-visible { border-color: var(--line-strong); background: var(--hover); outline: none; }
.sub-icon {
  width: 36px; height: 36px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border-radius: 7px; background: var(--accent-soft); color: var(--accent);
}
.sub-name { font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub-arrow { color: var(--muted); font-size: 1.3rem; line-height: 1; }

/* ---------- v13: title wrapping ---------- */
.title-line { display: flex; flex-wrap: nowrap; align-items: flex-start; gap: 0.55rem; }
.title-line .dot { margin: 0.5em 0 0; align-self: flex-start; }
.title-text { flex: 1; min-width: 0; }
.title-text .pill, .title-text .later-badge { white-space: nowrap; }
.sub-row { padding: 0.55rem 1.1rem; }
body:not(.editing) .sub-row { padding-left: 1.25rem; padding-right: 1.25rem; }

/* ---------- v14: update notice ---------- */
.update-bar {
  position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%); z-index: 60;
  display: flex; align-items: center; gap: 0.9rem;
  background: var(--card); color: var(--ink);
  border: 1px solid var(--green-line); border-radius: 10px;
  box-shadow: 0 6px 24px var(--shadow);
  padding: 0.65rem 0.75rem 0.65rem 1.1rem; font-size: 0.95rem;
}

/* ---------- v15: line Link health up with the folder list ---------- */
/* Dots sit in the same 20px column as the folder arrows; words start where folder names start */
.health-list .nav-item { padding-left: 0; }
.health-list .dot { margin: 0 calc(0.65rem + 5px) 0 5px; vertical-align: 0; }

/* ---------- v16: folder picker ---------- */
.dlg-pick { width: min(520px, calc(100vw / var(--z, 1) - 2rem)); }
.dlg-pick form { padding: 1.5rem 1.75rem 1.4rem; }
.dlg-pick h2 { margin-bottom: 0.85rem; }
.pick-list {
  list-style: none; margin: 0.75rem 0 0; padding: 0.3rem;
  border: 1px solid var(--line); border-radius: 10px; background: var(--paper);
  max-height: min(52vh, 420px); overflow-y: auto;
}
.pick-row {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.32rem 0.8rem; border-radius: 8px; cursor: pointer; user-select: none;
}
.pick-row:hover { background: var(--hover); }
.pick-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.pick-row.selected { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.pick-row .sub-icon { width: 28px; height: 28px; border-radius: 6px; background: transparent; }
.pick-row .sub-icon svg { width: 18px; height: 18px; }
.pick-row.selected .sub-icon { background: var(--pin-hover); }
.pick-none-icon { width: 28px; height: 28px; flex: none; border: 1.5px dashed var(--line-strong); border-radius: 6px; }
.pick-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-sub { color: var(--muted); font-size: 0.82rem; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.pick-check { width: 1rem; text-align: center; color: var(--accent); }
.pick-empty { padding: 0.8rem; font-style: italic; }
.pick-new { display: flex; gap: 0.4rem; margin-top: 0.75rem; }
.pick-new input { flex: 1; }
.dlg-pick .dlg-actions { margin-top: 1.1rem; }

.folder-field {
  font: inherit; font-size: 1rem; font-weight: 400;
  width: 100%; margin-top: 0.3rem; display: flex; align-items: center; gap: 0.55rem;
  padding: 0.45rem 0.7rem; border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); color: var(--ink); cursor: pointer; text-align: left;
}
.folder-field:hover { border-color: var(--line-strong); }
.folder-field #f-folder-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-field.empty #f-folder-label { color: var(--muted); }
.ff-icon { flex: none; color: var(--accent); }
.ff-change { color: var(--accent); font-size: 0.88rem; }
.tidy-choose { margin-top: 0.75rem; }
p.tidy-label { margin: 0 0 0.5rem; }

/* ---------- v17: folder suggestions ---------- */
.suggest-buttons { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1rem; }
.suggest-btn {
  display: flex; align-items: center; gap: 0.55rem; text-align: left;
  border-color: var(--green-line); background: var(--accent-soft); color: var(--accent); font-weight: 700;
}
.suggest-btn:hover { background: var(--pin-hover); border-color: var(--accent); }
.suggest-btn .sub-icon { width: 22px; height: 22px; background: transparent; }
.suggest-btn .sub-icon svg { width: 18px; height: 18px; }
.sb-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-new { font-size: 0.75rem; font-weight: 400; padding: 0.05rem 0.5rem; border-radius: 999px; background: var(--warn-bg); color: var(--warn-ink); }
.suggest-btn.is-new { border-style: dashed; }
.suggest-line { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin: -0.4rem 0 0.95rem; font-size: 0.9rem; }
.suggest-line .suggest-btn { padding: 0.25rem 0.65rem; font-size: 0.88rem; }
.tidy-suggest .tidy-label, p.tidy-label { font-weight: 700; font-size: 0.92rem; }

/* ---------- v19: How Pagemarks works ---------- */
.howto { border-bottom: 1px solid var(--line); padding: 0.45rem 0; }
.howto summary { cursor: pointer; font-weight: 700; font-size: 0.95rem; color: var(--ink); }
.howto summary::marker { color: var(--muted); }
.howto ul { margin: 0.45rem 0 0.3rem; padding-left: 1.1rem; font-size: 0.9rem; color: var(--ink-2); }
.howto li { margin: 0.25rem 0; }
.howto li .dot { margin-right: 0.35rem; vertical-align: 0; }
#dlg-settings { max-height: calc(100vh / var(--z, 1) - 2rem); }

/* v20: no double line under the last topic */
.howto:last-of-type { border-bottom: 0; padding-bottom: 0.2rem; }

/* v21: privacy link on the sign-in card */
.signin-foot { margin: 1.25rem 0 0 !important; font-size: 0.9rem; }
.signin-foot a { color: var(--muted); }

/* ---------- v24: header lines up with the page columns ---------- */
.topbar { display: block; padding: 0.8rem 0; }
.topbar-inner {
  max-width: 1180px; margin: 0 auto; padding: 0 1.5rem;
  display: grid; grid-template-columns: 240px 1fr; gap: 2rem; align-items: center;
}
.topbar-inner .brand { margin-right: 0; }
.topbar-main { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
.topbar-main .search-wrap { flex: 1; max-width: none; margin-right: 0.4rem; }

@media (max-width: 760px) {
  .topbar { padding: 0.7rem 0; }
  .topbar-inner { display: flex; flex-wrap: wrap; gap: 0.6rem; padding: 0 1rem; }
  .topbar-inner .brand { margin-right: auto; }
  .topbar-main { display: contents; }
  .topbar-main .search-wrap { order: 3; flex-basis: 100%; margin-right: 0; }
}
@media (max-width: 760px) {
  .topbar-inner { gap: 0.6rem 0.4rem; }
  .topbar-inner .brand { font-size: 1.12rem; gap: 0.3rem; }
  .topbar-main > .btn { padding: 0.42rem 0.7rem; }
  .topbar-main > .icon-btn { padding: 0.42rem 0.6rem; }
}

/* ---------- v25: equal header buttons, even Settings spacing ---------- */
.topbar-main > .btn { height: 2.45rem; display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
.topbar-main > .icon-btn { width: 2.45rem; padding: 0; font-size: 1.05rem; }

/* Settings: every section gets the same space above and below its dividing line */
.settings > p.muted { margin: 0.6rem 0 0; }
.settings section { border-top: 1px solid var(--line); margin-top: 1.4rem; padding-top: 1.4rem; }
.settings section h3 { margin: 0 0 0.6rem; }
.settings section > :last-child { margin-bottom: 0; }
.settings section p { margin: 0 0 0.75rem; }
.settings .status:empty { display: none; }
.settings .status { margin: 0.6rem 0 0; }
.settings input[type="file"] { display: block; }
.settings .howto:last-of-type { border-bottom: 0; padding-bottom: 0; }
#form-invite { margin: 0; }
.invite-list { margin: 0.75rem 0 0; }
.invite-list:empty { display: none; }
.invite-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.settings section:last-child p { margin-bottom: 0.75rem; }

@media (max-width: 760px) {
  .topbar-main > .btn { height: 2.3rem; }
  .topbar-main > .icon-btn { width: 2.3rem; padding: 0; }
}
/* The invite box is a form inside a dialog, so it was picking up the dialog's padding */
.settings #form-invite { padding: 0; margin: 0; }
.invite-list li { font-size: 0.92rem; padding: 0.45rem 0; }
.settings .howto:last-of-type summary { padding-bottom: 0; }
.settings #form-invite { align-items: stretch; }

/* ---------- v26: Star, Home and Pin ---------- */
.bm-side { display: flex; align-items: flex-start; gap: 0.35rem; }
body:not(.editing) .bm { grid-template-columns: 36px 1fr auto; }
.star-btn {
  font: inherit; font-size: 1.25rem; line-height: 1; width: 2rem; height: 2rem;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 7px; background: transparent; color: var(--dim); cursor: pointer;
}
.star-btn:hover { background: var(--hover); color: var(--amber); }
.star-btn.on { color: var(--amber); }
.bm .star-btn { opacity: 0.55; }
.bm:hover .star-btn, .bm .star-btn.on, .bm .star-btn:focus-visible { opacity: 1; }
.home-star { color: var(--amber); margin-right: 0.35rem; }
.pin-icon { display: inline-flex; vertical-align: -1px; margin-right: 0.35rem; color: var(--accent); }
.bm.pinned { border-color: var(--green-line); }

.home { display: grid; gap: 1.6rem; }
.home-group-title {
  display: flex; align-items: center; gap: 0.5rem; margin: 0 0 0.7rem;
  font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.home-group-title .sub-icon { width: 22px; height: 22px; background: transparent; }
.home-group-title .sub-icon svg { width: 16px; height: 16px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.6rem; }
.tile {
  position: relative; display: flex; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
}
.tile:hover { border-color: var(--line-strong); box-shadow: 0 2px 10px var(--shadow-sm); }
.tile-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 0.65rem; padding: 0.7rem 0.4rem 0.7rem 0.8rem; color: var(--ink); text-decoration: none; }
.tile-fav { width: 30px; height: 30px; flex: none; }
.tile-text { min-width: 0; display: flex; flex-direction: column; }
.tile-title { font-weight: 700; font-size: 0.95rem; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tile-host { color: var(--muted); font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .star-btn { margin-right: 0.35rem; font-size: 1.05rem; width: 1.7rem; height: 1.7rem; }
@media (max-width: 760px) {
  .tiles { grid-template-columns: 1fr 1fr; }
  body:not(.editing) .bm { grid-template-columns: 32px 1fr auto; }
  body.editing .bm-side { grid-column: 3; }
}

/* ---------- v28: Home as masonry cards, one per folder ---------- */
.home { display: flex; align-items: flex-start; gap: 1rem; }
.home > .empty { flex: 1 1 100%; }
.home-col { flex: 1 1 0; min-width: 0; }
.home-group {
  display: block; width: 100%;
  margin: 0 0 1rem; padding: 0.85rem 0.6rem 0.5rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
}
.home-group-title {
  display: flex; align-items: center; gap: 0.45rem;
  margin: 0 0.4rem 0.45rem; padding-bottom: 0.55rem; border-bottom: 1px solid var(--line);
  font-size: 0.95rem; letter-spacing: 0; text-transform: none; color: var(--ink); font-weight: 700;
}
.home-group.linked .home-group-title { cursor: pointer; }
.home-group.linked .home-group-title:hover .hg-name { color: var(--accent); }
.hg-name { min-width: 0; }
.home-hint { margin: 0.2rem 0 0.1rem; font-size: 0.92rem; font-style: italic; color: var(--muted); line-height: 1.45; }
/* Negative margins so showing the button in Organize doesn't push the card's rule down */
/* "Unpin" (already pinned) gets a soft green fill so pinned folders stand out in Organize */
.hg-pin.on, #folder-pin.on { background: var(--pin-bg); border-color: var(--green-line-2); color: var(--accent); }
.hg-pin.on:hover, #folder-pin.on:hover { background: var(--pin-hover); }
.hg-pin { margin: -0.4rem 0 -0.4rem auto; flex: none; padding: 0.15rem 0.6rem; font-size: 0.82rem; line-height: 1.3; align-self: center; min-width: 4.1rem; }

#view-title .home-pin { margin-left: 0.15rem; vertical-align: 0.1em; }
.hg-parent { color: var(--muted); font-weight: 700; font-size: inherit; }   /* v42: same size and weight; grey shows it's the parent */
.home-group-title .sub-icon { width: 22px; height: 22px; background: transparent; flex: none; }
.home-group-title .sub-icon svg { width: 16px; height: 16px; }
.home-list { list-style: none; margin: 0; padding: 0; }
.home-row { display: flex; align-items: center; border-radius: 8px; }
.home-row:hover { background: var(--hover); }
.home-link {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 0.6rem;
  padding: 0.42rem 0.3rem 0.42rem 0.4rem; color: var(--ink); text-decoration: none;
}
.home-link .tile-fav { width: 24px; height: 24px; border-radius: 6px; }
.home-link .tile-fav img { width: 16px; height: 16px; }
.home-title { font-size: 0.95rem; line-height: 1.35; overflow-wrap: anywhere; }
.home-row .star-btn { flex: none; width: 1.7rem; height: 1.7rem; font-size: 1rem; opacity: 0; }
.home-row:hover .star-btn, .home-row .star-btn:focus-visible { opacity: 1; }
/* Stars appear only in Organize, on every device; the calm view stays clean */
body:not(.editing) .star-btn { display: none; }
@media (pointer: coarse) { body.editing .home-row .star-btn { opacity: 1; } }
@media (max-width: 760px) { .home-cols { columns: 1; } }

/* ---------- v29: site icon lines up with the first line of a long title ---------- */
.home-row { align-items: flex-start; }
.home-link { align-items: flex-start; }
.home-link .tile-fav { margin-top: -0.08rem; }   /* v41: level with the middle of the first line's letters */
.home-row .star-btn { margin-top: 0.32rem; }

/* v30: refusal counts in the invite list */
.refusal-note { color: var(--warn-ink); font-size: 0.88em; }

/* v33: owner-only notes (visible only to the owner) */
.owner-note {
  margin: 0.55rem 0 0.4rem;
  padding: 0.6rem 0.75rem 0.5rem;
  border: 1px dashed var(--badge-line);
  border-radius: 8px;
  background: var(--warn-bg);
  color: var(--warn-ink);
  font-size: 0.9rem;
}
.owner-note[hidden] { display: none; }
.owner-note p { margin: 0.4rem 0 0.3rem; color: var(--warn-ink); }
.owner-note ul { margin: 0.2rem 0 0.1rem; padding-left: 1.1rem; color: var(--warn-ink); font-size: 0.9rem; }
.owner-note li { margin: 0.2rem 0; }
.owner-badge {
  display: inline-block;
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  background: var(--badge);
  color: var(--warn-ink);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: 0.12em;
}
h3 .owner-badge { margin-left: 0.5rem; letter-spacing: 0.04em; }

/* v34: quick save (browser extension / iPhone Shortcut): only the Save dialog shows */
body.quick #screen-app { visibility: hidden; }
body.quick dialog::backdrop { background: var(--card); }
/* v35: the save form fills the small window, top first, compact spacing */
body.quick #dlg-edit {
  width: calc(100vw / var(--z, 1)); max-width: calc(100vw / var(--z, 1));
  height: calc(100vh / var(--z, 1)); max-height: calc(100vh / var(--z, 1));
  margin: 0; inset: 0;
  border: 0; border-radius: 0; box-shadow: none;
  overflow-y: auto;
}
.welcome .saved-mark {
  margin: 0 auto 0.75rem;
  width: 3rem; height: 3rem; line-height: 3rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.5rem;
  font-weight: 700;
}
.welcome .saved-mark[hidden] { display: none; }
#screen-saved a.btn { text-decoration: none; display: inline-block; }
body.quick label:has(#f-desc), body.quick label:has(#f-notes) { display: none; }
body.quick #dlg-edit form { padding: 1.1rem 1.5rem 1.1rem; max-width: 560px; margin: 0 auto; }
body.quick #dlg-edit h2 { margin-bottom: 0.7rem; }
body.quick #dlg-edit label { margin-bottom: 0.7rem; }
body.quick #dlg-edit .suggest-line { margin: -0.3rem 0 0.7rem; }
body.quick #dlg-edit .dlg-actions { margin-top: 0.9rem; }

/* v40: buttons use the lighter logo green; text accents keep the darker green for easy reading */
:root { --brand: #3f8069; --brand-hover: #356f5a; }
.btn.primary { background: var(--brand); border-color: var(--brand); }
.btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.chip.active { background: var(--brand); border-color: var(--brand); }

/* v42: folder icon on Home lines up with the first line of a heading that wraps */
.home-group-title { align-items: flex-start; }
.home-group-title .sub-icon { margin-top: 0; }   /* v43: level with the first line (was 2px low) */

/* v44: a clear (✕) button inside the search box */
.search-wrap { position: relative; }
#search { padding-right: 2.2rem; }
#search::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; display: none; }
.search-clear {
  position: absolute; right: 0.45rem; top: 50%; transform: translateY(-50%);
  width: 1.6rem; height: 1.6rem; border: 0; border-radius: 50%;
  background: transparent; color: var(--muted); font-size: 0.85rem; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.search-clear:hover { background: var(--hover); color: var(--ink); }
.search-clear[hidden] { display: none; }

/* v45: Home card suggesting the browser button */
.ext-card {
  display: flex; align-items: center; gap: 0.9rem;
  margin: 0 0 1.1rem; padding: 0.85rem 0.9rem 0.85rem 1rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
}
.ext-card[hidden] { display: none; }
.ext-card img { flex: none; }
.ext-card-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.ext-card-text .muted { font-size: 0.9rem; }
.ext-card .btn { flex: none; text-decoration: none; }
.ext-card-close {
  flex: none; width: 1.8rem; height: 1.8rem; border: 0; border-radius: 50%;
  background: transparent; color: var(--muted); cursor: pointer; font-size: 0.85rem;
}
.ext-card-close:hover { background: var(--hover); color: var(--ink); }
.ext-installed { color: var(--accent); font-weight: 700; }
#ext-get a.btn { text-decoration: none; }
@media (max-width: 700px) { .ext-card { flex-wrap: wrap; } .ext-card-text { flex-basis: calc(100% - 36px - 3.5rem); } .ext-card .btn { margin-left: calc(36px + 0.9rem); } .ext-card .btn + .btn { margin-left: 0; } }

/* v48: the Pagemarks logo above the heading in the browser button's save window */
.quick-brand { display: none; }
body.quick .quick-brand {
  display: flex; align-items: center; gap: 0.35rem;
  margin: 0 0 0.9rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--line);
  font-size: 1.12rem; font-weight: 700; color: var(--ink);
}
body.quick .quick-brand img { flex: none; }

/* v49: hidden sidebar rows (empty Read later / No folder) */
.nav-list li[hidden] { display: none; }

/* v50: the Librarian */
.lib-status { display: flex; flex-direction: column; gap: 0.35rem; margin: 0.4rem 0 0.6rem; }
.lib-status:empty { display: none; }
.lib-line { display: block; }
.tidy-librarian {
  display: flex; align-items: center; gap: 0.8rem;
  margin: 0 0 0.9rem; padding: 0.65rem 0.8rem;
  background: var(--accent-soft); border-radius: 10px; font-size: 0.92rem;
}
.tidy-librarian[hidden] { display: none; }
.tidy-librarian span { flex: 1; }
.tidy-librarian .btn { flex: none; }
.tribute { margin: 0.6rem 0 0.2rem; font-style: italic; color: var(--muted); font-size: 0.92rem; }
.invite-actions { display: inline-flex; gap: 0.4rem; flex-wrap: wrap; justify-content: flex-end; }
section.owner-only[hidden] { display: none; }

/* v55: Sign out sits beside "Signed in as" at the top of Settings */
.account-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.account-row p { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.account-row .btn { flex: none; }

/* v56: the Librarian's line under Tidy up in the sidebar */
.side-librarian { margin: 0.35rem 0 0.2rem; padding-left: 0.6rem; font-size: 0.9rem; }
.side-librarian[hidden] { display: none; }
.side-lib-note { color: var(--muted); font-style: italic; }
.side-lib-link {
  border: 0; background: none; padding: 0; cursor: pointer;
  font: inherit; color: var(--accent); text-decoration: underline; text-underline-offset: 2px;
}
.side-lib-link:hover { color: var(--brand); }

/* v57: Ask the Librarian is its own Organize-mode button, under Tidy up */
.lib-btn { margin-top: 0.5rem; background: var(--card); border-color: var(--line); }
.lib-btn:disabled { color: var(--muted); font-weight: 400; font-style: italic; cursor: default; opacity: 1; }
/* "The Librarian is working…": pastel blue for "in progress", so it isn't mistaken for the green "you are here" */
.lib-btn.working { background: var(--blue-bg); border-color: var(--blue-line); color: var(--blue-ink); font-weight: 400; font-style: italic; }
.lib-btn.working:hover { background: var(--blue-bg-hover); border-color: var(--blue-line-hover); }

/* v58: Ask the Librarian sits above Tidy up; the welcome card */
.lib-btn { margin-top: 1rem; }
.lib-btn:not([hidden]) + .tidy-btn { margin-top: 0.5rem; }
.lib-welcome .btn { flex: none; }

/* v59: Tidy up's "that's everything for now" ending */
.tidy-finished-note { margin: 0.3rem 0 1rem; }

/* v61: confirmation text can have a paragraph break */
#confirm-text { white-space: pre-line; }

/* v64: Tidy up note while the Librarian works */
.tidy-lib-note { margin: -0.2rem 0 0.9rem; padding: 0.55rem 0.8rem; background: var(--accent-soft); border-radius: 10px; font-size: 0.92rem; font-style: italic; color: var(--accent); }
.tidy-lib-note[hidden] { display: none; }

/* v65: Review suggestions page */
.review[hidden] { display: none; }
.review-back { margin: -0.3rem 0 0.4rem; }
.review-intro { margin: 0 0 1.1rem; max-width: 46rem; }
.rv-group { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 0.75rem 1rem 0.55rem; margin-bottom: 0.9rem; }
.rv-head { display: flex; align-items: center; gap: 0.5rem; padding-bottom: 0.55rem; margin-bottom: 0.3rem; border-bottom: 1px solid var(--line); font-weight: 700; }
.rv-head .sub-icon { color: var(--muted); }
.rv-name { min-width: 0; }
.rv-count { color: var(--muted); font-weight: 400; font-size: 0.9rem; }
.rv-new { font-size: 0.75rem; font-weight: 700; padding: 0.05rem 0.5rem; border-radius: 999px; background: var(--badge); color: var(--warn-ink); }
.rv-change { margin-left: auto; font-weight: 400; }
.rv-list { list-style: none; margin: 0; padding: 0; }
.rv-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.3rem 0.4rem; border-radius: 8px; }
.rv-row:hover { background: var(--paper); }
.rv-label { display: flex; align-items: baseline; gap: 0.6rem; flex: 1; min-width: 0; cursor: pointer; }
.rv-check { flex: none; transform: translateY(0.1rem); accent-color: var(--brand); }
.rv-title { min-width: 0; overflow-wrap: anywhere; }
.rv-site { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.rv-row.off .rv-title, .rv-row.off .rv-site { color: var(--muted); }
.rv-row-change { border: 0; background: none; padding: 0; font: inherit; font-size: 0.88rem; color: var(--accent); cursor: pointer; opacity: 0; }
.rv-row:hover .rv-row-change, .rv-row-change:focus-visible { opacity: 1; }
@media (hover: none) { .rv-row-change { opacity: 1; } }
.review-bar { position: sticky; bottom: 0; display: flex; align-items: center; gap: 0.5rem; margin-top: 0.5rem; padding: 0.75rem 1rem; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.review-bar[hidden] { display: none; }
.review-bar #review-count { margin-left: 0.6rem; }
.link-btn { border: 0; background: none; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.link-btn[hidden] { display: none; }
.tidy-review { margin: 0.8rem 0 0; }
.review-btn { margin-top: 0.5rem; }
.lib-btn:not([hidden]) + .review-btn, .review-btn:not([hidden]) + .tidy-btn { margin-top: 0.5rem; }
.review-btn.active { background: var(--brand); border-color: var(--brand); color: var(--on-fill); }
.rv-head .sub-icon { background: none; border: 0; width: auto; height: auto; padding: 0; display: inline-flex; color: var(--muted); }

/* ---------- v68: "It works" (confirmed by you) ---------- */
.dot.dot-confirmed { background: transparent; border: 2px solid var(--ok); box-sizing: border-box; }
.fix-row.confirmed-note { color: var(--muted); }

/* ---------- v70: accessibility ---------- */
/* Status dots and stars meet the 3:1 contrast needed to see them (WCAG 1.4.11) */
.dot-moved { background: var(--amber); }
.dot-unknown { background: var(--dim); }
.dot-pending { border-color: var(--dim); }
.star-btn { color: var(--dim); }
.star-btn.on, .home-star { color: var(--amber); }
.star-btn:hover { color: var(--amber); }
.bm .star-btn { opacity: 1; }

/* The page heading keeps its old size; it's now the page's main heading for screen readers */
#view-title { font-size: 1.35rem; }
#view-title:focus { outline: none; }

/* "Skip to your Pagemarks": hidden until reached with the Tab key */
.skip-link {
  position: absolute; left: 1rem; top: -10rem; z-index: 100;   /* far enough up to stay hidden below the demo bar too */
  background: var(--accent-fill); color: var(--on-fill); padding: 0.5rem 0.9rem; border-radius: 8px; text-decoration: none;
}
.skip-link:focus { top: 0.6rem; outline: 2px solid var(--ink); outline-offset: 2px; }

/* Narrow screens and 400% zoom: let rows wrap instead of running off the edge (WCAG 1.4.10) */
.row { flex-wrap: wrap; }
.invite-list li { flex-wrap: wrap; gap: 0.3rem 0.6rem; }
.invite-list li > * { min-width: 0; overflow-wrap: anywhere; }

/* ---------- v71: "May be unsafe" ---------- */
/* A red diamond, so it differs from the round "Broken" dot by shape as well as color */
.dot-unsafe { background: var(--danger); border-radius: 2px; transform: rotate(45deg) scale(0.85); }
.pill-unsafe { background: var(--danger-fill); color: var(--on-fill); }
.fix-row.unsafe-row { color: var(--danger-ink); }
/* Shown even outside Organize: safety matters everywhere */
body:not(.editing) .title-text .pill.pill-unsafe { display: inline-block !important; }
body:not(.editing) .bm-body .fix-row.unsafe-row { display: block !important; }

/* ---------- v72: "Looks different" ---------- */
/* An amber ring, so it differs from the solid amber "Moved" dot */
.dot-changed { background: transparent; border: 2px solid var(--amber); box-sizing: border-box; }

/* ---------- v73: messages stay until you click OK ---------- */
.toast {
  display: flex; align-items: center; gap: 0.9rem; max-width: min(34rem, calc(100vw / var(--z, 1) - 2rem));
  background: var(--card); color: var(--ink); border: 1px solid var(--green-line); border-radius: 10px;
  box-shadow: 0 6px 24px var(--shadow); padding: 0.7rem 0.75rem 0.7rem 1.1rem; font-size: 0.98rem; line-height: 1.45;
}
.toast[hidden] { display: none !important; }
#toast-ok { flex: none; min-width: 3.2rem; }
.update-bar:not([hidden]) ~ .toast { bottom: 5rem; }

/* ---------- v74: "Try Pagemarks" demo ---------- */
.try-it { margin: 1.1rem 0 0; font-size: 0.95rem; color: var(--muted); }
.demo-bar { display: none; }
html.demo .demo-bar {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 0.5rem 1rem;
  background: var(--green-tint); border-bottom: 1px solid var(--green-line); color: var(--ink);
  padding: 0.55rem 1rem; font-size: 0.95rem; text-align: center;
}
/* Things that don't apply to a demo visitor */
html.demo #ext-card, html.demo #ext-section, html.demo #phone-save-section, html.demo #librarian-section, html.demo #lib-welcome,
html.demo #account-row-signout-note { display: none !important; }

/* v75: owner-only Settings sections */
details.owner-only[hidden] { display: none; }

/* ---------- v79: Getting started guide ---------- */
.guide-link { margin: 0 0 1.1rem; padding: 0.6rem 0.9rem; background: var(--green-tint); border: 1px solid var(--green-line); border-radius: 10px; }
/* One welcome card at a time: the guide comes first */
#guide-welcome:not([hidden]) ~ #lib-welcome, #guide-welcome:not([hidden]) ~ #ext-card { display: none !important; }

/* v80: numbered steps in help sections match the bulleted ones */
.howto ol { margin: 0.45rem 0 0.3rem; padding-left: 1.3rem; font-size: 0.9rem; color: var(--ink-2); }
.howto ol ul { font-size: 1em; margin: 0.2rem 0; }
.howto p.muted { font-size: 0.9rem; }

/* v89: the browser button's save window has the same margin on every side.
   The window is now tall enough that the form fits without a scroll bar. */
body.quick #dlg-edit form { padding: 1.5rem; }

/* ---------- v104: the Librarian's two jobs, and the whole-library review ---------- */
.dlg-libchoice { width: min(500px, calc(100vw / var(--z, 1) - 2rem)); }
.lib-choices { display: grid; gap: 0.7rem; margin-top: 0.4rem; }
.lib-choice {
  display: grid; gap: 0.3rem; text-align: left; font: inherit; color: var(--ink); cursor: pointer;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 0.85rem 1rem;
}
.lib-choice strong { font-size: 1.02rem; }
.lib-choice span { color: var(--ink-2); font-size: 0.93rem; line-height: 1.45; }
.lib-choice:hover:not(:disabled) { border-color: var(--green-line-2); background: var(--green-tint); }
.lib-choice:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lib-choice:disabled { cursor: default; opacity: 0.55; }

.lr-undo { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; margin: 0 0 1rem;
  padding: 0.6rem 0.9rem; background: var(--green-tint); border: 1px solid var(--green-line); border-radius: 10px; }
.lr-row { display: flex; align-items: flex-start; gap: 0.75rem; padding: 0.55rem 0.4rem; border-radius: 8px; }
.lr-row + .lr-row { border-top: 1px solid var(--line); border-radius: 0; }
.lr-main { display: grid; gap: 0.15rem; flex: 1; min-width: 0; }
.lr-what { overflow-wrap: anywhere; }
.lr-from { color: var(--muted); font-size: 0.86rem; }
.lr-stale { color: var(--warn-ink); font-size: 0.88rem; }
.lr-why { color: var(--ink-2); font-size: 0.9rem; font-style: italic; }
.lr-actions { display: inline-flex; gap: 0.4rem; flex: none; }
.lr-group-actions { margin-left: auto; font-weight: 400; }
@media (max-width: 560px) {
  .lr-row { flex-direction: column; }
  .lr-group-actions { margin-left: 0; }
  .rv-head { flex-wrap: wrap; }
  #libreview-bar, #libreview-done { flex-wrap: wrap; }
  #libreview-left, #libreview-done-text { flex-basis: 100%; }
}

/* ---------- v110: a quieter sidebar scrollbar ----------
   Thin and pale while you're elsewhere; it darkens when the pointer is over the sidebar,
   and darker still while you drag it, so it's easy to find and grab when you want it. */
.sidebar { scrollbar-width: thin; scrollbar-color: var(--scroll) transparent; scrollbar-gutter: stable; }
.sidebar:hover { scrollbar-color: var(--scroll-hover) transparent; }
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-button { display: none; height: 0; }
.sidebar::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 8px; }
.sidebar:hover::-webkit-scrollbar-thumb { background: var(--scroll-hover); }
.sidebar::-webkit-scrollbar-thumb:active { background: var(--scroll-active); }

/* ---------- v115: the browser button's save window ----------
   Fits the window without scrolling. If something extra appears (such as "Already saved"),
   only the fields scroll; Cancel and Save stay in view at the bottom, with even margins all round. */
body.quick #dlg-edit { overflow: hidden; }
body.quick #dlg-edit form {
  height: 100%; max-width: none; margin: 0; box-sizing: border-box;
  display: flex; flex-direction: column;
  padding: 1.1rem 1.5rem 0; overflow-y: auto;
}
body.quick .quick-brand { margin: 0 0 0.7rem; padding-bottom: 0.6rem; }
body.quick #dlg-edit h2 { margin: 0 0 0.6rem; }
body.quick #dlg-edit label { margin-bottom: 0.6rem; }
body.quick #dlg-edit .two-col { gap: 0 1rem; }
body.quick #dlg-edit .suggest-line { margin: -0.2rem 0 0.6rem; }
body.quick #dlg-edit label.check { margin-bottom: 0; }
body.quick #dup-warning { margin: -0.2rem 0 0.6rem; padding: 0.45rem 0.7rem; font-size: 0.9rem; }
body.quick #dlg-edit .dlg-actions {
  position: sticky; bottom: 0; margin-top: auto;
  padding: 0.9rem 0 1.5rem; background: var(--card);
}

/* v116: in the save window, the page behind the form never scrolls (its scroll bar did nothing useful).
   Only the form scrolls, and only when it must, with a slim scroll bar of its own. */
html:has(body.quick), body.quick { overflow: hidden; height: 100%; }
body.quick #screen-app { display: none; }
body.quick #dlg-edit form { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }

/* v119: the save window, spaced evenly and calmly.
   One fixed layout: "Already saved" sits where the Suggested line would be, so nothing grows,
   and Cancel and Save follow the form instead of being pushed to the bottom. */
body.quick #dlg-edit form { padding: 0.9rem 1.5rem 0; }
body.quick .quick-brand { margin: 0 0 0.75rem; padding-bottom: 0.6rem; }
body.quick #dlg-edit h2 { margin: 0 0 0.8rem; }
body.quick #dlg-edit label { margin-bottom: 0.7rem; }
body.quick #dlg-edit .suggest-line, body.quick #dup-warning { margin: -0.2rem 0 0.7rem; min-height: 2rem; }
body.quick #dup-warning { display: flex; align-items: center; flex-wrap: wrap; gap: 0 0.3rem; padding: 0.3rem 0.7rem; font-size: 0.9rem; }
body.quick #dup-warning[hidden] { display: none; }
body.quick #dlg-edit .dlg-actions { margin-top: 0.3rem; padding: 0.5rem 0 1.5rem; }
body.quick #dup-warning:not([hidden]) + #f-suggest { display: none !important; }

/* v119: a field inside a row (Title + Look up) sits the same distance below its label as the others,
   and Look up is exactly as tall as the Title field */
dialog label .row { align-items: stretch; }
dialog label .row input { margin-top: 0; }
dialog label .row .btn { display: flex; align-items: center; }

/* v121: import details */
.import-details { margin-top: 0.4rem; font-size: 0.92rem; }
.import-details summary { cursor: pointer; color: var(--accent); }
.import-details .imp-group { margin: 0.6rem 0; }
.import-details .imp-head { font-weight: 700; margin: 0 0 0.25rem; }
.import-details ul { margin: 0; padding-left: 1.4em; max-height: 14rem; overflow-y: auto; }
.import-details li { margin: 0.15rem 0; overflow-wrap: anywhere; }
.import-details .imp-why { color: var(--warn-ink); }

/* v123: owner's allowed sites */
.mini-head { font-size: 0.85rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 0.8rem 0 0.3rem; }
.allowed-list { list-style: none; padding: 0; margin: 0 0 0.6rem; }
.allowed-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.5rem; padding: 0.3rem 0; border-bottom: 1px solid var(--line); }
#allowed-add input { max-width: 16rem; }
#allowed-add { padding: 0; margin: 0.4rem 0 0; max-width: none; }
.lr-section { font-size: 1.05rem; margin: 1.6rem 0 0.6rem; }

/* ---------- v128: Settings, one calm text size throughout ----------
   Body text, lists, inputs and status lines share one petite size; buttons share one size;
   sections and buttons get even, airy spacing. Section headings and the How-it-works
   summaries keep their own styles. */
#dlg-settings { --set-text: 0.92rem; --set-btn: 0.86rem; }
#dlg-settings p, #dlg-settings li, #dlg-settings label, #dlg-settings .status,
#dlg-settings .guide-link, #dlg-settings .tribute, #dlg-settings .owner-note,
#dlg-settings input[type="text"], #dlg-settings input[type="email"], #dlg-settings input[type="file"],
#dlg-settings .allowed-list li, #dlg-settings #invite-list li {
  font-size: var(--set-text); line-height: 1.6;
}
#dlg-settings p { margin: 0 0 0.75rem; }
#dlg-settings section { margin-top: 1.4rem; padding: 1.4rem 0 0; }
#dlg-settings section > :last-child { margin-bottom: 0; }
#dlg-settings section h3 { margin: 0 0 0.75rem; }
#dlg-settings .btn { font-size: var(--set-btn); padding: 0.42rem 0.9rem; line-height: 1.3; }
#dlg-settings .btn.small { font-size: var(--set-btn); padding: 0.32rem 0.75rem; }
#dlg-settings #btn-close-settings { padding: 0.32rem 0.6rem; }
#dlg-settings .row { gap: 0.6rem; }
#dlg-settings p.row, #dlg-settings div.row { margin: 0.4rem 0 0.75rem; }
#dlg-settings input[type="text"], #dlg-settings input[type="email"] { padding: 0.45rem 0.75rem; }
#dlg-settings .guide-link { margin: 1rem 0 0.25rem; padding: 0.7rem 1rem; }
#dlg-settings .mini-head { font-size: 0.75rem; letter-spacing: 0.08em; margin: 1rem 0 0.35rem; }
#dlg-settings .refusal-note { font-size: 0.84rem; }
#dlg-settings .owner-badge { font-size: 0.68rem; }

/* v138: Quiet mode, for screen sharing. Home on its own, as a centered page of links:
   no header, sidebar, welcome cards, Librarian or update note. Alt+Q turns it off. */
body.quiet .topbar, body.quiet .sidebar, body.quiet .skip-link, body.quiet .demo-bar,
body.quiet #btn-filters, body.quiet #sort-wrap, body.quiet #bulk-bar, body.quiet #folder-tools, body.quiet .edit-only,
body.quiet #guide-welcome, body.quiet #lib-welcome, body.quiet #ext-card,
body.quiet #btn-side-librarian, body.quiet #btn-libreview, body.quiet #update-bar { display: none !important; }
html body.quiet .layout { display: block; max-width: 1060px; padding: 4.5rem 2.5rem 4rem; }
body.quiet .main-head { margin-bottom: 1.6rem; }
body.quiet #view-title { font-size: 1.9rem; }
@media (max-width: 760px) { html body.quiet .layout { padding: 2rem 1.1rem 3rem; } }
#dlg-settings .key { display: inline-block; padding: 0 0.35rem; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; font-size: 0.82rem; line-height: 1.45; background: var(--card); }

/* ---------- v131: themes ----------
   Every color the app uses has a name here. Light is the original Pagemarks look; Dark is a warm
   near-black with soft off-white text. Settings → Display chooses Light, Dark or "Match my device". */
:root {
  color-scheme: light;
  --on-fill: #fff;
  --accent-fill: #2f5d50; --accent-fill-hover: #264e43;
  --ink-2: #4a463f; --dim: #8f897d;
  --line-strong: #cfc8b8;
  --hover: #f1ede4; --hover-soft: #fdfcf9; --picked: #fbfdfb;
  --green-line: #cfe0d6; --green-line-2: #b9d3c3; --green-tint: #eef5f0;
  --pin-bg: #e6f0ea; --pin-hover: #dbe9e0;
  --amber: #a87a12; --ok: #3c8d5a; --dot-broken: #c0392b;
  --danger-fill: #a33a2b; --danger-fill-hover: #8e2e22; --danger-ink: #8e2a1e;
  --danger-soft: #f8e1dd; --danger-line: #e7c8c2;
  --badge: #f3e2b3; --badge-line: #d9c48f;
  --lav-bg: #f1ecfa; --lav-line: #b9a8e3; --lav-over: #e4dbf6; --lav-ink: #56488a;
  --blue-bg: #eaf1fb; --blue-bg-hover: #dde8f7; --blue-line: #c9d9ef; --blue-line-hover: #b4cae8; --blue-ink: #3d5a80;
  --scroll: #e2dccf; --scroll-hover: #bfb6a3; --scroll-active: #9c937f;
  --shadow-sm: rgba(60, 50, 30, 0.06); --shadow: rgba(40, 30, 10, 0.15); --shadow-lg: rgba(40, 30, 10, 0.18);
  --backdrop: rgba(40, 36, 28, 0.35);
}
html[data-theme="dark"] {
  color-scheme: dark;
  --paper: #161513; --card: #201f1c; --ink: #ebe6db; --muted: #a8a194; --line: #36332e;
  --accent: #8fc7ae; --accent-soft: #223129;
  --warn-bg: #352b16; --warn-ink: #ecc977; --danger: #ec8b79;
  --brand: #3f8069; --brand-hover: #4b8f77;
  --on-fill: #fff;
  --accent-fill: #3f8069; --accent-fill-hover: #4b8f77;
  --ink-2: #d2ccc0; --dim: #8d8679;
  --line-strong: #4d4942;
  --hover: #2b2925; --hover-soft: #26241f; --picked: #1f2723;
  --green-line: #31493f; --green-line-2: #3e5f51; --green-tint: #1c2722;
  --pin-bg: #213a2f; --pin-hover: #29473a;
  --amber: #dcae45; --ok: #63b984; --dot-broken: #e8685a;
  --danger-fill: #b0473a; --danger-fill-hover: #c25546; --danger-ink: #f2a596;
  --danger-soft: #3b211c; --danger-line: #683329;
  --badge: #4a3c1b; --badge-line: #77632f;
  --lav-bg: #29233d; --lav-line: #7867b3; --lav-over: #352d52; --lav-ink: #cdc1f2;
  --blue-bg: #1b2532; --blue-bg-hover: #222f40; --blue-line: #36506f; --blue-line-hover: #45638a; --blue-ink: #b0c9e8;
  --scroll: #3a3732; --scroll-hover: #5a564e; --scroll-active: #77726a;
  --shadow-sm: rgba(0, 0, 0, 0.35); --shadow: rgba(0, 0, 0, 0.5); --shadow-lg: rgba(0, 0, 0, 0.55);
  --backdrop: rgba(0, 0, 0, 0.6);
}

/* ---------- v131: larger text sizes ----------
   With a larger text size the page is zoomed, but the browser still picks layouts from the real
   window width. These copies of the narrow-screen rules apply when the zoomed width is narrow. */
html.mw760 body { font-size: 16px; }
html.mw760 .topbar { flex-wrap: wrap; gap: 0.6rem; padding: 0.7rem 1rem; }
html.mw760 .search-wrap { order: 3; flex-basis: 100%; max-width: none; }
html.mw760 .brand { margin-right: auto; }
html.mw760 .layout { grid-template-columns: 1fr; padding: 1rem; gap: 1rem; }
html.mw760 .sidebar { position: static; max-height: none; display: none; border-bottom: 1px solid var(--line); padding-bottom: 1rem; }
html.mw760 .sidebar.open { display: block; }
html.mw760 .filters-btn { display: inline-block; }
html.mw760 .main-head { flex-wrap: wrap; }
html.mw760 .sidebar h3 { margin-top: 1rem; }
html.mw760 .bm { grid-template-columns: 18px 32px 1fr; }
html.mw760 .bm-actions { grid-column: 3; }
html.mw760 .bulk-bar { flex-wrap: wrap; }
html.mw760 .two-col { grid-template-columns: 1fr; gap: 0; }
html.mw760 dialog form, html.mw760 .settings { padding: 1.4rem 1.25rem; }
html.mw760 .bulk-count.hint-text { display: none; }
html.mw760 .bulk-bar { top: 112px; }
html.mw760 body:not(.editing) .bm { grid-template-columns: 32px 1fr; }
html.mw760 .topbar { padding: 0.7rem 0; }
html.mw760 .topbar-inner { display: flex; flex-wrap: wrap; gap: 0.6rem; padding: 0 1rem; }
html.mw760 .topbar-inner .brand { margin-right: auto; }
html.mw760 .topbar-main { display: contents; }
html.mw760 .topbar-main .search-wrap { order: 3; flex-basis: 100%; margin-right: 0; }
html.mw760 .topbar-inner { gap: 0.6rem 0.4rem; }
html.mw760 .topbar-inner .brand { font-size: 1.12rem; gap: 0.3rem; }
html.mw760 .topbar-main > .btn { padding: 0.42rem 0.7rem; }
html.mw760 .topbar-main > .icon-btn { padding: 0.42rem 0.6rem; }
html.mw760 .topbar-main > .btn { height: 2.3rem; }
html.mw760 .topbar-main > .icon-btn { width: 2.3rem; padding: 0; }
html.mw760 .tiles { grid-template-columns: 1fr 1fr; }
html.mw760 body:not(.editing) .bm { grid-template-columns: 32px 1fr auto; }
html.mw760 body.editing .bm-side { grid-column: 3; }
html.mw760 .home-cols { columns: 1; }
html.mw700 .ext-card { flex-wrap: wrap; }
html.mw700 .ext-card-text { flex-basis: calc(100% - 36px - 3.5rem); }
html.mw700 .ext-card .btn { margin-left: calc(36px + 0.9rem); }
html.mw700 .ext-card .btn + .btn { margin-left: 0; }
html.mw560 .lr-row { flex-direction: column; }
html.mw560 .lr-group-actions { margin-left: 0; }
html.mw560 .rv-head { flex-wrap: wrap; }
html.mw560 #libreview-bar, html.mw560 #libreview-done { flex-wrap: wrap; }
html.mw560 #libreview-left, html.mw560 #libreview-done-text { flex-basis: 100%; }

/* ---------- v131: Settings → Display ---------- */
#dlg-settings fieldset.seg-group { border: 0; margin: 1rem 0 0; padding: 0; min-width: 0; }
#dlg-settings fieldset.seg-group legend { padding: 0; margin-bottom: 0.45rem; font-weight: 700; font-size: var(--set-text, 0.92rem); }
#dlg-settings fieldset.seg-group > p.muted { margin: 0 0 0.5rem; }
#dlg-settings fieldset.seg-group label.check { margin-top: 0.35rem; }
.seg { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.seg label {
  display: inline-flex; align-items: center; cursor: pointer; font-weight: 400;
  padding: 0.32rem 0.85rem; border: 1px solid var(--line); border-radius: 999px;
  background: var(--card); color: var(--ink); font-size: var(--set-btn, 0.86rem); line-height: 1.4;
}
.seg label:hover { border-color: var(--line-strong); background: var(--hover-soft); }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--accent-soft); border-color: var(--green-line-2); color: var(--accent); font-weight: 700; }
.seg label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* The holiday line beside the Home heading: small, muted, never in the way */
.holiday-line { color: var(--muted); font-style: italic; font-size: 0.95rem; margin-right: auto; }
/* Heading and holiday line sit on the same baseline */
.main-head:has(.holiday-line:not([hidden])) #view-title, .holiday-line { align-self: baseline; }
.holiday-icon { font-style: normal; }
body.quiet .holiday-line { display: none; }

/* v136: faith checkboxes sit in one indented row under "Holidays of all faiths" */
#dlg-settings .faith-row { display: flex; flex-wrap: wrap; gap: 0.2rem 1.2rem; margin-left: 1.6rem; }
.holiday-sep { font-style: normal; }
/* Owner-only list of every holiday */
.holiday-all { margin-top: 0.9rem; }
.holiday-all summary { cursor: pointer; font-size: var(--set-text, 0.92rem); }
.holiday-all-list { list-style: none; margin: 0.6rem 0 0; padding: 0; font-size: var(--set-text, 0.92rem); }
.holiday-all-list li { display: grid; grid-template-columns: 7.5rem 1fr auto; gap: 0.75rem; padding: 0.28rem 0; border-bottom: 1px solid var(--line); }
.holiday-all-list li.hl-year { display: block; border: 0; padding-top: 0.8rem; font-weight: 700; }
.hl-date, .hl-kind { color: var(--muted); }
.hl-kind { font-size: 0.85em; }
#dlg-settings .faith-row label.check { margin-top: 0.2rem; }
.holiday-all-list li { align-items: baseline; }
#dlg-settings label.check input[type="checkbox"] { accent-color: var(--brand); }

/* v139: the save window's Add to Home · Pin · Read later, side by side */
.check-row { display: flex; flex-wrap: wrap; gap: 0.35rem 1.6rem; }
.check-row label.check { margin: 0; }
body:not(.quick) .check-row .quick-only { display: none; }
#f-star, #f-pin, #f-later { accent-color: var(--brand); }

/* ---------- v143: Home columns, plus Wide cards in their own rows above or below them ---------- */
.home { display: block; }
.home-cols { display: flex; align-items: flex-start; gap: 1rem; }
.home-wide { display: block; }
/* A wide card lists its Pagemarks in two columns, down the left first, then the right;
   one column on narrow screens */
.home-group.wide .home-list { columns: 2; column-gap: 1.6rem; }
.home-group.wide .home-row { break-inside: avoid; }
@media (max-width: 760px) { .home-group.wide .home-list { columns: 1; } }
html.mw760 .home-group.wide .home-list { columns: 1; }
/* Organize only: Wide · Top · Bottom, in a small row at the foot of a pinned card */
.hw-controls { display: flex; gap: 0.35rem; justify-content: flex-end; margin: 0.45rem 0.4rem 0.2rem; padding-top: 0.5rem; border-top: 1px solid var(--line); }
.hw-btn { padding: 0.12rem 0.6rem; font-size: 0.8rem; line-height: 1.3; }
.hw-btn.on { background: var(--pin-bg); border-color: var(--green-line-2); color: var(--accent); }
.hw-btn.on:hover { background: var(--pin-hover); }

/* v149: "1.) " at the start of a title sets your own order; hidden except in Organize */
.order-num { display: none; }
body.editing .order-num { display: inline; color: var(--dim); font-weight: 400; }

/* ---------- v152: Settings, trimmed ---------- */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
#dlg-settings .admin-link { display: flex; align-items: center; gap: 0.6rem; width: 100%; margin: 0.9rem 0 0; padding: 0.55rem 0.8rem;
  border: 1px dashed var(--badge-line); background: var(--badge); border-radius: 8px; color: var(--ink); font: inherit; font-size: var(--set-text, 0.92rem); text-align: left; cursor: pointer; }
#dlg-settings .admin-link:hover { filter: brightness(0.97); }
#dlg-settings fieldset.seg-group { margin-top: 0.75rem; }
#dlg-settings fieldset.seg-group legend { margin-bottom: 0.35rem; }
#dlg-settings .hol-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 1.3rem; }
#dlg-settings .hol-row label.check { margin: 0; }
#dlg-settings .faith-row { margin: 0.5rem 0 0 0; }
#dlg-settings .how-link, #dlg-settings .link-btn.how-link { color: var(--accent); font-size: var(--set-text, 0.92rem); white-space: nowrap; text-decoration: underline; text-underline-offset: 2px; }
#dlg-settings details.line-how { margin: 0.4rem 0; }
#dlg-settings details.line-how > summary { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; list-style: none; cursor: pointer; color: var(--muted); font-size: var(--set-text, 0.92rem); }
#dlg-settings details.line-how > summary::-webkit-details-marker { display: none; }
#dlg-settings details.line-how[open] > summary .how-link { visibility: hidden; }
#dlg-settings details.line-how > :not(summary) { margin-left: 0.2rem; }
#dlg-settings .line { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: 0.5rem 0; }
#dlg-settings .line > p { margin: 0; }
#dlg-settings .row-tight { display: inline-flex; gap: 0.4rem; }
.file-btn { position: relative; overflow: hidden; cursor: pointer; display: inline-block; }
.file-btn input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.file-btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
#dlg-settings .help-links { display: flex; flex-wrap: wrap; gap: 0.35rem 1.1rem; font-size: var(--set-text, 0.92rem); }
#dlg-settings .help-links a { color: var(--accent); }

/* ---------- v152: Admin, the owner's page ---------- */
body.admin-open .layout { display: none; }
.admin-page { max-width: 1060px; margin: 0 auto; padding: 2.2rem 2rem 4rem; }
.admin-top { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.6rem; }
.admin-top h1 { font-size: 1.7rem; margin: 0; display: flex; align-items: center; gap: 0.7rem; }
.admin-back { color: var(--accent); font-size: 1rem; }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; align-items: start; }
.admin-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.3rem; }
.admin-card h2 { font-size: 1.1rem; margin: 0 0 0.35rem; }
.admin-card p { margin: 0.35rem 0; }
.admin-card .row { display: flex; gap: 0.5rem; margin: 0.6rem 0; }
.admin-card .row input { flex: 1; min-width: 0; }
.admin-card details { margin-top: 0.5rem; }
.admin-card details summary { cursor: pointer; color: var(--accent); }
.admin-card .owner-note .owner-badge:empty { display: none; }
.admin-wide { grid-column: 1 / -1; }
/* Admin → AI for the Librarian */
#ai-card { min-width: 0; }   /* keeps the card within a phone screen; a wide table scrolls inside it */
.ai-why { margin: 0 0 0.9rem; }
.ai-table-wrap { overflow-x: auto; }
.ai-table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
.ai-table th, .ai-table td { text-align: left; padding: 0.4rem 0.9rem 0.4rem 0; border-bottom: 1px solid var(--line); vertical-align: baseline; }
.ai-table th { font-weight: 700; color: var(--muted); font-size: 0.85rem; }
.ai-table .num { text-align: right; white-space: nowrap; }
.ai-others .ai-table td:first-child { white-space: nowrap; }
.ai-table th:last-child, .ai-table td:last-child { padding-right: 0; }
.ai-table tbody tr:last-child td { border-bottom: 0; }
.ai-tag { font-size: 0.72rem; letter-spacing: 0.03em; padding: 0.05rem 0.4rem; border-radius: 999px; background: var(--accent-soft, #e6efe9); color: var(--accent); white-space: nowrap; }
.ai-others { margin-top: 1rem; }
.ai-foot, .ai-status { font-size: 0.88rem; margin: 0.7rem 0 0; }
@media (max-width: 560px) {
  .ai-table { font-size: 0.84rem; }
  .ai-table th { font-size: 0.78rem; }
  .ai-table th, .ai-table td { padding-right: 0.55rem; }
  .ai-table th.num { white-space: normal; }
}

.admin-card .mini-head { font-size: 0.95rem; margin: 0.8rem 0 0.2rem; }
@media (max-width: 760px) { .admin-grid { grid-template-columns: 1fr; } .admin-page { padding: 1.4rem 1rem 3rem; } }
html.mw760 .admin-grid { grid-template-columns: 1fr; }
/* v153: "Choose faiths" sits on the same text baseline as Civic · Everyday · Faiths */
#dlg-settings .hol-row { align-items: baseline; }
#dlg-settings .hol-row label.check { align-items: baseline; }
#dlg-settings .hol-row label.check input { align-self: center; }
#dlg-settings .hol-row .how-link { font-size: var(--set-text, 0.92rem); line-height: 1.6; padding: 0; }

/* Not secure (http): a small open padlock, beside the title in Organize and in Link health */
.http-mark { display: inline-flex; align-items: center; color: var(--muted); margin-left: 0.4rem; vertical-align: -0.1em; }
.http-mark svg { display: block; }
.health-list .http-mark { margin: 0 calc(0.65rem + 4px) 0 4px; vertical-align: 0; }
.https-note { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; margin: -0.4rem 0 0.95rem; font-size: 0.9rem; color: var(--muted); }
.https-note[hidden] { display: none; }
.https-note .http-mark { margin-left: 0; }
.https-note button { font: inherit; background: none; border: 0; color: var(--accent); text-decoration: underline; cursor: pointer; padding: 0; }
body.quick #dlg-edit .https-note { margin: -0.3rem 0 0.6rem; }

/* ---------- v161: Font (Settings → Display) ----------
   Gentium Plus is the default. The others load only for people who choose them.
   Everything follows the choice, the Pagemarks name beside the logo included. */
html[data-font="literata"] { --font: "Literata", Georgia, serif; }
html[data-font="atkinson"] { --font: "Atkinson Hyperlegible", system-ui, sans-serif; }

/* ---------- v161: site icons in Dark mode ----------
   Many icons are dark shapes on a see-through background and vanish on a dark tile,
   so in Dark mode every icon sits on a soft, slightly dimmed paper-colored tile.
   (A tile showing a letter instead keeps the dark look.) */
html[data-theme="dark"] .fav:has(img) { background: #d8d2c5; }
/* The Font choices take two lines: keep the lines close, and the usual space below the group */
.seg-wrap { row-gap: 0.45rem; margin-bottom: 0.95rem; }
.seg-wrap label { margin-bottom: 0; }

/* ---------- v163: lists as folder cards, one column ----------
   Every list shows its Pagemarks grouped by folder, in cards like Home's, stacked in one column.
   Inside a card, Pagemarks are rows divided by thin lines instead of boxes of their own. */
.list-cards { display: block; }
.list-group { margin: 0 0 1rem; padding: 0.85rem 0.6rem 0.6rem; }
.list-group .home-group-title { margin-bottom: 0; }
.list-group .bm-list { gap: 0; }
.list-group .bm {
  background: transparent; border: 0; border-radius: 0;
  border-top: 1px solid var(--line); padding: 0.85rem 0.5rem;
}
.list-group .bm:first-child { border-top: 0; }
.list-group .bm:hover { border-color: var(--line); background: var(--hover-soft); }
.list-group .bm.picked { background: var(--picked); }
.list-group .bm.pinned { border-color: var(--line); }
.list-group .home-hint { margin: 0.6rem 0.5rem 0.55rem; }
/* A card you can drag Pagemarks onto (Organize) */
.list-group.drop-over { border-color: var(--accent); }

/* ---------- v163: header buttons and the line-drawn gear ---------- */
.icon-btn svg { display: block; width: 19px; height: 19px; }
@media (max-width: 760px) {
  .topbar-main > .btn { height: 2rem; padding: 0 0.65rem; font-size: 0.92rem; }
  .topbar-main > .icon-btn { width: 2rem; padding: 0; }
  .topbar-main > .icon-btn svg { width: 17px; height: 17px; }
}
html.mw760 .topbar-main > .btn { height: 2rem; padding: 0 0.65rem; font-size: 0.92rem; }
html.mw760 .topbar-main > .icon-btn { width: 2rem; padding: 0; }
html.mw760 .topbar-main > .icon-btn svg { width: 17px; height: 17px; }
/* Rows line up with the card's heading rule; no shading on hover (the title underlines instead) */
.list-cards .list-group .bm { margin: 0 0.4rem; padding: 0.6rem 0; }
.list-group .bm:hover { background: transparent; }
.list-cards .list-group .bm.picked { margin: 0; padding: 0.6rem 0.4rem; border-radius: 8px; }
.list-group .bm.picked + .bm { border-top-color: transparent; }

/* ---------- v164 ----------
   Folder picker: its list's height limit now allows for Text size (the page is zoomed), so at
   Largest it no longer fills the whole window. */
.pick-list { max-height: min(calc(52vh / var(--z, 1)), 420px); }
/* Save window: rows never squeeze when space is short (that made "Already saved" run into the
   checkboxes); the form scrolls instead, with Cancel and Save staying in view. */
body.quick #dlg-edit form > * { flex-shrink: 0; }

/* ---------- v165: Suggested folders sit with Folder ----------
   On a computer, Folder and Tags are side by side and Suggested runs across below both.
   On a phone they stack, so Suggested (or "Already saved") moves up, right under Folder. */
.two-col { gap: 0 1rem; }
.two-col > .suggest-line, .two-col > #dup-warning { grid-column: 1 / -1; }
@media (max-width: 760px) {
  .two-col > label:first-child { order: 1; }
  .two-col > .suggest-line, .two-col > #dup-warning { order: 2; }
  .two-col > label:nth-child(2) { order: 3; }
}
html.mw760 .two-col > label:first-child { order: 1; }
html.mw760 .two-col > .suggest-line, html.mw760 .two-col > #dup-warning { order: 2; }
html.mw760 .two-col > label:nth-child(2) { order: 3; }
/* v165: no extra space between rows inside a card (the calm view's 0.6rem list gap was adding to
   the bottom of every row but the last). The dividing line and the row padding do the spacing. */
.list-cards .list-group .bm-list { gap: 0; }
/* Equal visible space above and below each row's text (measured to the ink, not the boxes),
   and the last row ends the card with the same space as the rows above it */
.list-cards .list-group .bm { padding: 0.5rem 0 0.75rem; }
.list-cards .list-group .bm.picked { padding: 0.5rem 0.4rem 0.75rem; }
.list-cards .list-group { padding-bottom: 0; }

/* ---------- v166: one button style in Settings ----------
   Every button is the same height, corners and text size. */
#dlg-settings .btn:not(.icon-btn) {
  font-size: var(--set-btn, 0.86rem); padding: 0 0.8rem; min-height: 2.05rem; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center; line-height: 1.2;
}
#dlg-settings .admin-link {
  display: inline-flex; width: auto; margin: 0.9rem 0 0; min-height: 2.05rem; padding: 0 0.8rem;
  border: 1px solid var(--line); border-radius: 8px; background: var(--card); font-size: var(--set-btn, 0.86rem);
}
#dlg-settings .admin-link:hover { filter: none; border-color: var(--line-strong); background: var(--hover-soft); }

/* ---------- v167: the Display choices are radio buttons ----------
   Text size, Appearance and Font use plain round radio buttons, laid out exactly like the Holidays
   checkboxes below them: words with a small dot, the chosen one filled in green. */
#dlg-settings label.check input[type="radio"] { accent-color: var(--brand); }
/* Each heading sits close to its own choices, with clearly more space between groups */
#dlg-settings fieldset.seg-group { margin-top: 1.15rem; }
#dlg-settings fieldset.seg-group legend { margin-bottom: 0.3rem; }
#dlg-settings fieldset.seg-group .hol-row label.check { margin-top: 0; }
/* On a phone, radio choices are a short list, one per line */
@media (max-width: 480px) {
  #dlg-settings .radio-row { flex-direction: column; align-items: flex-start; gap: 0.4rem; }
}
html.mw560 #dlg-settings .radio-row { flex-direction: column; align-items: flex-start; gap: 0.4rem; }

/* ---------- v168: Settings details ---------- */
/* Help: the links separated by quiet middle dots */
#dlg-settings .help-links { gap: 0.35rem 0.4rem; align-items: baseline; }
/* On a phone the links don't fit on one line: list them one per line instead, no dots */
@media (max-width: 560px) {
  #dlg-settings .help-links { flex-direction: column; gap: 0.45rem; }
  #dlg-settings .help-links .dot-sep { display: none; }
}
html.mw560 #dlg-settings .help-links { flex-direction: column; gap: 0.45rem; }
html.mw560 #dlg-settings .help-links .dot-sep { display: none; }
#dlg-settings .help-links .dot-sep { color: var(--muted); }
/* The Librarian: the visits left in bold (the line in memory of Bill is in italics) */
.lib-line.lib-left { font-weight: 700; }
/* Under Download a copy: what each file is for */
#dlg-settings .export-note { margin: 0.1rem 0 0; }
/* v171: "Either one uses one visit." under the Librarian's choice heading */
.dlg-libchoice .lib-choice-note { margin: -0.4rem 0 0.9rem; font-size: 0.92rem; }

/* ---------- v172 ---------- */
/* Organize: visits left, quietly under Ask the Librarian */
.side-lib-left { margin: 0.35rem 0 0; text-align: center; font-size: 0.85rem; color: var(--muted); }

/* A calm first visit: one card, two ways to begin (looks like the Librarian's choices) */
.first-visit {
  max-width: 34rem; margin: 2.5rem auto 2rem; padding: 2rem 1.75rem 1.5rem; text-align: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
}
.first-visit h2 { margin: 0.75rem 0 0.35rem; font-size: 1.35rem; }
.first-visit > .muted { margin: 0 0 1.25rem; }
.fv-choices { display: grid; gap: 0.75rem; text-align: left; }
.fv-choice {
  display: grid; gap: 0.3rem; font: inherit; color: var(--ink); cursor: pointer; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 0.85rem 1rem;
}
.fv-choice strong { font-size: 1.02rem; }
.fv-choice span { color: var(--ink-2); font-size: 0.93rem; line-height: 1.45; }
.fv-choice:hover { border-color: var(--green-line-2); background: var(--green-tint); }
.fv-choice:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.first-visit .fv-help { margin: 1.1rem 0 0; font-size: 0.9rem; }
.first-visit .fv-help a { color: var(--accent); }
.first-visit .dot-sep { margin: 0 0.45rem; color: var(--muted); }

/* ---------- v174: Quiet when fine, plus a nightly report ----------
   Outside Organize, a Pagemark that works (or hasn't been checked yet) shows no mark, and its title
   lines up with its address. Organize shows every mark. */
body:not(.editing) .bm .dot-ok, body:not(.editing) .bm .dot-pending { display: none; }
.bm-meta .meta-why.why-unknown { color: var(--muted); }
.bm-meta .meta-why.why-broken { color: var(--danger); }
.bm-meta .meta-why.why-moved { color: var(--warn-ink); }
body.editing .bm-meta .meta-why.calm-only { display: none; }
/* Organize sidebar: Working last, below a thin line */
.health-list .health-working { margin-top: 0.35rem; padding-top: 0.35rem; border-top: 1px solid var(--line); }
/* The line at the top of Home */
.health-report {
  display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 0.35rem 0.6rem;
  margin: 0 0 1rem; padding: 0.6rem 0.9rem; font-size: 0.95rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
}
.health-report[hidden] { display: none; }
.health-report .dot { margin-top: 0.5em; }   /* sits beside the first line when the text wraps */
.health-report .health-fix { grid-column: 1 / -1; justify-self: end; color: var(--accent); text-decoration: underline; background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }


/* Settings → The Pagemarks button → Firefox tip: a small drawing of the toolbar */
#dlg-settings .tb-tip { display: block; width: 100%; max-width: 420px; height: auto; margin: 0.5rem 0 0.4rem; }

/* ---------- v191: Text spacing (Settings → Display) ----------
   Roomy adds space between letters, words and lines, for easier reading (many people with dyslexia
   find it helps). Buttons and fields keep their usual height. */
html[data-spacing="roomy"] body { letter-spacing: 0.06em; word-spacing: 0.16em; line-height: 1.8; }
html[data-spacing="roomy"] :is(button, .btn, input, select, textarea, .key) { line-height: 1.3; letter-spacing: inherit; word-spacing: inherit; }   /* browsers reset spacing on buttons and fields */
html[data-spacing="roomy"] :is(.home-title, .bm-title, .tile-title) { line-height: 1.6; }
#dlg-settings .spacing-note { margin: 0.35rem 0 0; font-size: 0.88rem; }

/* ---------- v193: Recently deleted, Use https for all, and the Undo message ---------- */
.list-note { padding: 0.75rem 0.9rem 0.75rem 1.1rem; }
.trash-nav { margin-top: 1.4rem; }
.trash-ic { display: inline-flex; width: 1.1rem; margin-right: 0.45rem; color: var(--muted); vertical-align: -1px; }
.trash-row .pick-space { width: 0; }
.undo-bar { position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%); z-index: 60; }
.undo-bar .undo-close { padding-left: 0.55rem; padding-right: 0.55rem; }
body:has(#undo-bar:not([hidden])) .main { padding-bottom: 5.5rem; }

/* v194: folder picker → + New folder: where the new folder will go */
.pick-new-where { margin: 0.45rem 0 0; font-size: 0.92rem; }

/* ---------- v195: the new-version notice is a full-width band across the bottom ----------
   Always the same place; it stays until you reload, and never blocks a window you're working in. */
.update-bar {
  left: 0; right: 0; bottom: 0; transform: none; justify-content: center; flex-wrap: wrap; gap: 0.6rem 1.2rem;
  border: 0; border-top: 2px solid var(--brand); border-radius: 0; background: var(--green-tint);
  box-shadow: 0 -4px 18px var(--shadow); padding: 0.85rem 1.25rem; font-size: 1.08rem; text-align: center;
}
.update-bar[hidden] { display: none; }
.update-bar .btn { font-size: 1rem; padding: 0.5rem 1.1rem; }
.update-bar .ub-sub { color: var(--muted); }
.update-bar:not([hidden]) ~ .toast { bottom: 6rem; }
body:has(#update-bar:not([hidden])) .main { padding-bottom: 6.5rem; }
