/* =====================================================================
   Biblioteca - layout com sidebar (mesmo visual do Portal do Professor/Responsável)
   Tema: html[data-theme="dark"] troca as variáveis abaixo
   ===================================================================== */
:root {
	--sb-w: 272px;
	--sb-w-mini: 76px;
	--top-h: 64px;
	--c-primary: #4f46e5;
	--c-primary-2: #3b82f6;
	--c-primary-soft: #eef0ff;
	--c-primary-soft-2: #f7f7ff;
	--c-active-bar: #1e3a8a;
	--c-text: #1e293b;
	--c-link: #475569;
	--c-muted: #64748b;
	--c-faint: #94a3b8;
	--c-border: #e8ebf2;
	--c-bg: #f5f7fb;
	--c-surface: #ffffff;
	--c-surface-2: #f8fafc;
	--c-hover: #f4f6fa;
	--c-topbar: rgba(255, 255, 255, .92);
	--c-scroll: #dfe3ec;
	--c-danger: #dc2626;
	--c-danger-soft: #fef2f2;
	--c-overlay: rgba(15, 23, 42, .45);
	--radius: 12px;
	--ease: cubic-bezier(.4, 0, .2, 1);
	color-scheme: light;
}

html[data-theme="dark"] {
	--c-primary: #818cf8;
	--c-primary-2: #3b82f6;
	--c-primary-soft: rgba(129, 140, 248, .14);
	--c-primary-soft-2: rgba(129, 140, 248, .05);
	--c-active-bar: #3b82f6;
	--c-text: #e2e8f0;
	--c-link: #cbd5e1;
	--c-muted: #94a3b8;
	--c-faint: #64748b;
	--c-border: #243045;
	--c-bg: #0b1120;
	--c-surface: #111a2e;
	--c-surface-2: #16213a;
	--c-hover: #1a2540;
	--c-topbar: rgba(17, 26, 46, .9);
	--c-scroll: #2a3752;
	--c-danger: #f87171;
	--c-danger-soft: rgba(248, 113, 113, .12);
	--c-overlay: rgba(0, 0, 0, .6);
	color-scheme: dark;
}

body.app {
	font-family: 'Inter', 'Roboto', Calibri, Arial, sans-serif;
	background: var(--c-bg);
	color: var(--c-text);
	padding-top: 0;
	margin-bottom: 0;
	padding-left: var(--sb-w);
	transition: padding-left .25s var(--ease);
	/* coluna flexível: o rodapé fica sempre no fim da página */
	display: flex;
	flex-direction: column;
	min-height: 100vh;
}
html.sb-mini body.app { padding-left: var(--sb-w-mini); }

/* ---------- Sidebar ---------- */
.sb {
	position: fixed;
	top: 0; left: 0; bottom: 0;
	width: var(--sb-w);
	background: var(--c-surface);
	border-right: 1px solid var(--c-border);
	display: flex;
	flex-direction: column;
	z-index: 1030;
	transition: width .25s var(--ease), transform .25s var(--ease);
	will-change: transform;
}
html.sb-mini .sb { width: var(--sb-w-mini); }

.sb-brand {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	padding: 18px 20px 16px;
	text-align: center;
	border-bottom: 1px solid var(--c-border);
	flex-shrink: 0;
	text-decoration: none !important;
}
.sb-logo {
	width: 44px; height: 44px;
	border-radius: 12px;
	flex-shrink: 0;
	display: grid;
	place-items: center;
	color: #fff;
	font-size: 22px;
	background: linear-gradient(135deg, #4f46e5 0%, var(--c-primary-2) 100%);
	box-shadow: 0 6px 14px -4px rgba(79, 70, 229, .45);
}
.sb-logo-img { display: block; max-width: 100%; max-height: 90px; height: auto; }
/* no escuro a logo ganha uma "placa" clara para manter as cores originais legíveis */
html[data-theme="dark"] .sb-logo-img { background: #fff; padding: 6px 10px; border-radius: 10px; }
.sb-brand-sub {
	display: block;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: .08em;
	color: var(--c-primary);
	text-transform: uppercase;
}

.sb-nav {
	flex: 1;
	overflow-y: auto;
	overflow-x: hidden;
	padding: 12px 14px 20px;
	scrollbar-width: thin;
	scrollbar-color: var(--c-scroll) transparent;
	overscroll-behavior: contain;
}
.sb-nav ul { list-style: none; margin: 0; padding: 0; }

.sb-section { margin-top: 10px; }
.sb-section-title {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	padding: 10px 10px 6px;
	background: none;
	border: 0;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--c-faint);
	cursor: pointer;
	text-align: left;
}
.sb-section-title:hover { color: var(--c-muted); }
.sb-section-title .bi { font-size: 11px; transition: transform .2s var(--ease); }
.sb-section.closed .sb-section-title .bi { transform: rotate(-90deg); }

/* abre/fecha suave sem medir altura em JS */
.sb-collapse {
	display: grid;
	grid-template-rows: 1fr;
	transition: grid-template-rows .22s var(--ease);
}
.sb-collapse > ul { overflow: hidden; min-height: 0; }
.sb-section.closed .sb-collapse { grid-template-rows: 0fr; }

.sb-link {
	position: relative;
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 12px 10px 14px;
	margin: 2px 0;
	border-radius: 10px;
	color: var(--c-link);
	font-size: 14.5px;
	font-weight: 500;
	text-decoration: none !important;
	white-space: nowrap;
	overflow: hidden;
	transition: background-color .15s, color .15s;
}
.sb-link .bi { font-size: 18px; width: 22px; text-align: center; flex-shrink: 0; color: var(--c-muted); transition: color .15s; }
.sb-label { overflow: hidden; text-overflow: ellipsis; }
.sb-link:hover, .sb-link:focus { background: var(--c-hover); color: var(--c-text); outline: none; }
.sb-link:hover .bi { color: var(--c-text); }
.sb-link:focus-visible { box-shadow: 0 0 0 2px var(--c-primary-soft), 0 0 0 4px rgba(79, 70, 229, .35); }
.sb-link.active {
	background: linear-gradient(90deg, var(--c-primary-soft) 0%, var(--c-primary-soft-2) 100%);
	color: var(--c-primary);
	font-weight: 600;
}
.sb-link.active .bi { color: var(--c-primary); }
/* faixa azul-escura à esquerda do item ativo */
.sb-link.active::before {
	content: "";
	position: absolute;
	left: 0; top: 0; bottom: 0;
	width: 4px;
	background: var(--c-active-bar);
}
.sb-link.danger:hover { background: var(--c-danger-soft); color: var(--c-danger); }
.sb-link.danger:hover .bi { color: var(--c-danger); }

/* rodapé da sidebar (usuário) */
.sb-user {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 14px 18px;
	border-top: 1px solid var(--c-border);
	flex-shrink: 0;
}
.avatar {
	width: 38px; height: 38px;
	border-radius: 50%;
	flex-shrink: 0;
	display: grid;
	place-items: center;
	font-size: 13px;
	font-weight: 700;
	color: var(--c-primary);
	background: var(--c-primary-soft);
}
.sb-user-text { min-width: 0; line-height: 1.25; flex: 1; }
.sb-user-name { display: block; font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user-meta { display: block; font-size: 12px; color: var(--c-muted); }
.sb-user-out {
	width: 34px; height: 34px;
	border-radius: 8px;
	display: grid;
	place-items: center;
	color: var(--c-muted);
	flex-shrink: 0;
}
.sb-user-out:hover { background: var(--c-danger-soft); color: var(--c-danger); text-decoration: none; }

/* modo mini (somente ícones) */
html.sb-mini .sb-brand { padding: 14px 10px; }
html.sb-mini .sb-logo-img { max-height: 44px; }
html.sb-mini .sb-brand-sub,
html.sb-mini .sb-label,
html.sb-mini .sb-user-text,
html.sb-mini .sb-user-out,
html.sb-mini .sb-section-title { display: none; }
html.sb-mini .sb-nav { padding: 12px 10px; }
html.sb-mini .sb-link { justify-content: center; padding: 11px 0; }
html.sb-mini .sb-section { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--c-border); }
html.sb-mini .sb-section:first-child { border-top: 0; }
html.sb-mini .sb-section.closed .sb-collapse { grid-template-rows: 1fr; }
html.sb-mini .sb-user { justify-content: center; padding: 14px 0; }

/* ---------- Topbar ---------- */
.topbar {
	position: sticky;
	top: 0;
	z-index: 1020;
	height: var(--top-h);
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 0 28px;
	background: var(--c-topbar);
	border-bottom: 1px solid var(--c-border);
	-webkit-backdrop-filter: saturate(180%) blur(8px);
	backdrop-filter: saturate(180%) blur(8px);
}
.icon-btn {
	width: 40px; height: 40px;
	border: 1px solid var(--c-border);
	border-radius: 10px;
	background: var(--c-surface);
	color: var(--c-muted);
	display: grid;
	place-items: center;
	font-size: 18px;
	flex-shrink: 0;
	cursor: pointer;
	transition: background-color .15s, color .15s;
}
.icon-btn:hover { background: var(--c-hover); color: var(--c-text); }

/* botão de tema: mostra a lua no claro e o sol no escuro */
.tema-btn .bi-sun { display: none; }
html[data-theme="dark"] .tema-btn .bi-sun { display: inline; }
html[data-theme="dark"] .tema-btn .bi-moon-stars { display: none; }

.crumbs {
	display: flex;
	align-items: center;
	gap: 8px;
	min-width: 0;
	font-size: 15px;
	color: var(--c-faint);
	white-space: nowrap;
}
.crumbs a { color: var(--c-faint); }
.crumbs a:hover { color: var(--c-primary); text-decoration: none; }
.crumbs .bi-chevron-right { font-size: 11px; }
.crumbs .current { color: var(--c-text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }

.top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 12px;
	border-radius: 999px;
	font-size: 12.5px;
	font-weight: 600;
	color: var(--c-primary);
	background: var(--c-primary-soft);
	white-space: nowrap;
}
.chip:hover { text-decoration: none; color: var(--c-primary); filter: brightness(.97); }
.top-user { display: flex; align-items: center; gap: 10px; }
.top-user-name { font-weight: 600; font-size: 14px; }

/* ---------- Conteúdo ---------- */
.app-container {
	width: 100%;
	max-width: 1320px;
	padding: 24px 28px 32px;
}
body.app .grupo {
	padding: 22px 24px;
	background: var(--c-surface);
	border: 1px solid var(--c-border);
	border-radius: 16px;
	box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.welcome {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 14px;
	margin-bottom: 16px;
	color: var(--c-muted);
}
.welcome strong { color: var(--c-text); }

body.app .footer {
	position: static;
	margin-top: auto;
	height: auto;
	background: transparent;
	color: var(--c-faint);
	padding: 8px 0 24px;
	font-size: 12px;
}
body.app .footer .container { width: auto; max-width: 1320px; margin: 0; padding: 0 28px; }

.sb-overlay {
	position: fixed;
	inset: 0;
	background: var(--c-overlay);
	z-index: 1025;
	opacity: 0;
	visibility: hidden;
	transition: opacity .25s var(--ease), visibility .25s;
}

/* ---------- Tema escuro: componentes do Bootstrap 3 usados nas páginas ---------- */
html[data-theme="dark"] body.app a { color: #93c5fd; }
html[data-theme="dark"] body.app .sb a.sb-link,
html[data-theme="dark"] body.app .crumbs a,
html[data-theme="dark"] body.app .sb-user-out { color: inherit; }
html[data-theme="dark"] body.app .sb a.sb-link.active { color: var(--c-primary); }
html[data-theme="dark"] body.app .crumbs a { color: var(--c-faint); }
html[data-theme="dark"] body.app .chip { color: var(--c-primary); }
html[data-theme="dark"] body.app .sb-user-out { color: var(--c-muted); }
html[data-theme="dark"] body.app .sb-user-out:hover { color: var(--c-danger); }

html[data-theme="dark"] body.app h1, html[data-theme="dark"] body.app h2,
html[data-theme="dark"] body.app h3, html[data-theme="dark"] body.app h4,
html[data-theme="dark"] body.app h5, html[data-theme="dark"] body.app h6,
html[data-theme="dark"] body.app label, html[data-theme="dark"] body.app legend { color: var(--c-text); }
html[data-theme="dark"] body.app legend,
html[data-theme="dark"] body.app hr { border-color: var(--c-border); }
html[data-theme="dark"] body.app .text-muted,
html[data-theme="dark"] body.app .help-block { color: var(--c-muted); }

html[data-theme="dark"] body.app .table > thead > tr > th,
html[data-theme="dark"] body.app .table > tbody > tr > th,
html[data-theme="dark"] body.app .table > tbody > tr > td,
html[data-theme="dark"] body.app .table > tfoot > tr > td,
html[data-theme="dark"] body.app .table-bordered,
html[data-theme="dark"] body.app table td,
html[data-theme="dark"] body.app table th { border-color: var(--c-border); }
html[data-theme="dark"] body.app table th { background-color: var(--c-surface-2); }
html[data-theme="dark"] body.app .table-striped > tbody > tr:nth-of-type(odd) { background-color: rgba(255, 255, 255, .025); }
html[data-theme="dark"] body.app .table-hover > tbody > tr:hover { background-color: var(--c-hover); }
html[data-theme="dark"] body.app .table > tbody > tr.active > td,
html[data-theme="dark"] body.app .table > tbody > tr > td.active { background-color: var(--c-hover); }

html[data-theme="dark"] body.app .form-control,
html[data-theme="dark"] body.app input[type=text], html[data-theme="dark"] body.app input[type=number],
html[data-theme="dark"] body.app input[type=password], html[data-theme="dark"] body.app input[type=date],
html[data-theme="dark"] body.app input[type=email], html[data-theme="dark"] body.app select,
html[data-theme="dark"] body.app textarea {
	background-color: #0e1628;
	border-color: var(--c-border);
	color: var(--c-text);
}
html[data-theme="dark"] body.app .form-control:focus { border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(129, 140, 248, .2); }
html[data-theme="dark"] body.app .form-control[disabled],
html[data-theme="dark"] body.app .form-control[readonly] { background-color: var(--c-surface-2); color: var(--c-muted); }
html[data-theme="dark"] body.app .input-group-addon { background: var(--c-surface-2); border-color: var(--c-border); color: var(--c-muted); }

html[data-theme="dark"] body.app .panel,
html[data-theme="dark"] body.app .well,
html[data-theme="dark"] body.app .list-group-item,
html[data-theme="dark"] body.app .modal-content,
html[data-theme="dark"] body.app .dropdown-menu,
html[data-theme="dark"] body.app .popover,
html[data-theme="dark"] body.app .thumbnail,
html[data-theme="dark"] body.app .jumbotron {
	background-color: var(--c-surface);
	border-color: var(--c-border);
	color: var(--c-text);
}
html[data-theme="dark"] body.app .panel-default > .panel-heading,
html[data-theme="dark"] body.app .panel-footer,
html[data-theme="dark"] body.app .modal-header,
html[data-theme="dark"] body.app .modal-footer {
	background-color: var(--c-surface-2);
	border-color: var(--c-border);
	color: var(--c-text);
}
html[data-theme="dark"] body.app .close { color: var(--c-text); text-shadow: none; opacity: .6; }
html[data-theme="dark"] body.app .dropdown-menu > li > a { color: var(--c-link); }
html[data-theme="dark"] body.app .dropdown-menu > li > a:hover { background: var(--c-hover); color: var(--c-text); }
html[data-theme="dark"] body.app .dropdown-menu .divider { background-color: var(--c-border); }

html[data-theme="dark"] body.app .btn-default {
	background-color: var(--c-surface-2);
	border-color: var(--c-border);
	color: var(--c-text);
}
html[data-theme="dark"] body.app .btn-default:hover,
html[data-theme="dark"] body.app .btn-default:focus { background-color: var(--c-hover); color: var(--c-text); }
html[data-theme="dark"] body.app .btn-primary,
html[data-theme="dark"] body.app .btn-success,
html[data-theme="dark"] body.app .btn-danger,
html[data-theme="dark"] body.app .btn-info,
html[data-theme="dark"] body.app .btn-warning { color: #fff; }

html[data-theme="dark"] body.app .nav-tabs { border-color: var(--c-border); }
html[data-theme="dark"] body.app .nav-tabs > li > a:hover { background: var(--c-hover); border-color: var(--c-border); }
html[data-theme="dark"] body.app .nav-tabs > li.active > a,
html[data-theme="dark"] body.app .nav-tabs > li.active > a:hover,
html[data-theme="dark"] body.app .nav-tabs > li.active > a:focus {
	background: var(--c-surface);
	border-color: var(--c-border) var(--c-border) transparent;
	color: var(--c-text);
}
html[data-theme="dark"] body.app .pagination > li > a,
html[data-theme="dark"] body.app .pagination > li > span { background: var(--c-surface); border-color: var(--c-border); }

html[data-theme="dark"] body.app .alert-info { background: rgba(59, 130, 246, .12); border-color: rgba(59, 130, 246, .3); color: #bfdbfe; }
html[data-theme="dark"] body.app .alert-success { background: rgba(34, 197, 94, .12); border-color: rgba(34, 197, 94, .3); color: #bbf7d0; }
html[data-theme="dark"] body.app .alert-warning { background: rgba(234, 179, 8, .12); border-color: rgba(234, 179, 8, .3); color: #fde68a; }
html[data-theme="dark"] body.app .alert-danger { background: rgba(239, 68, 68, .12); border-color: rgba(239, 68, 68, .3); color: #fecaca; }

html[data-theme="dark"] body.app .bootgrid-header .search .form-control,
html[data-theme="dark"] body.app .bootgrid-table th > .column-header-anchor { color: var(--c-text); }
html[data-theme="dark"] body.app .modal-backdrop.in { opacity: .7; }
/* ícones/imagens em GIF/PNG com fundo branco ficam um pouco menos "estourados" */
html[data-theme="dark"] body.app .grupo img { filter: brightness(.92); }

/* ---------- Responsivo ---------- */
.only-mobile { display: none; }

@media (max-width: 991px) {
	body.app, html.sb-mini body.app { padding-left: 0; }
	.sb, html.sb-mini .sb { width: var(--sb-w); transform: translateX(-100%); box-shadow: none; }
	html.sb-open .sb { transform: none; box-shadow: 0 20px 50px rgba(15, 23, 42, .25); }
	html.sb-open .sb-overlay { opacity: 1; visibility: visible; }
	html.sb-open, html.sb-open body { overflow: hidden; }
	/* no celular o modo mini não se aplica */
	html.sb-mini .sb-brand { padding: 18px 20px 16px; }
	html.sb-mini .sb-logo-img { max-height: 90px; }
	html.sb-mini .sb-brand-sub, html.sb-mini .sb-label, html.sb-mini .sb-user-text { display: block; }
	html.sb-mini .sb-user-out { display: grid; }
	html.sb-mini .sb-section-title { display: flex; }
	html.sb-mini .sb-nav { padding: 12px 14px 20px; }
	html.sb-mini .sb-link { justify-content: flex-start; padding: 10px 12px 10px 14px; }
	html.sb-mini .sb-user { justify-content: flex-start; padding: 14px 18px; }
	html.sb-mini .sb-section { border-top: 0; }
	.only-mobile { display: grid; }
	.only-desktop { display: none !important; }
	.topbar { padding: 0 16px; gap: 10px; }
	.app-container { padding: 16px; }
	body.app .footer .container { padding: 0 16px; }
}
@media (max-width: 575px) {
	.top-user-name, .crumbs .crumb-parent, .crumbs .crumb-sep { display: none; }
	body.app .grupo { padding: 16px; border-radius: 12px; }
}

@media (prefers-reduced-motion: reduce) {
	.sb, body.app, .sb-collapse, .sb-overlay, .sb-section-title .bi { transition: none; }
}

@media print {
	.sb, .topbar, .sb-overlay { display: none !important; }
	body.app { padding-left: 0; background: #fff; color: #000; }
	html[data-theme="dark"] body.app .grupo { background: #fff; color: #000; }
}

/* =====================================================================
   Complementos compartilhados com os portais
   ===================================================================== */
/* páginas que abrem o próprio <div class="container"> depois do header.php */
body.app > .container {
	width: 100%;
	max-width: 1320px;
	margin: 0;
	padding: 24px 28px 32px;
}
body.app .grupo + .grupo { margin-top: 16px; }
@media (max-width: 991px) {
	body.app > .container { padding: 16px; }
}

/* boas-vindas */
.hero {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 22px 24px;
	margin-bottom: 4px;
	border-radius: 16px;
	color: #fff;
	background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
	box-shadow: 0 10px 24px -12px rgba(79, 70, 229, .55);
}
.hero h1 { margin: 0 0 4px; font-size: 22px; font-weight: 700; color: #fff !important; letter-spacing: -.01em; }
.hero p { margin: 0; opacity: .9; font-size: 14px; }
.hero .hero-ico {
	width: 52px; height: 52px;
	flex-shrink: 0;
	border-radius: 14px;
	display: grid;
	place-items: center;
	font-size: 26px;
	background: rgba(255, 255, 255, .18);
}
@media (max-width: 575px) {
	.hero { padding: 18px; }
	.hero .hero-ico { display: none; }
	.hero h1 { font-size: 19px; }
}

/* grade de cards */
.cards {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
	gap: 16px;
}
.card-app {
	position: relative;
	display: flex;
	flex-direction: column;
	padding: 20px;
	background: var(--c-surface);
	border: 1px solid var(--c-border);
	border-radius: 16px;
	box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
	color: var(--c-text);
}
a.card-app { text-decoration: none !important; transition: border-color .15s, box-shadow .15s, transform .15s; }
a.card-app:hover { border-color: var(--c-primary); box-shadow: 0 10px 24px -14px rgba(79, 70, 229, .45); transform: translateY(-1px); color: var(--c-text); }
html[data-theme="dark"] body.app a.card-app { color: var(--c-text); }
/* card de atalho */
.atalho-ico {
	width: 44px; height: 44px;
	margin-bottom: 14px;
	border-radius: 12px;
	display: grid;
	place-items: center;
	font-size: 21px;
	color: var(--c-primary);
	background: var(--c-primary-soft);
}
.atalho-titulo { font-size: 15px; font-weight: 700; margin: 0 0 4px; }
.atalho-texto { color: var(--c-muted); font-size: 13px; margin: 0; }
.atalho-num { font-size: 26px; font-weight: 700; line-height: 1; margin-bottom: 4px; color: var(--c-text); }
.atalho-acao { margin-top: 14px; font-size: 13px; font-weight: 600; color: var(--c-primary); display: inline-flex; align-items: center; gap: 6px; }
.atalho-ico.verde { color: #16a34a; background: rgba(22, 163, 74, .12); }
.atalho-ico.ambar { color: #d97706; background: rgba(217, 119, 6, .12); }
html[data-theme="dark"] body.app .atalho-acao { color: var(--c-primary); }
body.app .grupo legend { font-size: 19px; font-weight: 700; border-bottom-color: var(--c-border); padding-bottom: 10px; }
body.app .grupo .form-control { border-radius: 10px; height: 42px; box-shadow: none; }
body.app .grupo textarea.form-control { height: auto; }
body.app .grupo .btn-lg { font-size: 15px; padding: 9px 20px; border-radius: 10px; }
body.app .btn-primary { background: linear-gradient(135deg, #4f46e5 0%, #5b5bf0 100%); border-color: transparent; }
body.app .btn-primary:hover, body.app .btn-primary:focus { filter: brightness(1.06); border-color: transparent; }

/* rótulos longos no menu lateral quebram linha em vez de cortar */
.sb-link { white-space: normal; }
.sb-label { line-height: 1.3; }

/* ---------- cabeçalho das páginas internas ---------- */
.pg-head { margin-bottom: 18px; }
.pg-titulo { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 21px; font-weight: 700; letter-spacing: -.01em; color: var(--c-text); }
.pg-titulo .bi { color: var(--c-primary); }
.pg-sub { margin: 4px 0 0; color: var(--c-muted); font-size: 13.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-info {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 4px 10px;
	border-radius: 999px;
	font-size: 12.5px;
	color: var(--c-muted);
	background: var(--c-surface);
	border: 1px solid var(--c-border);
}
.chip-info b { color: var(--c-text); font-weight: 600; }

/* tabelas */
.tabela-app {
	border: 1px solid var(--c-border);
	border-radius: 12px;
	margin-bottom: 0;
	overflow-x: auto;
}
.tabela-app .table { margin: 0; background: var(--c-surface); }
.tabela-app .table > thead > tr > th,
.tabela-app .table > tbody > tr > th {
	background: var(--c-surface-2);
	color: var(--c-muted);
	font-size: 12px;
	font-weight: 600;
	letter-spacing: .03em;
	text-transform: uppercase;
	border-top: 0;
	border-bottom: 1px solid var(--c-border);
	padding: 10px 12px;
	white-space: nowrap;
}
.tabela-app .table > tbody > tr > td {
	border-top: 1px solid var(--c-border);
	padding: 9px 12px;
	vertical-align: middle;
}
.tabela-app .table-bordered { border: 0; }
.tabela-app .table-bordered > tbody > tr > td,
.tabela-app .table-bordered > tbody > tr > th,
.tabela-app .table-bordered > thead > tr > th { border-left: 0; border-right: 0; }

body.app .app-container { margin-left: 0; margin-right: 0; }

/* =====================================================================
   Biblioteca
   ===================================================================== */
body.app .badge { background: var(--c-primary-soft); color: var(--c-primary); font-weight: 600; border-radius: 999px; padding: 4px 9px; }
body.app .alert { border-radius: 12px; }
body.app .modal-content { border: 1px solid var(--c-border); border-radius: 16px; box-shadow: 0 24px 60px -20px rgba(15, 23, 42, .35); overflow: hidden; }
body.app .modal-header { border-bottom-color: var(--c-border); padding: 16px 20px; }
body.app .modal-title { font-weight: 700; display: flex; align-items: center; gap: 8px; }
body.app .modal-title .bi { color: var(--c-primary); }
body.app .modal-body { padding: 20px; }
body.app .modal-footer { border-top-color: var(--c-border); }
body.app .modal .form-control { border-radius: 10px; height: 42px; box-shadow: none; }
body.app .modal .btn-lg { font-size: 15px; padding: 9px 20px; border-radius: 10px; }
body.app .btn { border-radius: 10px; }
.btn-bloco { display: flex; width: 100%; justify-content: center; align-items: center; gap: 8px; }
.texto-ajuda { color: var(--c-muted); font-size: 13px; }

/* passos (modal de reservas) */
.passos { list-style: none; margin: 0 0 18px; padding: 0; counter-reset: passo; }
.passos li { position: relative; padding: 4px 0 10px 40px; color: var(--c-link); counter-increment: passo; }
.passos li::before {
	content: counter(passo);
	position: absolute; left: 0; top: 0;
	width: 28px; height: 28px;
	border-radius: 50%;
	display: grid; place-items: center;
	font-size: 13px; font-weight: 700;
	color: var(--c-primary);
	background: var(--c-primary-soft);
}
.condicoes { list-style: none; margin: 0; padding: 0; }
.condicoes li { display: flex; align-items: center; gap: 10px; padding: 6px 0; color: var(--c-link); }
.condicoes li .bi { color: #16a34a; }
.sub-titulo { font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--c-faint); margin: 0 0 12px; }

/* faixa do usuário (renovação / extrato / reserva) */
.usuario-faixa {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 14px 16px;
	margin-bottom: 18px;
	border: 1px solid var(--c-border);
	border-radius: 14px;
	background: var(--c-surface-2);
}
.usuario-faixa .avatar { width: 46px; height: 46px; font-size: 15px; }
.usuario-faixa-nome { font-weight: 700; font-size: 15.5px; margin: 0 0 2px; }
.usuario-faixa-meta { color: var(--c-muted); font-size: 13px; overflow-wrap: anywhere; }

/* formulário de pesquisa */
.busca {
	display: grid;
	grid-template-columns: 170px 150px 1fr auto;
	gap: 10px;
}
.busca-campo { position: relative; }
.busca-campo .bi { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--c-faint); font-size: 16px; pointer-events: none; z-index: 3; }
body.app .busca .form-control { height: 46px; border-radius: 12px; width: 100%; }
body.app .busca-campo .form-control { padding-left: 40px; }
body.app .busca .btn { height: 46px; border-radius: 12px; padding: 0 22px; display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
@media (max-width: 767px) {
	.busca { grid-template-columns: 1fr 1fr; }
	.busca-campo, .busca .btn { grid-column: 1 / -1; }
	body.app .busca .btn { justify-content: center; }
}
.busca-total { display: flex; align-items: center; gap: 8px; margin: 22px 0 12px; color: var(--c-muted); font-size: 14px; }
.busca-total b { color: var(--c-text); }

/* resultado da pesquisa / novidades */
.livros { display: flex; flex-direction: column; gap: 12px; }
.livro {
	display: flex;
	gap: 16px;
	padding: 16px 18px;
	background: var(--c-surface);
	border: 1px solid var(--c-border);
	border-radius: 14px;
	transition: border-color .15s, box-shadow .15s;
}
.livro + .livro { margin-top: 12px; }
.livros > .livro + .livro { margin-top: 0; }
.livro:hover { border-color: rgba(79, 70, 229, .35); box-shadow: 0 10px 24px -18px rgba(79, 70, 229, .5); }
.livro-ico {
	width: 44px; height: 56px;
	flex-shrink: 0;
	border-radius: 6px 10px 10px 6px;
	display: grid;
	place-items: center;
	font-size: 20px;
	color: #fff;
	background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
	box-shadow: inset 4px 0 0 rgba(0, 0, 0, .15);
}
.livro-ico.periodico { background: linear-gradient(135deg, #0891b2 0%, #3b82f6 100%); }
.livro-corpo { flex: 1; min-width: 0; }
.livro-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; }
.livro-ref { color: var(--c-link); line-height: 1.55; overflow-wrap: anywhere; }
.livro-ref b { color: var(--c-text); }
.livro-assuntos { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.livro-acoes { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex-shrink: 0; }
.livro-num { font-size: 12px; font-weight: 700; color: var(--c-faint); }
.tag {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 3px 9px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.5;
	color: var(--c-muted);
	background: var(--c-surface-2);
	border: 1px solid var(--c-border);
	white-space: nowrap;
}
.tag.primaria { color: var(--c-primary); background: var(--c-primary-soft); border-color: transparent; }
.tag.verde { color: #15803d; background: rgba(22, 163, 74, .1); border-color: rgba(22, 163, 74, .25); }
.tag.ambar { color: #b45309; background: rgba(217, 119, 6, .1); border-color: rgba(217, 119, 6, .25); }
.tag.vermelha { color: var(--c-danger); background: var(--c-danger-soft); border-color: rgba(220, 38, 38, .25); }
.tag.mono { font-family: Consolas, "Courier New", monospace; font-weight: 500; }
a.tag-assunto, span.tag-assunto {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 8px;
	font-size: 12.5px;
	color: var(--c-link);
	background: var(--c-surface-2);
	border: 1px solid var(--c-border);
	text-decoration: none !important;
	transition: border-color .15s, color .15s;
}
a.tag-assunto:hover { border-color: var(--c-primary); color: var(--c-primary); }
html[data-theme="dark"] body.app a.tag-assunto { color: var(--c-link); }
html[data-theme="dark"] body.app a.tag-assunto:hover { color: var(--c-primary); }
html[data-theme="dark"] .tag.verde { color: #86efac; }
html[data-theme="dark"] .tag.ambar { color: #fcd34d; }
body.app .livro-acoes .btn { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
@media (max-width: 575px) {
	.livro { flex-wrap: wrap; padding: 14px; gap: 12px; }
	.livro-ico { display: none; }
	.livro-acoes { width: 100%; flex-direction: row; justify-content: space-between; align-items: center; }
}
.carregando { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 18px; color: var(--c-muted); }
.spinner {
	width: 20px; height: 20px;
	border-radius: 50%;
	border: 2px solid var(--c-border);
	border-top-color: var(--c-primary);
	animation: girar .7s linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }

/* ficha do título */
.ficha-livro { display: grid; grid-template-columns: 180px 1fr; margin: 0 0 22px; border: 1px solid var(--c-border); border-radius: 12px; overflow: hidden; }
.ficha-livro dt, .ficha-livro dd { padding: 10px 14px; border-top: 1px solid var(--c-border); margin: 0; }
.ficha-livro dt:first-of-type, .ficha-livro dd:first-of-type { border-top: 0; }
.ficha-livro dt { background: var(--c-surface-2); color: var(--c-muted); font-size: 12.5px; font-weight: 600; }
.ficha-livro dd { color: var(--c-text); overflow-wrap: anywhere; }
@media (max-width: 575px) {
	.ficha-livro { grid-template-columns: 1fr; }
	.ficha-livro dd { border-top: 0; padding-top: 0; }
}
.voltar { display: inline-flex; align-items: center; gap: 6px; margin-top: 18px; font-weight: 600; }

/* extrato */
a.card-app.stat { cursor: pointer; }
a.card-app.stat.vazio { cursor: default; }
a.card-app.stat.vazio:hover { border-color: var(--c-border); box-shadow: none; transform: none; }
.atalho-ico.vermelho { color: var(--c-danger); background: var(--c-danger-soft); }
body.app .bootgrid-header, body.app .bootgrid-footer { margin: 0 0 10px; }
body.app .bootgrid-footer { margin-top: 10px; }

/* renovação */
.renovar-acoes { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 16px; }
.renovar-acoes .btn { display: inline-flex; align-items: center; gap: 8px; }
.motivos { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.tabela-app input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--c-primary); cursor: pointer; }
.tabela-app input[type=checkbox]:disabled { cursor: not-allowed; opacity: .45; }

/* logout */
body.app.saida { padding-left: 0; }
.saida-box { flex: 1; display: grid; place-items: center; padding: 16px; }
.saida-box .card-app { max-width: 380px; width: 100%; align-items: center; text-align: center; }

/* títulos de seção */
.sec-titulo { display: flex; align-items: center; gap: 8px; margin: 26px 0 12px; font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--c-faint); }
.sec-titulo:first-child { margin-top: 0; }
