#perpus-app {
	--ink: #1b2a3a; --bind: #285d73; --paper: #f4f6f7; --card: #fff; --line: #d3dadf;
	--ok: #1f7a4d; --warn: #a15c00; --bad: #b3261e; --muted: #5b6770;
	font-family: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
	font-size: 18px; line-height: 1.45; color: var(--ink);
	max-width: 560px; margin: 0 auto; padding: 0 14px 96px; box-sizing: border-box;
}
#perpus-app *, #perpus-app *::before, #perpus-app *::after { box-sizing: border-box; }
#perpus-app h2 { font-size: 1.3rem; margin: 1.1rem 0 .6rem; line-height: 1.25; }
#perpus-app small, #perpus-app .hint { color: var(--muted); font-size: .9rem; }
#perpus-app .hint { margin: .5rem 0; }
#perpus-app [hidden] { display: none !important; }

#perpus-app .top { padding: .9rem 0 .4rem; border-bottom: 2px solid var(--ink); font-size: 1.1rem; }
#perpus-app label { display: block; margin: .9rem 0 .25rem; font-weight: 700; font-size: .95rem; }
#perpus-app input[type=text], #perpus-app input:not([type]), #perpus-app input[type=search], #perpus-app input[type=tel] {
	width: 100%; min-height: 52px; padding: .6rem .8rem; font: inherit; color: inherit;
	background: #fff; border: 1.5px solid var(--ink); border-radius: 8px;
}
#perpus-app input:focus-visible, #perpus-app button:focus-visible, #perpus-app a:focus-visible { outline: 3px solid #e0a100; outline-offset: 2px; }

#perpus-app .row { display: flex; gap: 8px; margin: .6rem 0; }
#perpus-app .row > input { flex: 1; min-width: 0; }
#perpus-app .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: .6rem 0; }
#perpus-app .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

#perpus-app .btn {
	display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: .6rem 1rem;
	font: inherit; font-weight: 700; text-align: center; text-decoration: none; cursor: pointer;
	color: #fff; background: var(--bind); border: 1.5px solid var(--bind); border-radius: 12px;
}
#perpus-app .btn.sec { color: var(--bind); background: #fff; }
#perpus-app .btn.warn { background: var(--warn); border-color: var(--warn); }
#perpus-app .btn.big { width: 100%; min-height: 60px; font-size: 1.1rem; margin-top: .8rem; }
#perpus-app .btn:active { transform: translateY(1px); }

#perpus-app .card { margin: .8rem 0; padding: .9rem; background: var(--card); border: 1.5px solid var(--line); border-left: 6px solid var(--bind); border-radius: 6px 12px 12px 6px; }
#perpus-app .card.ok { border-left-color: var(--ok); }
#perpus-app .card.bad { border-left-color: var(--bad); }
#perpus-app .card.ret { border-left-color: var(--warn); }
#perpus-app .card p { margin: .5rem 0 0; }
#perpus-app .warnbox { margin: .6rem 0 0; padding: .6rem .7rem; color: #fff; background: var(--bad); border-radius: 8px; font-weight: 700; }
#perpus-app .note { margin: .8rem 0; padding: .7rem .8rem; background: #fff7e0; border: 1.5px solid #e0a100; border-radius: 8px; }

#perpus-app .who { display: flex; gap: 12px; align-items: center; }
#perpus-app .who img, #perpus-app .who .ph { width: 88px; height: 110px; flex: none; object-fit: cover; border-radius: 6px; border: 1.5px solid var(--ink); background: var(--paper); }
#perpus-app .who .ph { display: grid; place-items: center; font-size: 2rem; font-weight: 700; color: var(--muted); }
#perpus-app .who.sm img, #perpus-app .who.sm .ph { width: 44px; height: 55px; font-size: 1.2rem; }
#perpus-app .loans { margin: .6rem 0 0; padding: 0; list-style: none; font-size: .95rem; }
#perpus-app .loans li { padding: .25rem 0; border-top: 1px solid var(--line); }
#perpus-app .late { color: var(--bad); font-weight: 700; }

#perpus-app .book { display: flex; gap: 12px; align-items: flex-start; margin: .5rem 0; }
#perpus-app .spine {
	flex: none; min-width: 3.9rem; max-width: 5rem; padding: .35rem .4rem; text-align: center; word-break: break-all;
	font-weight: 700; font-size: .8rem; line-height: 1.25; font-variant-numeric: tabular-nums;
	background: #fff; border: 1.5px solid var(--ink); border-top-width: 5px; border-bottom-width: 5px; border-radius: 2px;
}

#perpus-app .item {
	display: flex; gap: 12px; align-items: flex-start; width: 100%; margin: .45rem 0; padding: .7rem; text-align: left;
	font: inherit; color: inherit; cursor: pointer; background: #fff; border: 1.5px solid var(--line); border-radius: 10px;
}
#perpus-app .item.new { justify-content: center; font-weight: 700; color: var(--bind); border-style: dashed; border-color: var(--bind); }
#perpus-app .seg { display: flex; flex-wrap: wrap; gap: 8px; }
#perpus-app .seg label { flex: 1 1 40%; margin: 0; font-weight: 400; }
#perpus-app .seg input { position: absolute; opacity: 0; }
#perpus-app .seg span { display: flex; align-items: center; justify-content: center; min-height: 52px; padding: .4rem; text-align: center; background: #fff; border: 1.5px solid var(--ink); border-radius: 10px; cursor: pointer; }
#perpus-app .seg input:checked + span { color: #fff; background: var(--ink); font-weight: 700; }
#perpus-app .seg input:focus-visible + span { outline: 3px solid #e0a100; outline-offset: 2px; }

#perpus-app #pp-cam { margin: .6rem 0; }
#perpus-app #reader { width: 100%; overflow: hidden; border-radius: 10px; background: #000; }

#perpus-app .stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#perpus-app .stat { padding: .7rem; background: #fff; border: 1.5px solid var(--line); border-radius: 10px; }
#perpus-app .stat b { display: block; font-size: 1.8rem; line-height: 1.1; }
#perpus-app .stat.hot b { color: var(--bad); }

#perpus-app #pp-nav {
	position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: flex; gap: 6px; justify-content: center;
	padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px)); background: var(--ink);
}
#perpus-app #pp-nav button { flex: 1; max-width: 180px; min-height: 52px; font: inherit; font-weight: 700; color: #cfd8de; background: transparent; border: 0; border-radius: 10px; cursor: pointer; }
#perpus-app #pp-nav button[aria-current=page] { color: var(--ink); background: #fff; }

#perpus-app .toast { position: fixed; left: 14px; right: 14px; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); z-index: 60; max-width: 532px; margin: 0 auto; padding: .7rem .9rem; color: #fff; background: var(--ink); border-radius: 10px; opacity: 0; pointer-events: none; transition: opacity .2s; }
#perpus-app .toast.show { opacity: 1; }
#perpus-app .toast.bad { background: var(--bad); }

#perpus-app .steps { display: flex; gap: 8px; margin: .9rem 0 0; padding: 0; list-style: none; }
#perpus-app .steps li { flex: 1; padding: .55rem .65rem; font-size: .9rem; font-weight: 700; color: var(--muted); background: #fff; border: 1.5px solid var(--line); border-radius: 10px; }
#perpus-app .steps li.on { color: var(--ink); border-color: var(--ink); }
#perpus-app .steps li.done { color: #fff; background: var(--ok); border-color: var(--ok); }

@media (prefers-reduced-motion: reduce) { #perpus-app * { transition: none !important; } }
