:root{font-family:Tahoma,Arial,sans-serif;color:#172a27;background:#f4f6f0;line-height:1.75;--green:#164e41;--line:#d6e0d7}
*{box-sizing:border-box}
body{margin:0}
a{color:var(--green)}
.masthead{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:.8rem;padding:1rem max(1rem,calc((100% - 65rem)/2));background:#e4ede5;border-bottom:1px solid var(--line)}
.brand{font-weight:bold;text-decoration:none}
nav,.actions,.pagination{display:flex;align-items:center;gap:1rem;flex-wrap:wrap}
main{max-width:65rem;margin:1.5rem auto;padding:0 1rem}
.panel,.hero{background:white;border:1px solid var(--line);border-radius:1rem;padding:clamp(1rem,4vw,2rem);overflow-wrap:anywhere}
.compact{max-width:32rem;margin-inline:auto}
.hero{background:#e4ede5}
.eyebrow{margin:0;color:var(--green)}
h1,h2{margin:0 0 .6rem;line-height:1.4}
h1{font-size:clamp(1.5rem,4vw,2rem)}
h2{font-size:1.15rem}
form p{margin:.65rem 0}
label{display:block;font-weight:bold}
input:not([type=hidden]),textarea{display:block;width:100%;min-height:2.6rem;border:1px solid #84978a;border-radius:.55rem;padding:.45rem .7rem;font:inherit;background:#fff;color:inherit}
input[type=email]{direction:ltr;text-align:start}
button,.button{display:inline-block;border:1px solid var(--green);border-radius:.55rem;padding:.5rem .9rem;font:inherit;background:var(--green);color:#fff;text-decoration:none;cursor:pointer}
.secondary{background:white;color:var(--green)}
.danger{background:#fff;color:#8d231d;border-color:#8d231d}
:focus-visible{outline:3px solid #9a5b11;outline-offset:3px}
.helptext{display:block;font-size:.88rem;color:#43544e}
.errorlist{color:#8d231d}
.search{display:grid;gap:.5rem;margin:1.2rem 0;grid-template-columns:1fr auto}
.search label{grid-column:1/-1}
.grid{display:grid;gap:1rem;grid-template-columns:repeat(auto-fill,minmax(min(100%,14rem),1fr))}
.tag{color:var(--green)}
.pagination{justify-content:center;margin:1rem 0}
dl{display:grid;grid-template-columns:auto 1fr;gap:.35rem 1rem}
dd{margin:0}
.notes{white-space:pre-wrap}

:root{color:#123e63;background:#edf7ff;--green:#226da5;--line:#c7deed;--yellow:#ffda75;--sidebar:#1f6396}
.shell{display:grid;grid-template-columns:245px minmax(0,1fr);max-width:1600px;min-height:100vh;margin-inline:auto}
.sidebar{background:var(--sidebar);padding:22px 18px;color:white}
.sidebar nav{display:grid;gap:.45rem}
.sidebar nav a{color:white;text-decoration:none;padding:.65rem .8rem;border-radius:12px}
.sidebar nav a:hover{background:#ffffff24}
.sidebar nav a[aria-current=page]{background:var(--yellow);color:#123e63;font-weight:bold}
.sidebar .brand{display:block;margin:0 auto 12px}
.brand-logo{display:block;width:100%;max-width:164px;aspect-ratio:560/305;margin:auto;background:url('library-logos-transparent.png') no-repeat 2.55% 35.8% / 316.786% auto}
main{width:100%;max-width:none;min-width:0;margin:0;padding:clamp(1rem,3vw,2rem)}
.panel,.hero,.member-card,.stat{box-shadow:0 3px 12px #153f4e0c}
.hero{background:#e7f4ff;border-radius:22px}
.hero h1{margin-top:.2rem}
.hero h1::after{display:block;content:"";width:86px;height:4px;border-radius:5px;background:var(--yellow);margin-top:.6rem}
.eyebrow{color:#785619;font-size:.9rem}
.muted{color:#4a6476}
.shelf-hero,.profile-hero{display:flex;align-items:center;gap:1rem;flex-wrap:wrap}
.shelf-hero{justify-content:space-between}
.shelf-hero p:last-child{margin-bottom:0}
.stats{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1rem;margin:1rem 0}
.stat{display:flex;align-items:center;gap:.65rem;flex-wrap:wrap;background:white;border:1px solid var(--line);border-radius:17px;padding:1rem}
.stat span,.avatar-placeholder{background:#ffe7a5;color:#614310}
.stat span{font-size:1.35rem;border-radius:.6rem;padding:.2rem .55rem}
.stat strong{font-size:1.55rem}
.shelf-grid{margin-top:1rem;grid-template-columns:repeat(3,minmax(0,1fr))}
.book-card{padding:0;border-radius:16px;min-height:9.5rem}
.book-card-link{display:grid;grid-template-columns:4.4rem 1fr;align-items:center;gap:.8rem;padding:.8rem;color:inherit;text-decoration:none;height:100%;border-radius:inherit}
.book-card-link:hover{background:#f7fbff}
.book-cover{display:grid;place-items:center;min-height:7rem;border-radius:4px 8px 8px 4px;background:#1f6396;color:#ffe7a5;font-size:1.7rem;box-shadow:-3px 0 #c7deed inset}
.book-card p{margin:.25rem 0}
.tag{display:inline-block;background:#e5f2d7;border-radius:.5rem;padding:.08rem .5rem}
.directory,.settings{margin-top:1.2rem}
.member-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,8.5rem),1fr));gap:.8rem}
.member-card{display:grid;justify-items:center;align-content:start;gap:.4rem;padding:.8rem;background:white;border:1px solid var(--line);border-radius:16px;text-decoration:none;text-align:center;overflow-wrap:anywhere}
.avatar{display:inline-grid;place-items:center;width:64px;height:64px;object-fit:cover;border-radius:50%;font-size:1.4rem;flex-shrink:0}
.online{color:#16633f;background:#e2f5e9;padding:.05rem .55rem;border-radius:1rem;font-size:.85rem}
.preview-banner{background:#fff1cb;border-radius:.6rem;padding:.55rem .85rem}
.settings fieldset{border:1px solid var(--line);border-radius:.8rem;margin:0 0 1rem;padding:.8rem;min-width:0}
.settings legend{font-weight:bold;padding:0 .4rem}
input[type=checkbox]{display:inline-block;width:1.15rem;min-height:0;height:1.15rem;vertical-align:middle;accent-color:var(--green)}
.check{display:flex;align-items:center;gap:.5rem;flex-wrap:wrap}
@media(max-width:1100px){.shelf-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:760px){.shell{grid-template-columns:1fr}.sidebar{display:flex;align-items:center;gap:1rem;flex-wrap:wrap;padding:.6rem .9rem}.sidebar .brand{margin:0;width:90px}.sidebar nav{display:flex;gap:.2rem .45rem;flex-wrap:wrap}.sidebar nav a{padding:.35rem .45rem}.sidebar button{padding:.25rem .55rem}}
@media(max-width:460px){.shelf-grid{grid-template-columns:1fr}.stats{gap:.45rem}.stat{padding:.6rem;font-size:.9rem}}

.book-attachments{margin-top:1rem}
.attachment{border-top:1px solid var(--line);margin-top:.8rem;padding-top:.8rem}
.attachment h3{margin:0 0 .35rem}
.attachment blockquote{margin:.6rem 0;padding-inline-start:.7rem;border-inline-start:3px solid var(--yellow)}
.attachment audio,.recording audio{display:block;max-width:100%;margin:.6rem 0}
[hidden]{display:none!important}
.danger-link{color:#8d231d}
.sharing-blockers{background:#fff6dc;border-radius:.6rem;padding:.45rem .75rem;margin:.55rem 0}
.sharing-blockers p{margin:.25rem 0}
.sharing-blockers ul{margin:.25rem 0;padding-inline-start:1.25rem}
[data-microphones]{margin:.6rem 0}
[data-microphone]{max-width:100%;font:inherit;margin:.25rem .25rem .25rem .5rem}

select{font:inherit;color:inherit;border:1px solid #84978a;border-radius:.55rem;padding:.4rem;max-width:100%}
.report-filters{display:flex;flex-wrap:wrap;gap:.8rem;align-items:flex-start}
.report-table{overflow-x:auto}
.report-table table{width:100%;border-collapse:collapse;background:white}
.report-table th,.report-table td{border:1px solid var(--line);padding:.55rem;vertical-align:top;white-space:pre-wrap}
.report-table th{background:#e7f4ff}
@media print{.sidebar,.no-print{display:none!important}.shell{display:block}main{padding:0}.report-table{overflow:visible}.report-table tr{break-inside:avoid}}

.featured-quote { margin: 1rem 0; padding: 1rem 1.25rem; border-inline-start: 4px solid currentColor; border-radius: .6rem; background: rgba(255,255,255,.6); text-align: center; }
.featured-quote a { color: inherit; text-decoration: none; }
.featured-quote a:hover .featured-quote-source { text-decoration: underline; }
.featured-quote-text { font-size: 14pt; white-space: pre-wrap; overflow-wrap: anywhere; }
.featured-quote-source { display: inline-block; margin-inline-start: .6em; font-size: 12pt; }
.search { grid-template-columns: minmax(10rem, 1fr) auto auto auto; align-items: end; }
.search > label { grid-column: 1 / -1; }
@media (max-width: 720px) { .search { grid-template-columns: 1fr; } }

:root {
  --preset-bg: #edf7ff; --preset-ink: #123e63; --preset-accent: #226da5;
  --sidebar-ink: #fff; --nav-ink: #123e63; --hero: #edf7ff; --badge: #e5f2d7; --warm: #ffe7a5; --surface: #fff;
  --green: var(--custom-accent, var(--preset-accent));
  background: var(--custom-bg, var(--preset-bg));
  color: var(--custom-ink, var(--preset-ink));
  font: calc(var(--ui-size, 15px) + 2px)/1.75 var(--ui-font, Vazirmatn), Vazirmatn, Tahoma, Arial, sans-serif;
}
:root[data-theme=sage] {
  --preset-bg: #fffcf3; --preset-ink: #153f32; --preset-accent: #247c66;
  --sidebar: #e0efdc; --sidebar-ink: #153f32; --yellow: #247c66; --nav-ink: #fff;
  --hero: #fffcf3; --badge: #d7edf9; --warm: #fff5cd; --surface: #fffdf8; --line: #dcded0;
}
:root[data-theme=teal] {
  --preset-bg: #edf9f6; --preset-ink: #103b43; --preset-accent: #0c7c8d;
  --sidebar: #11636e; --yellow: #fbd46d; --nav-ink: #103b43;
  --hero: #faf1d2; --badge: #fff1cb; --warm: #fff5d7; --line: #c4deda;
}
[data-theme=sage] .brand-logo { background-position: 50% 35.8%; }
[data-theme=teal] .brand-logo { background-position: 97.36% 35.8%; }
.sidebar, .sidebar nav a { color: var(--sidebar-ink); }
.sidebar nav a[aria-current=page] { color: var(--nav-ink); }
.hero, .report-table th { background: var(--hero); }
.panel, .stat, .member-card { background: var(--surface); }
.stat span, .avatar-placeholder, .preview-banner { background: var(--warm); }
.tag { background: var(--badge); }
.book-cover { background: var(--preset-accent); color: var(--warm); }
.book-card-link:hover { background: var(--hero); }
.theme-picker { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,13rem),1fr)); gap: 1rem; }
.theme-option { border: 2px solid var(--line); border-radius: .8rem; overflow: hidden; cursor: pointer; text-align: center; padding-bottom: .65rem; }
.theme-option:has(:checked) { border-color: var(--green); box-shadow: 0 0 0 2px var(--green); }
.theme-option img { display: block; width: 100%; aspect-ratio: 1.5; object-fit: cover; margin-bottom: .65rem; }
.theme-option span { display: block; }
.theme-option input[type=radio] { display: inline; width: auto; min-height: 0; accent-color: var(--green); }
.appearance-controls { display: flex; align-items: start; flex-wrap: wrap; gap: .9rem 1.25rem; }
.appearance-controls input[type=color] { width: 5rem; cursor: pointer; }

@media print {
  :root, .report-table th { color: #172a27; background: #fff; }
  .report-table th, .report-table td { border-color: #929292; }
}


.sidebar-identity { text-align: center; margin-bottom: .7rem; }
.sidebar .brand { color: var(--sidebar-ink); }
.brand-label { display: block; font-size: 24px; line-height: 1.4; margin-top: .25rem; }
.sidebar-profile { display: inline-block; border-radius: 50%; }
.sidebar-profile img { display: block; width: 84px; height: 84px; object-fit: cover; border: 2px solid var(--sidebar-ink); border-radius: 50%; }
.menu-symbols { position: absolute; pointer-events: none; }
.sidebar nav a, .sidebar nav button {
  display: flex; align-items: center; gap: .55rem; font-size: 17px;
}
.menu-icon {
  width: 19px; height: 19px; flex: 0 0 19px; fill: none; stroke: currentColor;
  stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round;
  --menu-icon-bg: var(--sidebar);
}
[aria-current=page] .menu-icon { --menu-icon-bg: var(--yellow); }
#shelf-search-status:empty { display: none; }
@media (max-width: 760px) {
  .sidebar-identity { flex: 0 0 auto; margin: 0; }
  .brand-label { font-size: 15px; }
  .sidebar-profile { margin-top: .35rem; }
  .sidebar-profile img { width: 50px; height: 50px; }
}

/* Four compact book cards on desktop. */
@media(min-width:1101px){.shelf-grid{grid-template-columns:repeat(4,minmax(0,1fr));gap:.65rem}}
.shelf-grid .book-card-link{grid-template-columns:3.5rem minmax(0,1fr);gap:.6rem;padding:.65rem}
.shelf-grid .book-card{min-width:0}
.shelf-grid .book-card h2{overflow-wrap:anywhere}
#book-suggestions button{display:block;margin:.5rem 0;text-align:right;width:100%}
.shelf-grid .book-card{min-height:7.5rem}
.shelf-grid .book-cover{min-height:5.3rem;width:100%;max-width:100%;object-fit:contain}
.shelf-grid .book-card h2{font-size:16px;line-height:1.65;margin:.2rem 0}
