:root { color-scheme: light; font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", sans-serif; color: #162033; background: #f4f6f8; }
* { box-sizing: border-box; }
body { margin: 0; padding: env(safe-area-inset-top) 0 calc(72px + env(safe-area-inset-bottom)); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.topbar { background: #1f2937; color: #fff; padding: 16px max(18px, env(safe-area-inset-left)); }
.header-row { display: flex; justify-content: space-between; align-items: center; }
#menu-button { width: 42px; height: 42px; border: 1px solid #64748b; border-radius: 9px; color: #fff; background: transparent; font-size: 23px; }
.topbar h1 { margin: 2px 0; font-size: 23px; letter-spacing: .04em; }
.eyebrow { display: block; font-size: 11px; letter-spacing: .1em; opacity: .75; }
#app { max-width: 780px; margin: 0 auto; padding: 16px; }
.search { width: 100%; padding: 15px 16px; border: 1px solid #cbd5e1; border-radius: 12px; font-size: 17px; background: #fff; }
.search-actions { display: flex; gap: 8px; align-items: stretch; }
.add-book { flex: 0 0 50px; border: 1px solid #1d4ed8; border-radius: 12px; color: #fff; background: #1d4ed8; font-size: 25px; line-height: 1; }
.hint, .meta, .empty { color: #5b6472; font-size: 13px; }
.hint { margin: 10px 2px 16px; }
.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0 18px; }
.summary div { background: #fff; padding: 12px; border-radius: 10px; border: 1px solid #e1e6eb; }
.summary strong { display: block; font-size: 20px; }
.summary span { color: #5b6472; font-size: 12px; }
.list { display: grid; gap: 10px; }
.card { appearance: none; text-align: left; width: 100%; padding: 15px; border: 1px solid #dbe2ea; border-radius: 12px; background: #fff; color: inherit; box-shadow: 0 1px 2px rgba(15, 23, 42, .04); }
.card:active { background: #f8fafc; }
.card-publisher { margin-bottom: 4px; color: #64748b; font-size: 11px; font-weight: 600; }
.title-line { display: flex; gap: 8px; justify-content: space-between; align-items: flex-start; }
.title { font-weight: 700; font-size: 16px; line-height: 1.45; }
.badge { flex: 0 0 auto; border-radius: 999px; padding: 4px 8px; font-size: 12px; font-weight: 700; }
.wanted { background: #fff3df; color: #9a4b00; }
.unowned { background: #fee2e2; color: #b42318; }
.owned { background: #e5f5ec; color: #157342; }
.planned { background: #e8eef8; color: #31567f; }
.digitized { background: #e0f2fe; color: #075985; }
.exempt { background: #ede9fe; color: #5b3f9d; }
.card .meta { margin-top: 8px; line-height: 1.55; }
.tabs { position: fixed; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: repeat(3, 1fr); background: #fff; border-top: 1px solid #dbe2ea; padding: 8px max(8px, env(safe-area-inset-left)) calc(8px + env(safe-area-inset-bottom)); }
.tabs[hidden] { display: none; }
.tabs button { background: transparent; border: 0; padding: 10px 4px; color: #64748b; font-size: 13px; }
.tabs button.active { color: #1d4ed8; font-weight: 700; }
.section-title { margin: 4px 0 14px; font-size: 20px; }
.back { border: 0; background: transparent; color: #1d4ed8; padding: 0 0 12px; }
.detail { background: #fff; border: 1px solid #dbe2ea; border-radius: 14px; padding: 18px; }
.detail h2 { margin: 0 0 5px; font-size: 23px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px 0; }
.detail-grid div { border-top: 1px solid #e5e7eb; padding-top: 9px; font-size: 14px; }
.detail-grid span { display: block; color: #64748b; font-size: 12px; margin-bottom: 3px; }
.notes-view { border-top: 1px solid #e5e7eb; padding-top: 12px; font-size: 14px; }
.notes-view span { display: block; color: #64748b; font-size: 12px; }
.notes-view p { margin: 5px 0 0; white-space: pre-wrap; }
.inline-action { display: block; margin-top: 8px; border: 0; background: transparent; color: #1d4ed8; padding: 0; font-size: 13px; font-weight: 700; }
label { display: block; font-size: 13px; font-weight: 650; margin: 16px 0 6px; }
input[type="text"], input[type="number"], input[type="email"], input[type="password"], textarea, select { width: 100%; padding: 11px; border: 1px solid #cbd5e1; border-radius: 9px; background: #fff; }
.select-add { display: flex; gap: 8px; }
.select-add select { min-width: 0; }
.master-autocomplete { position: relative; flex: 1 1 auto; min-width: 0; }
.master-autocomplete input { width: 100%; }
.master-suggestions { position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px); display: grid; gap: 2px; border-radius: 9px; overflow: hidden; background: #fff; box-shadow: 0 6px 18px rgba(15, 23, 42, .18); }
.master-suggestions:empty { display: none; }
.master-suggestions button { display: flex; justify-content: space-between; gap: 10px; border: 0; padding: 10px 11px; background: #fff; color: #1f2937; text-align: left; }
.master-suggestions button:active { background: #eff6ff; }
.master-suggestions span { color: #64748b; font-size: 12px; }
.add-master { flex: 0 0 42px; border: 1px solid #1d4ed8; border-radius: 9px; color: #1d4ed8; background: #fff; font-size: 21px; }
textarea { min-height: 76px; resize: vertical; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; margin: 14px 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.primary, .secondary { border-radius: 9px; padding: 11px 14px; border: 1px solid #1d4ed8; font-weight: 700; }
.primary { color: #fff; background: #1d4ed8; }
.secondary { background: #fff; color: #1d4ed8; }
.location-row { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 20px; background: #fff; border: 1px solid #dbe2ea; border-radius: 10px; padding: 13px 14px; margin-bottom: 8px; color: inherit; text-align: left; }
.location-row strong { font-size: 16px; }
.master-author-row { justify-content: flex-start; }
.master-author-row > span { display: grid; gap: 3px; }
.master-author-row small { color: #64748b; font-size: 12px; }
.location-row span { flex: 0 0 auto; color: #5b6472; font-size: 13px; }
.sort-controls { display: flex; align-items: center; gap: 7px; margin: 12px 0 16px; font-size: 13px; color: #5b6472; }
.sort-controls button { border: 1px solid #cbd5e1; background: #fff; color: #475569; border-radius: 999px; padding: 6px 10px; font-size: 13px; }
.sort-controls button.selected { border-color: #1d4ed8; background: #e8efff; color: #1d4ed8; font-weight: 700; }
.pagination { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 18px 0 4px; color: #5b6472; font-size: 12px; text-align: center; }
.pagination .secondary { min-width: 64px; padding: 8px 10px; }
.pagination button:disabled { border-color: #e2e8f0; color: #cbd5e1; cursor: default; }
.page-count { margin: 14px 2px 0; color: #5b6472; font-size: 12px; text-align: right; }
.wanted-group { margin-top: 20px; }
.wanted-group h3 { display: flex; justify-content: space-between; align-items: baseline; margin: 0 0 9px; color: #334155; font-size: 15px; }
.wanted-group h3 small { color: #64748b; font-size: 12px; font-weight: 400; }
.master-publisher-label { display: grid; gap: 3px; }
.wanted-group h3 .inline-action { margin-top: 0; }
.modal-backdrop { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 18px; background: rgba(15, 23, 42, .45); }
.modal { width: min(100%, 520px); max-height: min(78vh, 620px); overflow: auto; border-radius: 16px; background: #fff; padding: 20px; box-shadow: 0 16px 45px rgba(15, 23, 42, .24); }
.modal-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.modal h2 { margin: 0; font-size: 19px; }
.modal p { margin: 8px 0 16px; color: #5b6472; }
.modal-close { border: 0; background: transparent; color: #475569; font-size: 26px; line-height: 1; }
.master-menu { display: grid; gap: 9px; }
.master-menu .modal-heading { margin-bottom: 6px; }
.master-menu > button:not(.modal-close) { border: 1px solid #cbd5e1; border-radius: 9px; background: #fff; padding: 13px; text-align: left; font-weight: 700; }
.master-list { margin-top: 16px; }
.login-panel { max-width: 460px; margin: 8vh auto 0; }
.form-error { border: 1px solid #fecaca; border-radius: 9px; background: #fef2f2; color: #b42318; padding: 10px; font-size: 13px; }
.upload-label { display: inline-flex; align-items: center; cursor: pointer; }
.volume-buttons { display: flex; flex-wrap: wrap; gap: 9px; }
.volume-buttons button { min-width: 60px; border: 1px solid #1d4ed8; border-radius: 9px; background: #fff; color: #1d4ed8; padding: 11px 10px; font-weight: 700; }
.volume-buttons button:active { background: #e8efff; }
.volume-buttons .all-volumes { border-color: #1d4ed8; background: #1d4ed8; color: #fff; }
@media (min-width: 700px) { #app { padding-top: 26px; } .card { padding: 17px; } }
