:root {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --primary: #2563eb;
  --primary-soft: #eff6ff;
  --green: #15803d;
  --green-soft: #ecfdf3;
  --red: #dc2626;
  --red-soft: #fef2f2;
  --orange: #b45309;
  --orange-soft: #fff7ed;
  --gray-soft: #f3f4f6;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(15 23 42 / 0.04), 0 8px 24px rgb(15 23 42 / 0.04);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Segoe UI", sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.app-shell { width: min(100%, 560px); min-height: 100dvh; margin: 0 auto; background: var(--surface); position: relative; padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
.app-header { position: sticky; top: 0; z-index: 20; background: rgb(255 255 255 / 0.96); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); padding: calc(12px + env(safe-area-inset-top)) 18px 12px; }
.brand { color: var(--primary); font-size: 13px; font-weight: 750; margin-bottom: 2px; }
.app-header h1 { margin: 0; font-size: 22px; line-height: 1.25; letter-spacing: -0.02em; }
.app-main { padding: 16px 16px 28px; }
.page { display: none; }
.page.is-active { display: block; }
.summary-card { width: 100%; border: 1px solid #dbeafe; border-radius: var(--radius); background: var(--primary-soft); display: grid; grid-template-columns: 34px 1fr auto 14px; align-items: center; gap: 10px; padding: 14px; text-align: left; color: var(--text); margin-bottom: 14px; }
.summary-icon { width: 34px; height: 34px; border-radius: 50%; background: #dbeafe; display: grid; place-items: center; color: var(--primary); }
.summary-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.summary-text strong { font-size: 15px; }
.summary-text small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.summary-count { color: var(--primary); font-size: 22px; font-weight: 800; white-space: nowrap; }
.summary-chevron { color: #94a3b8; font-size: 22px; }
.search-form { display: grid; grid-template-columns: 1fr 48px; gap: 8px; margin-bottom: 18px; }
.search-form.compact { margin: 10px 0 8px; }
.search-form input { width: 100%; min-width: 0; height: 48px; border: 1px solid #d1d5db; border-radius: 12px; background: #fff; padding: 0 14px; outline: none; font-size: 16px; }
.search-form input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgb(37 99 235 / 0.12); }
.icon-button { height: 48px; border: 0; border-radius: 12px; font-size: 22px; cursor: pointer; }
.primary { background: var(--primary); color: #fff; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 6px 2px 10px; }
.section-head h2, .section-block h2 { margin: 0; font-size: 17px; letter-spacing: -0.015em; }
.muted { color: var(--muted); font-size: 12px; margin: 3px 0 0; }
.center { text-align: center; }
.list-stack { display: flex; flex-direction: column; gap: 10px; }
.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.book-row { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; gap: 12px; align-items: center; min-height: 92px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.book-cover { width: 58px; height: 78px; object-fit: cover; border-radius: 7px; background: #eef2f7; border: 1px solid #e5e7eb; }
.book-cover.placeholder { display: grid; place-items: center; color: #9ca3af; font-size: 24px; }
.book-info { min-width: 0; }
.book-title { margin: 0 0 5px; font-size: 15px; line-height: 1.35; font-weight: 750; overflow-wrap: anywhere; }
.book-author { margin: 0; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.book-isbn { margin-top: 5px; color: #9ca3af; font-size: 11px; }
.small-button { border: 1px solid #bfdbfe; background: #fff; color: var(--primary); border-radius: 10px; padding: 9px 10px; font-weight: 700; font-size: 12px; white-space: nowrap; }
.small-button.registered { background: var(--primary-soft); }
.small-button.danger { border-color: #fecaca; color: var(--red); }
.small-button:disabled { opacity: 0.5; cursor: not-allowed; }
.empty-state { text-align: center; border: 1px dashed #d1d5db; border-radius: var(--radius); padding: 34px 20px; color: var(--muted); background: #fafafa; }
.empty-state strong { display: block; color: var(--text); margin-bottom: 5px; }
.loading-row { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; text-align: center; color: var(--muted); }
.error-box { border: 1px solid #fecaca; background: var(--red-soft); color: #991b1b; border-radius: 12px; padding: 12px; font-size: 13px; line-height: 1.45; }
.status-toolbar { margin-bottom: 18px; }
.wide-button { width: 100%; height: 48px; border: 0; border-radius: 12px; font-weight: 800; font-size: 15px; }
.wide-button:disabled { opacity: .6; }
.status-card { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; padding: 12px; box-shadow: var(--shadow); }
.status-card-head { display: grid; grid-template-columns: 48px minmax(0,1fr) auto; gap: 10px; align-items: start; margin-bottom: 12px; }
.status-card .book-cover { width: 48px; height: 66px; }
.status-rows { border-top: 1px solid var(--line); }
.status-row { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px solid #f1f5f9; }
.status-row:last-child { border-bottom: 0; }
.library-name { font-size: 13px; font-weight: 650; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-right { display: flex; align-items: center; gap: 7px; }
.status-chip { display: inline-flex; align-items: center; justify-content: center; min-width: 68px; padding: 5px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; }
.status-chip.available { color: var(--green); background: var(--green-soft); }
.status-chip.loaned { color: var(--red); background: var(--red-soft); }
.status-chip.unavailable { color: var(--orange); background: var(--orange-soft); }
.status-chip.not-owned, .status-chip.unknown, .status-chip.pending { color: #4b5563; background: var(--gray-soft); }
.source-mark { font-size: 10px; color: #9ca3af; white-space: nowrap; }
.source-note { border-radius: 10px; margin-top: 10px; padding: 8px 10px; background: #f8fafc; color: #64748b; font-size: 11px; line-height: 1.4; }
.library-head { align-items: center; margin-top: 2px; }
.count-badge { color: var(--primary); font-size: 14px; background: var(--primary-soft); border-radius: 999px; padding: 7px 10px; }
.library-list { display: flex; flex-direction: column; }
.library-list.card { overflow: hidden; }
.library-row { display: grid; grid-template-columns: 34px minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 13px 12px; border-bottom: 1px solid var(--line); background: #fff; }
.library-row:last-child { border-bottom: 0; }
.library-icon { width: 32px; height: 32px; border-radius: 9px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-size: 16px; }
.library-info { min-width: 0; }
.library-info strong { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.library-info small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.section-block { margin-top: 28px; }
.bottom-nav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); z-index: 30; width: min(100%, 560px); height: calc(66px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); border-top: 1px solid var(--line); background: rgb(255 255 255 / 0.97); backdrop-filter: blur(12px); display: grid; grid-template-columns: repeat(3, 1fr); }
.nav-item { border: 0; background: transparent; color: #6b7280; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 650; }
.nav-item.is-active { color: var(--primary); }
.nav-icon { font-size: 21px; line-height: 1; }
.toast { position: fixed; left: 50%; bottom: calc(82px + env(safe-area-inset-bottom)); transform: translate(-50%, 16px); z-index: 100; max-width: calc(100vw - 32px); border-radius: 12px; background: #111827; color: #fff; padding: 10px 14px; font-size: 13px; opacity: 0; pointer-events: none; transition: .2s ease; box-shadow: 0 8px 30px rgb(0 0 0 / .18); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 600px) {
  body { padding: 18px 0; }
  .app-shell { min-height: calc(100dvh - 36px); border-radius: 22px; overflow: hidden; box-shadow: 0 12px 50px rgb(15 23 42 / 0.12); }
  .bottom-nav { bottom: 18px; border-bottom-left-radius: 22px; border-bottom-right-radius: 22px; }
}
