/**
 * TainacanBiblio — Frontend areas (login, reader, desk).
 *
 * All rules are scoped under .tbf so themes are not affected. Tokens mirror
 * the Tainacan theme variables with fallbacks.
 */

.tbf {
    --tbf-primary:        var(--tainacan-turquoise5, #298596);
    --tbf-primary-dark:   var(--tainacan-turquoise6, #1d6470);
    --tbf-primary-light:  var(--tainacan-turquoise1, #e8f4f6);
    --tbf-accent:         var(--tainacan-blue5, #1d3557);
    --tbf-ink:            #1f2937;
    --tbf-ink-soft:       #374151;
    --tbf-muted:          #6b7280;
    --tbf-border:         #e5e7eb;
    --tbf-bg:             #f6f8fa;
    --tbf-card:           #ffffff;
    --tbf-success:        #1e7e34;
    --tbf-success-bg:     #e8f5e9;
    --tbf-warning:        #9a5b00;
    --tbf-warning-bg:     #fff7e0;
    --tbf-danger:         #b42318;
    --tbf-danger-bg:      #fdecea;
    --tbf-info-bg:        #eef6ff;
    --tbf-radius:         var(--tainacan-button-border-radius, 8px);
    --tbf-radius-lg:      12px;
    --tbf-shadow:         0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.1);
    --tbf-shadow-lg:      0 10px 30px rgba(16, 24, 40, 0.12);

    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--tbf-ink);
    line-height: 1.5;
    font-size: 15px;
    box-sizing: border-box;
    max-width: 1120px;
    margin: 0 auto;
}
.tbf *, .tbf *::before, .tbf *::after { box-sizing: inherit; }
.tbf [hidden] { display: none !important; }
.tbf a { color: var(--tbf-primary); }
.tbf a:hover { color: var(--tbf-primary-dark); }
.tbf code { background: #f1f3f5; padding: 1px 6px; border-radius: 4px; font-size: 0.92em; }
.tbf h2, .tbf h3, .tbf h4 { margin: 0; line-height: 1.25; color: var(--tbf-ink); }

/* Títulos sobre as superfícies escuras (faixa do leitor e carteirinha).
   Precisam bater a regra acima — que é mais específica que uma classe só — e
   também temas que pintam headings dentro do conteúdo do post. Fundo é um
   gradiente turquesa fixo nos dois casos, então o branco vale nos dois temas. */
.tbf .tbf-summary__name,
.tbf .tbf-idcard__name { color: #fff !important; }
.tbf p { margin: 0 0 0.6em; }
.tbf p:last-child { margin-bottom: 0; }

/* ── Primitives ─────────────────────────────────────────────────────────── */
.tbf-eyebrow { margin: 0; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--tbf-muted); font-weight: 700; }
.tbf-muted { color: var(--tbf-muted); font-size: 14px; }
.tbf-h3 { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.tbf-h4 { font-size: 15px; font-weight: 700; margin: 18px 0 10px; color: var(--tbf-ink-soft); }
.tbf-h4:first-child { margin-top: 0; }
.tbf-note { margin-top: 16px; padding: 10px 14px; background: var(--tbf-bg); border-radius: var(--tbf-radius); font-size: 14px; color: var(--tbf-muted); }
.tbf-link { background: none; border: 0; padding: 0; color: var(--tbf-primary); cursor: pointer; font: inherit; font-weight: 600; }
.tbf-link:hover { text-decoration: underline; }
.tbf-alt-action { margin-top: 14px; }

.tbf-logo {
    display: inline-block; width: 44px; height: 44px; border-radius: 12px; flex: 0 0 44px;
    background: linear-gradient(135deg, var(--tbf-primary), var(--tbf-primary-dark));
    position: relative;
}
.tbf-logo::after {
    content: ""; position: absolute; inset: 12px 13px; border-radius: 3px;
    background: linear-gradient(90deg, #fff 0 22%, transparent 22% 39%, #fff 39% 61%, transparent 61% 78%, #fff 78%);
    opacity: 0.95;
}

.tbf-card {
    background: var(--tbf-card); border: 1px solid var(--tbf-border); border-radius: var(--tbf-radius-lg);
    box-shadow: var(--tbf-shadow); padding: 28px;
}

.tbf-badge {
    display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 700; background: #f1f3f5; color: var(--tbf-ink-soft); line-height: 1.6;
}
.tbf-badge--success { background: var(--tbf-success-bg); color: var(--tbf-success); }
.tbf-badge--warning { background: var(--tbf-warning-bg); color: var(--tbf-warning); }
.tbf-badge--danger  { background: var(--tbf-danger-bg);  color: var(--tbf-danger); }
.tbf-badge--info    { background: var(--tbf-info-bg);    color: #1d4ed8; }

.tbf-chip {
    display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700;
    background: var(--tbf-primary-light); color: var(--tbf-primary-dark); letter-spacing: 0.02em;
}
.tbf-chip--action {
    font-size: 13px; padding: 6px 14px; border: 1px solid var(--tbf-primary); background: #fff; color: var(--tbf-primary);
    cursor: pointer; transition: background 0.15s, color 0.15s;
}
.tbf-chip--action:hover { background: var(--tbf-primary); color: #fff; }
.tbf-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.tbf-counter {
    display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; font-size: 11px; font-weight: 700;
    background: var(--tbf-primary); color: #fff; text-align: center; line-height: 20px; margin-left: 4px; vertical-align: middle;
}

.tbf-notice {
    display: flex; flex-direction: column; gap: 6px; padding: 12px 16px; border-radius: var(--tbf-radius);
    border-left: 4px solid var(--tbf-primary); background: var(--tbf-primary-light); font-size: 14px; margin: 12px 0;
}
.tbf-notice--info    { border-left-color: #2563eb; background: var(--tbf-info-bg); }
.tbf-notice--warning { border-left-color: #f59e0b; background: var(--tbf-warning-bg); color: var(--tbf-warning); }
.tbf-notice--error   { border-left-color: var(--tbf-danger); background: var(--tbf-danger-bg); color: var(--tbf-danger); }
.tbf-notice--success { border-left-color: var(--tbf-success); background: var(--tbf-success-bg); color: var(--tbf-success); }

/* Card avulso de aviso (ex.: shortcode descontinuado apontando para o admin) */
.tbf-notice-card {
    max-width: 560px; margin: 24px auto; padding: 22px 26px;
    background: var(--tbf-card); border: 1px solid var(--tbf-border); border-left: 4px solid #f59e0b;
    border-radius: var(--tbf-radius-lg); box-shadow: var(--tbf-shadow);
}
.tbf-notice-card p + p { margin-top: 0.6em; }

/* Buttons */
.tbf-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px; border-radius: var(--tbf-radius); border: 1px solid transparent;
    font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; text-decoration: none !important;
    transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.05s; white-space: nowrap; line-height: 1.3;
}
.tbf-btn:active { transform: translateY(1px); }
.tbf-btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.tbf-btn--primary { background: var(--tbf-primary); color: #fff !important; }
.tbf-btn--primary:hover:not(:disabled) { background: var(--tbf-primary-dark); }
.tbf-btn--secondary { background: var(--tbf-primary-light); color: var(--tbf-primary-dark) !important; }
.tbf-btn--secondary:hover:not(:disabled) { background: #d6eaee; }
.tbf-btn--outline { background: #fff; color: var(--tbf-primary) !important; border-color: var(--tbf-primary); }
.tbf-btn--outline:hover:not(:disabled) { background: var(--tbf-primary-light); }
.tbf-btn--ghost { background: transparent; color: var(--tbf-ink-soft) !important; border-color: var(--tbf-border); }
.tbf-btn--ghost:hover:not(:disabled) { background: var(--tbf-bg); }
.tbf-btn--danger { background: var(--tbf-danger); color: #fff !important; }
.tbf-btn--sm { padding: 6px 12px; font-size: 13px; }
.tbf-btn--lg { padding: 13px 22px; font-size: 15px; }
.tbf-btn--block { width: 100%; }
.tbf-btn.is-busy { position: relative; color: transparent !important; pointer-events: none; }
.tbf-btn.is-busy::after {
    content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.5); border-top-color: #fff; animation: tbf-spin 0.7s linear infinite;
}
.tbf-btn--outline.is-busy::after, .tbf-btn--ghost.is-busy::after, .tbf-btn--secondary.is-busy::after {
    border-color: rgba(41,133,150,0.3); border-top-color: var(--tbf-primary);
}
@keyframes tbf-spin { to { transform: rotate(360deg); } }
.tbf-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 22px; flex-wrap: wrap; }
.tbf-actions--center { justify-content: center; }

/* Forms */
.tbf-field { display: flex; flex-direction: column; gap: 5px; font-size: 14px; }
.tbf-field__label { font-weight: 600; color: var(--tbf-ink-soft); font-size: 13px; }
.tbf-field__label em { color: var(--tbf-danger); font-style: normal; }
.tbf-field__label small { font-weight: 400; color: var(--tbf-muted); }
.tbf-field input[type="text"], .tbf-field input[type="password"], .tbf-field input[type="number"],
.tbf-field input[type="search"], .tbf-field input[type="email"], .tbf-field select, .tbf-field textarea,
.tbf-input {
    width: 100%; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: var(--tbf-radius);
    font: inherit; font-size: 15px; color: var(--tbf-ink); background: #fff; transition: border-color 0.15s, box-shadow 0.15s;
}
.tbf-field textarea { resize: vertical; min-height: 70px; }
.tbf-field input:focus, .tbf-field select:focus, .tbf-field textarea:focus, .tbf-input:focus {
    outline: none; border-color: var(--tbf-primary); box-shadow: 0 0 0 3px rgba(41,133,150,0.18);
}
.tbf-field__password { position: relative; display: block; }
.tbf-field__password input { padding-right: 44px; }
.tbf-field__toggle {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0;
    color: var(--tbf-muted); cursor: pointer; font-size: 16px; padding: 6px; line-height: 1;
}
.tbf-field__group { display: flex; gap: 8px; }
.tbf-field__group select { flex: 0 0 auto; width: auto; max-width: 55%; }
.tbf-field__group input { flex: 1; }
.tbf-field--action { justify-content: flex-end; }
.tbf-input--xl { padding: 14px 16px; font-size: 18px; letter-spacing: 0.02em; }
.tbf-input--search { max-width: 320px; }
.tbf-inline-form { display: flex; gap: 8px; margin: 12px 0 16px; }
.tbf-inline-form input { flex: 1; }
.tbf-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 12px 14px; }
.tbf-grid--biblio > .tbf-field { grid-column: span 12; }
.tbf-col-4  { grid-column: span 4 !important; }
.tbf-col-6  { grid-column: span 6 !important; }
.tbf-col-8  { grid-column: span 8 !important; }
.tbf-col-12 { grid-column: span 12 !important; }
.tbf-switch { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; margin-top: 4px; }
.tbf-switch input { width: 18px; height: 18px; }

/* Scan row (barcode-first inputs) */
.tbf-scan { margin-bottom: 14px; }
.tbf-scan__label { display: block; font-weight: 700; margin-bottom: 8px; color: var(--tbf-ink-soft); }
.tbf-scan__row { display: flex; gap: 10px; }
.tbf-scan__row input { flex: 1; }
.tbf-scan__hint { margin: 8px 0 0; font-size: 13px; color: var(--tbf-muted); }

/* Tables */
.tbf-table-wrap { overflow-x: auto; }
.tbf-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbf-table th, .tbf-table td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--tbf-border); vertical-align: middle; }
.tbf-table th { background: var(--tbf-bg); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--tbf-muted); }
.tbf-table tbody tr:hover { background: #fbfcfd; }
.tbf-table__actions { text-align: right; width: 1%; white-space: nowrap; }
.tbf-table td.tbf-table__actions { text-align: right; }
/* Rodapé das listas: quantos itens mostrar, quantos existem e a navegação
   entre páginas. Em tela estreita quebra em duas linhas em vez de espremer. */
/* QR da carteirinha: ao lado das barras, com o mesmo número. */
.tbf-idcard__qr { margin-top: 8px; display: flex; justify-content: center; }
.tbf-idcard__qr svg { width: 128px; height: 128px; background: #fff; border-radius: 6px; }
.tbf-present__qr { margin-top: 14px; display: flex; justify-content: center; }
.tbf-present__qr svg { width: 220px; height: 220px; background: #fff; border-radius: 8px; padding: 6px; }

.tbf-listfoot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
    padding: 10px 2px;
    font-size: 13px;
    color: var(--tbf-muted);
}
.tbf-listfoot__per { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.tbf-listfoot__per .tbf-input { width: auto; min-width: 5.5em; padding: 4px 8px; font-size: 13px; }
.tbf-listfoot__count { white-space: nowrap; }
.tbf-listfoot__nav { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.tbf-listfoot__page { min-width: 3.5em; text-align: center; font-variant-numeric: tabular-nums; }
.tbf-listfoot__nav .tbf-btn { min-width: 2.25em; line-height: 1; }

.tbf-empty { text-align: center; padding: 36px 16px; color: var(--tbf-muted); }
.tbf-empty--sm { padding: 18px; font-size: 14px; }
.tbf-loading { text-align: center; padding: 36px 16px; color: var(--tbf-muted); }
.tbf-loading::before {
    content: ""; display: inline-block; width: 18px; height: 18px; border-radius: 50%; vertical-align: -4px; margin-right: 8px;
    border: 2px solid var(--tbf-border); border-top-color: var(--tbf-primary); animation: tbf-spin 0.7s linear infinite;
}
.tbf-toolbar { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-bottom: 12px; }
.tbf-toolbar--between { justify-content: space-between; }

/* Tabs */
.tbf-tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--tbf-border); margin-bottom: 20px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -ms-overflow-style: none; }
.tbf-tabs::-webkit-scrollbar { width: 0; height: 0; }
.tbf-tab {
    background: none; border: 0; padding: 12px 16px; font: inherit; font-size: 14px; font-weight: 600; color: var(--tbf-muted);
    cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; transition: color 0.15s, border-color 0.15s;
}
.tbf-tab:hover { color: var(--tbf-ink); }
.tbf-tab.is-active { color: var(--tbf-primary-dark); border-bottom-color: var(--tbf-primary); }
.tbf-panel { display: none; }
.tbf-panel.is-active { display: block; }

/* Toasts */
.tbf-toasts { position: fixed; top: 20px; right: 20px; z-index: 99999; display: flex; flex-direction: column; gap: 8px; max-width: 360px; pointer-events: none; }
.tbf-toast {
    pointer-events: auto; padding: 12px 16px; border-radius: var(--tbf-radius); background: #1f2937; color: #fff; font-size: 14px;
    box-shadow: var(--tbf-shadow-lg); border-left: 4px solid var(--tbf-primary); animation: tbf-slide-in 0.2s ease-out; white-space: pre-line;
}
.tbf-toast--success { border-left-color: #4ade80; }
.tbf-toast--error   { border-left-color: #f87171; }
.tbf-toast--warning { border-left-color: #fbbf24; }
@keyframes tbf-slide-in { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }

/* ── Shell / header ─────────────────────────────────────────────────────── */
.tbf-shell { display: flex; flex-direction: column; gap: 18px; }
.tbf-header {
    display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
    padding: 16px 22px; background: var(--tbf-card); border: 1px solid var(--tbf-border); border-radius: var(--tbf-radius-lg); box-shadow: var(--tbf-shadow);
}
.tbf-header__brand { display: flex; align-items: center; gap: 12px; }
.tbf-header__title { font-size: 20px; font-weight: 800; }
.tbf-nav { display: flex; gap: 4px; background: var(--tbf-bg); padding: 4px; border-radius: 999px; }
.tbf-nav__link {
    padding: 7px 16px; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--tbf-ink-soft) !important; text-decoration: none !important;
    transition: background 0.15s, color 0.15s;
}
.tbf-nav__link:hover { background: #e9edf1; }
.tbf-nav__link.is-active { background: var(--tbf-primary); color: #fff !important; }
.tbf-user { display: flex; align-items: center; gap: 14px; }
.tbf-user__meta { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.tbf-user__name { font-weight: 700; font-size: 14px; }
.tbf-user__roles { display: flex; gap: 4px; }
.tbf-user__actions { display: flex; gap: 6px; }

.tbf-area { background: var(--tbf-card); border: 1px solid var(--tbf-border); border-radius: var(--tbf-radius-lg); box-shadow: var(--tbf-shadow); padding: 24px; }

/* ── Login ──────────────────────────────────────────────────────────────── */
.tbf-login { max-width: 460px; margin: 24px auto; }
.tbf-login__card { padding: 32px; }
.tbf-login__head { display: flex; gap: 14px; align-items: center; margin-bottom: 22px; }
.tbf-login__title { font-size: 22px; font-weight: 800; }
.tbf-login__context { color: var(--tbf-muted); font-size: 14px; }
.tbf-login__form { display: flex; flex-direction: column; gap: 14px; }
.tbf-login__error { padding: 10px 14px; border-radius: var(--tbf-radius); background: var(--tbf-danger-bg); color: var(--tbf-danger); font-size: 14px; font-weight: 600; }
.tbf-login__foot { display: flex; gap: 10px; justify-content: center; margin-top: 18px; font-size: 14px; }
.tbf-login__foot a { font-weight: 600; text-decoration: none; }
.tbf-login__foot a:hover { text-decoration: underline; }
.tbf-login__help { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--tbf-border); font-size: 13px; color: var(--tbf-muted); text-align: center; }

/* ── Hub / denied ───────────────────────────────────────────────────────── */
.tbf-hub, .tbf-denied { max-width: 820px; margin: 24px auto; }
.tbf-hub__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
.tbf-hub__name { font-size: 24px; font-weight: 800; }
.tbf-hub__intro { color: var(--tbf-muted); margin-bottom: 12px; }
.tbf-hub__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.tbf-hub__tile {
    display: flex; flex-direction: column; gap: 6px; padding: 18px; border: 1px solid var(--tbf-border); border-radius: var(--tbf-radius-lg);
    text-decoration: none !important; color: inherit !important; background: #fff; transition: box-shadow 0.15s, transform 0.15s, border-color 0.15s;
}
.tbf-hub__tile:hover { box-shadow: var(--tbf-shadow-lg); transform: translateY(-2px); border-color: var(--tbf-primary); }
.tbf-hub__tile-icon { width: 40px; height: 40px; border-radius: 10px; background: var(--tbf-primary-light); position: relative; margin-bottom: 4px; }
.tbf-hub__tile-icon::after { content: ""; position: absolute; inset: 11px; border-radius: 3px; background: var(--tbf-primary); opacity: 0.85; }
.tbf-hub__tile--desk    .tbf-hub__tile-icon::after { inset: 14px 9px; border-radius: 2px; }
.tbf-hub__tile--catalog .tbf-hub__tile-icon::after { inset: 9px 12px; border-radius: 2px 6px 6px 2px; }
.tbf-hub__tile--reader  .tbf-hub__tile-icon::after { border-radius: 50%; inset: 10px; }
.tbf-hub__tile-label { font-weight: 800; font-size: 16px; }
.tbf-hub__tile-desc { font-size: 13px; color: var(--tbf-muted); }
.tbf-hub__admin { margin-top: 18px; font-size: 14px; }
.tbf-denied__title { font-size: 22px; font-weight: 800; margin: 4px 0 8px; }
.tbf-denied__reason { color: var(--tbf-ink-soft); }
.tbf-denied__who { font-size: 14px; color: var(--tbf-muted); margin: 10px 0 18px; }
.tbf-denied__who a { margin-left: 8px; }
.tbf-denied__alt { font-weight: 700; margin-bottom: 10px; }

/* ── Reader ─────────────────────────────────────────────────────────────── */
.tbf-summary {
    display: flex; justify-content: space-between; align-items: center; gap: 18px; flex-wrap: wrap;
    padding: 20px 22px; margin: -24px -24px 20px; border-radius: var(--tbf-radius-lg) var(--tbf-radius-lg) 0 0;
    background: linear-gradient(135deg, var(--tbf-primary) 0%, var(--tbf-primary-dark) 100%); color: #fff;
}
.tbf-summary .tbf-eyebrow { color: rgba(255,255,255,0.75); }
.tbf-summary__name { font-size: 24px; font-weight: 800; }
.tbf-summary__card { margin: 4px 0 0; font-size: 13px; opacity: 0.9; }
.tbf-summary__card code { background: rgba(255,255,255,0.18); color: #fff; }
.tbf-summary__warn { width: 100%; margin: 4px 0 0; font-size: 13px; font-weight: 600; background: rgba(0,0,0,0.18); padding: 8px 12px; border-radius: var(--tbf-radius); }
.tbf-summary__stats { display: flex; gap: 12px; }
/* Os números são atalhos para a seção: precisam parecer e responder como botão. */
.tbf-stat {
    text-align: center; padding: 10px 18px; background: rgba(255,255,255,0.14); border-radius: var(--tbf-radius);
    min-width: 96px; border: 0; color: inherit; font: inherit; cursor: pointer;
    transition: background 0.15s, transform 0.12s;
}
.tbf-stat:hover { background: rgba(255,255,255,0.24); }
.tbf-stat:active { transform: translateY(1px); }
.tbf-stat:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.tbf-stat__value { display: block; font-size: 24px; font-weight: 800; line-height: 1.1; }
.tbf-stat__label { font-size: 12px; opacity: 0.85; }
.tbf-alerts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.tbf-alert { padding: 10px 16px; border-radius: var(--tbf-radius); font-size: 14px; font-weight: 600; border-left: 4px solid transparent; }
.tbf-alert--danger  { background: var(--tbf-danger-bg);  color: var(--tbf-danger);  border-left-color: var(--tbf-danger); }
.tbf-alert--warning { background: var(--tbf-warning-bg); color: var(--tbf-warning); border-left-color: #f59e0b; }
.tbf-alert--success { background: var(--tbf-success-bg); color: var(--tbf-success); border-left-color: var(--tbf-success); }
.tbf-status--overdue { color: var(--tbf-danger); font-weight: 700; }
.tbf-status--soon    { color: var(--tbf-warning); font-weight: 700; }
.tbf-status--ready   { color: var(--tbf-success); font-weight: 700; }

/* Listas do leitor: cartões, não tabelas. Cinco colunas não cabem num celular
   e o que importa (título, prazo e a ação) precisa ficar empilhado. */
.tbf-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.tbf-item {
    padding: 14px 16px; background: var(--tbf-card); border: 1px solid var(--tbf-border);
    border-left: 4px solid var(--tbf-border); border-radius: var(--tbf-radius);
    display: flex; flex-direction: column; gap: 10px;
}
.tbf-item--ok     { border-left-color: var(--tbf-success); }
.tbf-item--warn   { border-left-color: #f59e0b; }
.tbf-item--danger { border-left-color: var(--tbf-danger); }
.tbf-item__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.tbf-item__title { font-weight: 700; font-size: 15px; line-height: 1.35; }
.tbf-item__title a { text-decoration: none; }
.tbf-item__title a:hover { text-decoration: underline; }
.tbf-item__facts { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 0; }
.tbf-item__facts dt { font-size: 10px; text-transform: uppercase; letter-spacing: 0.09em; color: var(--tbf-muted); font-weight: 700; }
.tbf-item__facts dd { margin: 1px 0 0; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tbf-item__actions { display: flex; gap: 8px; }
.tbf-item__actions .tbf-btn { min-height: 40px; }
.tbf-tag {
    flex: 0 0 auto; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em;
    padding: 4px 10px; border-radius: 999px; white-space: nowrap; background: #f1f3f5; color: var(--tbf-ink-soft);
}
.tbf-tag--ok     { background: var(--tbf-success-bg); color: var(--tbf-success); }
.tbf-tag--warn   { background: var(--tbf-warning-bg); color: var(--tbf-warning); }
.tbf-tag--danger { background: var(--tbf-danger-bg);  color: var(--tbf-danger); }

.tbf-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.tbf-section-head .tbf-h3 { margin-bottom: 0; }
.tbf-total {
    display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
    padding: 14px 16px; background: var(--tbf-danger-bg); border-radius: var(--tbf-radius); margin-bottom: 14px;
}
.tbf-total__label { font-size: 13px; font-weight: 600; color: var(--tbf-danger); }
.tbf-total__value { font-size: 24px; font-weight: 800; color: var(--tbf-danger); font-variant-numeric: tabular-nums; }
.tbf-note { font-size: 13px; color: var(--tbf-muted); margin-top: 12px; }
.tbf-area--reader .tbf-input--search { max-width: none; width: 100%; margin-bottom: 12px; }

/* Formulário empilhado (o grid de 12 colunas do balcão não serve no celular) */
.tbf-form { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }

/* Blocos recolhíveis de "Meus dados": só o que o leitor abriu ocupa a tela */
.tbf-fold { margin-top: 12px; border: 1px solid var(--tbf-border); border-radius: var(--tbf-radius); background: var(--tbf-card); }
.tbf-fold > summary {
    padding: 14px 16px; font-weight: 700; font-size: 15px; cursor: pointer; list-style: none;
    display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px;
}
.tbf-fold > summary::-webkit-details-marker { display: none; }
.tbf-fold > summary::after { content: "+"; font-size: 20px; font-weight: 400; color: var(--tbf-muted); line-height: 1; }
.tbf-fold[open] > summary::after { content: "−"; }
.tbf-fold[open] > summary { border-bottom: 1px solid var(--tbf-border); }
.tbf-fold > *:not(summary) { margin-left: 16px; margin-right: 16px; }
.tbf-fold > *:not(summary):first-of-type { margin-top: 14px; }
.tbf-fold > *:last-child { margin-bottom: 16px; }
.tbf-fold .tbf-readonly__grid { margin-top: 10px; }

.tbf-discover__intro h3 { font-size: 20px; margin-bottom: 4px; }
.tbf-discover__intro p { color: var(--tbf-muted); font-size: 14px; }
.tbf-answer { background: var(--tbf-primary-light); border-left: 4px solid var(--tbf-primary); border-radius: var(--tbf-radius); padding: 12px 16px; font-size: 14px; margin-bottom: 14px; white-space: pre-line; }
.tbf-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.tbf-cardlink {
    display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border: 1px solid var(--tbf-border); border-radius: var(--tbf-radius);
    text-decoration: none !important; color: inherit !important; background: #fff; transition: box-shadow 0.15s, transform 0.15s;
}
.tbf-cardlink:hover { box-shadow: var(--tbf-shadow-lg); transform: translateY(-2px); }
.tbf-cardlink__title { font-weight: 700; font-size: 14px; color: var(--tbf-primary-dark); }
.tbf-discover__suggestions { margin-top: 24px; }
.tbf-discover__suggestions h4 { margin-bottom: 10px; }
.tbf-prefs { display: flex; flex-direction: column; gap: 8px; margin: 14px 0 18px; }
.tbf-pref { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid var(--tbf-border); border-radius: var(--tbf-radius); cursor: pointer; font-size: 14px; }
.tbf-pref:hover { background: var(--tbf-bg); }
.tbf-pref input { width: 16px; height: 16px; }

/* ── Navegação inferior + folha "Mais" (só no celular) ──────────────────── */
/* A barra e a folha são movidas por JS para dentro de .tbf-layer, filho direto
   do <body>: dentro do conteúdo do tema, um ancestral com transform/filter faz
   o position:fixed passar a ser relativo a ele e a barra some para o fim da
   página. O <body class="tbf-bottomnav"> só é marcado depois desse movimento —
   é ele que autoriza esconder as abas do topo, então sem JS nada desaparece. */
.tbf-layer { max-width: none; margin: 0; }
.tbf-nav-bottom { display: none; }
.tbf-sheet { display: none; }
.tbf-i { width: 22px; height: 22px; stroke-linejoin: round; flex: 0 0 auto; }
body.tbf-noscroll { overflow: hidden; }

@media (max-width: 720px) {
    /* Abas do topo dão lugar à barra inferior */
    body.tbf-bottomnav .tbf-tabs--reader { display: none; }

    /* Espaço para a barra fixa não cobrir o fim do conteúdo (respeita a home bar) */
    body.tbf-bottomnav .tbf-area--reader { margin-bottom: calc(70px + env(safe-area-inset-bottom, 0px)); }

    /* !important porque o tema carrega CSS depois e estiliza <nav> livremente.
       Nada de !important na folha: ela depende do atributo [hidden] para fechar. */
    body.tbf-bottomnav .tbf-nav-bottom {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 99990;
        display: grid !important; grid-auto-flow: column; grid-auto-columns: 1fr;
        background: var(--tbf-card); border-top: 1px solid var(--tbf-border);
        box-shadow: 0 -2px 12px rgba(16, 24, 40, 0.08);
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    .tbf-nav-bottom__item {
        position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
        min-height: 58px; padding: 8px 4px; border: 0; background: none; cursor: pointer;
        font: inherit; font-size: 11px; font-weight: 600; color: var(--tbf-muted); line-height: 1.2;
    }
    .tbf-nav-bottom__item span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .tbf-nav-bottom__item.is-active { color: var(--tbf-primary); }
    .tbf-nav-bottom__item.is-active::before {
        content: ""; position: absolute; top: 0; left: 22%; right: 22%; height: 3px;
        background: var(--tbf-primary); border-radius: 0 0 3px 3px;
    }
    .tbf-nav-bottom__item:focus-visible { outline: 2px solid var(--tbf-primary); outline-offset: -2px; }
    .tbf-nav-bottom__badge {
        position: absolute; top: 5px; left: 50%; margin-left: 4px;
        min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
        background: var(--tbf-danger); color: #fff; font-size: 10px; font-weight: 800;
        display: flex; align-items: center; justify-content: center; line-height: 1;
    }

    body.tbf-bottomnav .tbf-sheet { display: block; position: fixed; inset: 0; z-index: 99991; }
    .tbf-sheet__backdrop { position: absolute; inset: 0; background: rgba(16, 24, 40, 0.45); }
    .tbf-sheet__panel {
        position: absolute; left: 0; right: 0; bottom: 0;
        background: var(--tbf-card); border-radius: 16px 16px 0 0; padding: 8px 12px calc(14px + env(safe-area-inset-bottom, 0px));
        max-height: 80vh; overflow-y: auto; animation: tbf-sheet-up 0.18s ease-out;
    }
    .tbf-sheet__grab { width: 40px; height: 4px; border-radius: 999px; background: var(--tbf-border); margin: 6px auto 10px; }
    .tbf-sheet__item {
        display: flex; align-items: center; gap: 14px; width: 100%; min-height: 52px;
        padding: 12px 10px; border: 0; background: none; cursor: pointer; text-align: left;
        font: inherit; font-size: 16px; font-weight: 600; color: var(--tbf-ink) !important; text-decoration: none !important;
        border-radius: var(--tbf-radius);
    }
    .tbf-sheet__item:hover, .tbf-sheet__item:focus-visible { background: var(--tbf-bg); }
    .tbf-sheet__item--out { color: var(--tbf-danger) !important; border-top: 1px solid var(--tbf-border); border-radius: 0; margin-top: 6px; }
    @keyframes tbf-sheet-up { from { transform: translateY(100%); } to { transform: none; } }
}
@media (max-width: 720px) and (prefers-reduced-motion: reduce) {
    .tbf-sheet__panel { animation: none; }
}

/* ── Modo app: área do leitor em tela cheia, sem o tema ─────────────────── */
/* .tbf-app-frame é a cadeia de ancestrais do shell até o <body>; .tbf-app-off
   é todo o resto (cabeçalho, menu, rodapé, sidebar, barra de admin). As duas
   classes são marcadas pelo JS — ver initAppMode(). Só valem no celular; no
   desktop a página continua sendo uma página do site, com o tema inteiro. */
@media (max-width: 720px) {
    body.tbf-app .tbf-app-off { display: none !important; }
    body.tbf-app .tbf-app-frame {
        max-width: none !important; width: auto !important; float: none !important;
        margin: 0 !important; padding: 0 !important; border: 0 !important;
        background: none !important; box-shadow: none !important;
    }
    body.tbf-app { margin: 0 !important; padding: 0 !important; background: #fff !important; }
    /* A barra de admin injeta margin-top no <html> com !important. */
    html.tbf-app-html { margin-top: 0 !important; }

    body.tbf-app .tbf-shell { gap: 0; }
    /* O cabeçalho do portal vira redundante: o nome já está na faixa do leitor
       e as ações (site, sair) estão na folha "Mais". */
    body.tbf-app .tbf-shell--reader .tbf-header { display: none; }

    body.tbf-app .tbf-area--reader {
        border: 0; border-radius: 0; box-shadow: none; padding: 16px;
        /* desconta a barra inferior, senão sobra scroll com a tela vazia */
        min-height: calc(100vh - 70px - env(safe-area-inset-bottom, 0px));
    }
    /* Faixa do leitor encosta no topo e passa por baixo da status bar. */
    body.tbf-app .tbf-summary {
        margin: -16px -16px 16px; border-radius: 0;
        padding-top: calc(16px + env(safe-area-inset-top, 0px));
    }
    body.tbf-app .tbf-toasts { top: calc(16px + env(safe-area-inset-top, 0px)); }

    /* Entrada da área do leitor: mesma tela cheia, sem cara de card solto */
    body.tbf-app .tbf-login { min-height: 100vh; display: flex; align-items: center; }
    body.tbf-app .tbf-login__card {
        width: 100%; border: 0; border-radius: 0; box-shadow: none;
        padding: calc(24px + env(safe-area-inset-top, 0px)) 20px calc(24px + env(safe-area-inset-bottom, 0px));
    }
}

/* ── Blocos compartilhados (balcão): conclusão, resultados, seleção ─────── */
.tbf-done { text-align: center; padding: 30px 12px; }
.tbf-done__icon { display: inline-flex; width: 64px; height: 64px; border-radius: 50%; background: var(--tbf-success-bg); color: var(--tbf-success); font-size: 34px; align-items: center; justify-content: center; margin-bottom: 12px; }
.tbf-done--inline { display: flex; align-items: center; gap: 16px; text-align: left; padding: 16px 18px; border: 1px solid var(--tbf-success); background: var(--tbf-success-bg); border-radius: var(--tbf-radius); margin-top: 16px; flex-wrap: wrap; }
.tbf-done--inline .tbf-done__icon { width: 40px; height: 40px; font-size: 20px; margin: 0; background: #fff; }
.tbf-done--inline .tbf-actions { margin: 0 0 0 auto; }
.tbf-results { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 16px; }
.tbf-result {
    display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; text-align: left;
    padding: 12px 14px; border: 1px solid var(--tbf-border); border-radius: var(--tbf-radius); background: #fff; cursor: pointer; font: inherit;
    transition: border-color 0.15s, background 0.15s;
}
.tbf-result:hover { border-color: var(--tbf-primary); background: var(--tbf-primary-light); }
.tbf-result__title { font-weight: 700; }
.tbf-result__meta { font-size: 13px; color: var(--tbf-muted); }
.tbf-results__head { margin: 0 0 2px; font-size: 12px; font-weight: 700; color: var(--tbf-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.tbf-selected { padding: 18px; border: 1px solid var(--tbf-primary); border-radius: var(--tbf-radius-lg); background: #fbfeff; }
.tbf-selected__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.tbf-selected__title { font-size: 18px; font-weight: 800; }

/* ── Desk ───────────────────────────────────────────────────────────────── */
.tbf-desk { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(320px, 1.3fr); gap: 24px; }
.tbf-patron { border: 1px solid var(--tbf-primary); border-radius: var(--tbf-radius-lg); padding: 16px 18px; background: #fbfeff; }
.tbf-patron__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.tbf-patron__name { font-size: 20px; font-weight: 800; }
.tbf-patron__meta { font-size: 13px; color: var(--tbf-muted); margin: 2px 0 0; }
.tbf-patron__stats { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 12px 0; font-size: 14px; }
.tbf-stat-inline strong { font-size: 16px; }
.tbf-details { border-top: 1px solid var(--tbf-border); padding: 8px 0; }
.tbf-details summary { cursor: pointer; font-weight: 700; font-size: 14px; list-style: none; display: flex; align-items: center; gap: 6px; }
.tbf-details summary::before { content: "▸"; font-size: 12px; color: var(--tbf-muted); transition: transform 0.15s; }
.tbf-details[open] summary::before { transform: rotate(90deg); }
.tbf-minilist { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.tbf-mini { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 10px; background: #fff; border: 1px solid var(--tbf-border); border-radius: var(--tbf-radius); font-size: 13px; }
.tbf-mini__title { font-weight: 600; }
.tbf-mini__meta { color: var(--tbf-muted); font-size: 12px; }
.tbf-mini--overdue { border-color: var(--tbf-danger); }
.tbf-session { margin-top: 12px; }
.tbf-feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tbf-feed__item {
    display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 14px; border-radius: var(--tbf-radius);
    border: 1px solid var(--tbf-border); background: #fff; animation: tbf-flash 0.8s ease-out;
}
.tbf-feed__item--ok      { border-left: 4px solid var(--tbf-success); }
.tbf-feed__item--warn    { border-left: 4px solid #f59e0b; background: var(--tbf-warning-bg); }
.tbf-feed__item--hold    { border-left: 4px solid #7c3aed; background: #f5f3ff; }
.tbf-feed__item--error   { border-left: 4px solid var(--tbf-danger); background: var(--tbf-danger-bg); }
.tbf-feed__title { font-weight: 700; }
.tbf-feed__meta { font-size: 13px; color: var(--tbf-muted); grid-column: 1 / -1; }
.tbf-feed__flag { font-weight: 800; font-size: 13px; }
.tbf-feed__item--hold .tbf-feed__flag { color: #6d28d9; }
.tbf-feed__item--warn .tbf-feed__flag { color: var(--tbf-warning); }
.tbf-feed__item--error .tbf-feed__flag { color: var(--tbf-danger); }
@keyframes tbf-flash { from { background-color: var(--tbf-primary-light); } }
.tbf-copycard { padding: 18px; border: 1px solid var(--tbf-border); border-radius: var(--tbf-radius-lg); background: #fff; margin-top: 8px; }
.tbf-copycard__title { font-size: 20px; font-weight: 800; }
.tbf-copycard__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px 18px; margin: 14px 0; font-size: 14px; }
.tbf-copycard__grid dt { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--tbf-muted); font-weight: 700; }
.tbf-copycard__grid dd { margin: 2px 0 0; font-weight: 600; }
.tbf-copycard__loan { padding: 12px 14px; border-radius: var(--tbf-radius); background: var(--tbf-bg); margin: 12px 0; font-size: 14px; }
.tbf-copycard__loan.is-overdue { background: var(--tbf-danger-bg); }

/* Desk: patrons / register / today */
.tbf-register { padding: 18px; border: 1px solid var(--tbf-border); border-radius: var(--tbf-radius-lg); background: var(--tbf-bg); }
.tbf-grid--register > .tbf-field, .tbf-grid--register > .tbf-notice, .tbf-grid--register > .tbf-actions { grid-column: span 12; }
.tbf-grid--register { margin-top: 12px; }
.tbf-chip--action.is-active { background: var(--tbf-primary); color: #fff; }
.tbf-tiles__row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 8px; }
.tbf-tile { padding: 16px; border-radius: var(--tbf-radius-lg); background: var(--tbf-bg); border: 1px solid var(--tbf-border); display: flex; flex-direction: column; gap: 4px; }
.tbf-tile__value { font-size: 30px; font-weight: 800; line-height: 1; color: var(--tbf-primary-dark); }
.tbf-tile__label { font-size: 12px; font-weight: 600; color: var(--tbf-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.tbf-tile--danger  { background: var(--tbf-danger-bg); border-color: #f5c2bd; }
.tbf-tile--danger  .tbf-tile__value { color: var(--tbf-danger); }
.tbf-tile--warning { background: var(--tbf-warning-bg); border-color: #f3dfa5; }
.tbf-tile--warning .tbf-tile__value { color: var(--tbf-warning); }
.tbf-tile--success { background: var(--tbf-success-bg); border-color: #b9dfbd; }
.tbf-tile--success .tbf-tile__value { color: var(--tbf-success); }

/* ── Carteirinha virtual ────────────────────────────────────────────────── */
/* Classe própria (.tbf-idcard) e não .tbf-card: o card genérico do login, do
   hub e da tela de acesso negado usa .tbf-card, e o gradiente da carteirinha
   os sobrescrevia por vir depois na folha. */
.tbf-idcard {
    max-width: 420px; margin: 0 auto; border-radius: 14px; overflow: hidden;
    background: linear-gradient(150deg, var(--tbf-primary) 0%, var(--tbf-primary-dark) 100%);
    color: #fff; box-shadow: var(--tbf-shadow-lg);
}
.tbf-idcard__top {
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
    padding: 14px 20px; background: rgba(0,0,0,0.14);
}
.tbf-idcard__library { font-size: 13px; font-weight: 700; letter-spacing: 0.03em; }
.tbf-idcard__badge { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; padding: 3px 10px; border-radius: 999px; }
.tbf-idcard__badge--ok  { background: #d6f5e3; color: #14532d; }
.tbf-idcard__badge--off { background: #ffe0dd; color: #7f1d1d; }
.tbf-idcard__body { padding: 20px 20px 6px; }
.tbf-idcard__label { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em; opacity: 0.75; margin: 0 0 2px; font-weight: 700; }
.tbf-idcard__name { font-size: 22px; font-weight: 800; margin: 0 0 14px; line-height: 1.2; }
.tbf-idcard__meta { display: flex; gap: 28px; font-size: 14px; font-weight: 600; }
.tbf-idcard__code { background: #fff; padding: 14px 20px 12px; text-align: center; }
.tbf-idcard__barcode svg { width: 100%; height: 74px; display: block; }
.tbf-idcard__number {
    display: block; margin-top: 6px; font-family: var(--mono, ui-monospace, monospace);
    font-size: 15px; letter-spacing: 0.16em; color: #111; font-weight: 700;
}
.tbf-panel__body--card { max-width: 460px; margin: 0 auto; }
.tbf-idcard__present { margin-top: 20px; }
.tbf-idcard__hint { text-align: center; font-size: 13px; margin-top: 8px; }

/* Modo de apresentação: código grande, fundo branco (leitura por scanner) */
.tbf-present {
    position: fixed; inset: 0; z-index: 100000; background: #fff; color: #111;
    display: flex; align-items: center; justify-content: center; padding: 24px;
}
body.tbf-present-open { overflow: hidden; }
.tbf-present__inner { display: flex; flex-direction: column; align-items: center; gap: 14px; width: 100%; max-width: 560px; text-align: center; }
.tbf-present__name { font-size: 20px; font-weight: 800; }
.tbf-present__barcode { width: 100%; }
.tbf-present__barcode svg { width: 100%; height: 190px; display: block; }
.tbf-present__number { font-family: var(--mono, ui-monospace, monospace); font-size: 26px; letter-spacing: 0.2em; font-weight: 700; }
.tbf-present__library { font-size: 13px; color: #555; }
.tbf-present__close {
    position: absolute; top: 14px; right: 16px; width: 44px; height: 44px; border-radius: 50%;
    border: 1px solid #ddd; background: #fff; color: #333; font-size: 26px; line-height: 1; cursor: pointer;
}
.tbf-present__close:hover { background: #f2f2f2; }

/* Meus dados */
.tbf-grid--profile > .tbf-field, .tbf-grid--profile > .tbf-notice, .tbf-grid--profile > .tbf-actions { grid-column: span 12; }
.tbf-grid--profile { margin: 14px 0 6px; }
.tbf-sep { border: 0; border-top: 1px solid var(--tbf-border); margin: 28px 0 22px; }
.tbf-readonly { margin-top: 18px; padding: 16px 18px; background: var(--tbf-bg); border-radius: var(--tbf-radius); }
.tbf-readonly__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px 20px; margin: 12px 0 0; }
.tbf-readonly__grid dt { font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--tbf-muted); font-weight: 700; }
.tbf-readonly__grid dd { margin: 2px 0 0; font-weight: 600; font-size: 14px; }

@media (max-width: 640px) {
    .tbf-idcard { max-width: none; }
    .tbf-present__barcode svg { height: 150px; }
    .tbf-present__number { font-size: 21px; }
}

/* Desk: patron management + fines */
.tbf-manage { margin: 10px 0 6px; }
.tbf-manage__bar { display: flex; flex-wrap: wrap; gap: 6px; }
.tbf-manage__panel { margin-top: 10px; padding: 14px; border: 1px solid var(--tbf-border); border-radius: var(--tbf-radius); background: #fff; }
.tbf-manage__panel.tbf-grid > .tbf-field, .tbf-manage__panel.tbf-grid > .tbf-notice, .tbf-manage__panel.tbf-grid > .tbf-actions { grid-column: span 12; }
.tbf-radio { display: flex; align-items: flex-start; gap: 8px; padding: 6px 0; cursor: pointer; font-size: 14px; }
.tbf-radio input { margin-top: 3px; }
.tbf-mini__actions { display: flex; gap: 4px; flex-shrink: 0; }
.tbf-num { text-align: right; white-space: nowrap; }
.tbf-table td.tbf-num { text-align: right; }
.tbf-fine-inline td { background: var(--tbf-bg); padding: 10px 12px; }
.tbf-fine-inline__box { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.tbf-fine-inline__box > strong { align-self: center; margin-right: 6px; }
.tbf-fine-inline__box .tbf-field { min-width: 140px; }
.tbf-fine-inline__grow { flex: 1; min-width: 200px; }
.tbf-notice--success { border-left-color: var(--tbf-success); background: var(--tbf-success-bg); color: var(--tbf-success); }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .tbf-desk { grid-template-columns: 1fr; }
    .tbf-header { flex-direction: column; align-items: stretch; }
    .tbf-user { justify-content: space-between; }
    .tbf-user__meta { align-items: flex-start; }
    .tbf-nav { justify-content: center; }
}
@media (max-width: 640px) {
    .tbf { font-size: 14px; }
    .tbf-area, .tbf-card { padding: 16px; }
    .tbf-summary { margin: -16px -16px 16px; padding: 16px; flex-direction: column; align-items: flex-start; }
    .tbf-summary__stats { width: 100%; justify-content: space-between; }
    .tbf-stat { flex: 1; min-width: 0; padding: 8px; }
    .tbf-col-4, .tbf-col-6, .tbf-col-8 { grid-column: span 12 !important; }
    .tbf-scan__row { flex-direction: column; }
    .tbf-inline-form { flex-direction: column; }
    .tbf-actions { flex-direction: column-reverse; align-items: stretch; }
    .tbf-actions .tbf-btn { width: 100%; }
    .tbf-toasts { left: 12px; right: 12px; max-width: none; }
    .tbf-done--inline { flex-direction: column; align-items: flex-start; }
    .tbf-done--inline .tbf-actions { margin: 0; }

    /* Leitor no celular */
    .tbf-summary__name { font-size: 20px; }
    .tbf-summary__stats { gap: 8px; }
    .tbf-stat { min-width: 0; padding: 8px 6px; }
    .tbf-stat__value { font-size: 20px; }
    .tbf-stat__label { font-size: 11px; }
    .tbf-item { padding: 13px 14px; }
    .tbf-item__facts { gap: 4px 18px; }
    .tbf-section-head { flex-wrap: wrap; }
    .tbf-section-head .tbf-btn { width: 100%; }
    /* O botão de renovar é o alvo principal — 44px é o mínimo confortável */
    .tbf-item__actions .tbf-btn { min-height: 44px; }
    .tbf-idcard__meta { gap: 18px; }
    .tbf-cards { grid-template-columns: 1fr; }
    /* .tbf-actions vira coluna acima; no leitor isso empilha o refresh sozinho */
    .tbf-actions--center { align-items: stretch; }
}

/* Aquisições: aba "Pedir compra" (v1.51.0) */
.tbf-acq-form { display: grid; gap: 10px; margin: 8px 0 22px; }
.tbf-acq-form .tbf-field { margin: 0; }
