/*
 * Versão nova: casca fixa (topo e menu não rolam com a página) + componentes e modais.
 * O style.css continua sendo a base visual (cores, botões, tabelas, formulários).
 */

/* ---------- casca fixa ---------- */
.app .topbar {
    position: sticky;
    top: 0;
    z-index: 20;
}

.app .sidebar {
    position: sticky;
    top: 72px;
    height: calc(100vh - 72px);
    overflow-y: auto;
    flex-shrink: 0;
}

.app .sidebar-item { padding: 20px 24px; }

.sidebar-sub {
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.12);
    padding: 6px 0;
}

.sidebar-sub a {
    color: #F3D9D6;
    text-decoration: none;
    font-size: 14px;
    padding: 10px 24px 10px 58px;
}

.sidebar-sub a:hover,
.sidebar-sub a.active {
    color: #fff;
    background: var(--color-sidebar-active);
}

.app .content {
    min-width: 0;   /* tabelas largas rolam dentro do conteúdo, não a página inteira */
}

.link-button {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

/* ---------- cabeçalho de tela ---------- */
.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.page-head .page-title { margin-bottom: 0; }

.page-head-actions {
    display: flex;
    gap: 12px;
}

.panel-soft {
    background: #fff;
    border: 1px solid #F0DCD3;
    border-radius: 10px;
    padding: 20px 28px;
    max-width: 760px;
    line-height: 1.6;
}

/* ---------- cartões de opção (tipos de saída) ---------- */
.option-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    max-width: 960px;
}

.option-card {
    background: #fff;
    border: 1px solid #F0DCD3;
    border-radius: 12px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.option-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: #FBEDE9;
    color: var(--color-accent);
    display: flex;
    align-items: center;
    justify-content: center;
}

.option-title {
    font-family: var(--font-serif);
    color: var(--color-accent);
    font-size: 22px;
    margin: 4px 0 0;
}

.option-text {
    color: var(--color-text-muted);
    font-size: 14px;
    line-height: 1.5;
    margin: 0 0 8px;
    flex: 1;
}

.option-card .btn-solid { align-self: flex-start; }

/* ---------- modal ---------- */
.modal {
    border: none;
    border-radius: 12px;
    padding: 0;
    width: min(720px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    box-shadow: 0 24px 64px rgba(43, 35, 32, 0.28);
    color: var(--color-text);
}

.modal.modal-sm { width: min(460px, calc(100vw - 32px)); }

.modal::backdrop { background: rgba(43, 35, 32, 0.45); }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 28px;
    border-bottom: 1px solid #F1E5DE;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 1;
}

.modal-title {
    font-family: var(--font-serif);
    color: var(--color-accent);
    font-size: 22px;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
}

.modal-close:hover { background: #FBEDE9; color: var(--color-accent); }

.modal-body { padding: 24px 28px 28px; }

.modal-body .alert { max-width: none; margin-bottom: 0; }

.modal-message { margin: 0 0 20px; line-height: 1.5; }

.modal-hint {
    margin: 0;
    padding: 12px 14px;
    background: #FBF3EE;
    border-radius: 8px;
    font-size: 13px;
    color: var(--color-text-muted);
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
}

.btn-danger {
    background: #8E1B1B;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 12px 22px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.btn-danger:hover { background: #6E1414; }

button:disabled { opacity: 0.6; cursor: wait; }

:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* comprovante dentro do modal */
.modal .receipt { border: none; padding: 0; max-width: none; }
.receipt-meta { text-align: right; }
.receipt-table { margin-top: 16px; }
.receipt-notes { margin-top: 16px; }

/* ---------- impressão: com um modal aberto, só ele sai no papel ---------- */
@media print {
    body.app:has(dialog[open]) > *:not(dialog[open]) { display: none !important; }
    dialog[open] {
        position: static;
        box-shadow: none;
        width: auto;
        max-height: none;
        border-radius: 0;
    }
    dialog::backdrop { display: none; }
    .modal-close, .no-print { display: none !important; }
}

/* ---------- telas estreitas ---------- */
@media (max-width: 860px) {
    .app .sidebar { position: static; height: auto; }
    .sidebar-sub { width: 100%; flex-direction: row; flex-wrap: wrap; }
    .sidebar-sub a { padding: 10px 16px; }
    .modal-header, .modal-body { padding-left: 18px; padding-right: 18px; }
}

/* rótulos fora da grade de detalhes (ex.: observações do comprovante) */
.receipt-notes .detail-label {
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--color-text-muted);
    margin-bottom: 4px;
}

/* no celular, "Alterar senha" continua visível (agora é um modal, não uma página) */
@media (max-width: 860px) {
    .app .topbar-link.link-button { display: inline; }
}


/* =====================================================================
   PROPOSTA: busca, lista de leitura, cupom térmico e etiquetas
   ===================================================================== */

.visually-hidden {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
}

.form-card-wide { max-width: 960px; }

/* botão "Fechar" dos comprovantes só faz sentido dentro do modal */
main [data-close-modal] { display: none; }

/* ---------- busca grande (consulta do acervo, comprovantes) ---------- */
.search-hero {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    border: 1px solid #E7D6CE;
    border-radius: 10px;
    padding: 8px 8px 8px 18px;
    max-width: 760px;
    margin-bottom: 24px;
    color: var(--color-text-muted);
}

.search-hero input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    height: 44px;
    background: transparent;
    color: var(--color-text);
}

.row-link { color: var(--color-accent); font-weight: 600; text-decoration: none; }
.row-link:hover { text-decoration: underline; }

.filter-tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-tabs a {
    padding: 8px 16px; border-radius: 20px; text-decoration: none; font-size: 14px;
    background: #fff; border: 1px solid #F0DCD3; color: var(--color-text);
}
.filter-tabs a.active { background: var(--color-accent); border-color: var(--color-accent); color: #fff; }

/* ---------- lista de leitura (components/scan.html + js/scan.js) ---------- */
.scan-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--color-input-bg);
    border: 1px solid #C9D3DB;
    border-radius: 8px;
    padding: 4px 6px 4px 14px;
}

.scan-input-row:focus-within {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px rgba(122, 22, 32, 0.15);
}

.scan-icon { color: var(--color-text-muted); flex-shrink: 0; }

.data-form .scan-input-row input {
    border: none;
    background: transparent;
    height: 40px;
    padding: 0;
    font-size: 15px;
    font-family: ui-monospace, Consolas, monospace;
    outline: none;
}

.scan-feedback { min-height: 20px; font-size: 13px; margin: 6px 2px; color: var(--color-text-muted); }
.scan-feedback.ok { color: #1E7A3E; }
.scan-feedback.warn { color: #B45309; }

.scan-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #F1E5DE;
    border-radius: 8px;
    overflow: hidden;
    font-size: 14px;
}

.scan-table th {
    background: #FBF3EE;
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
    padding: 8px 12px;
}

.scan-table th.num { text-align: right; }
.scan-table td { padding: 8px 12px; border-top: 1px solid #F1E5DE; vertical-align: middle; }
.scan-table td:first-child { width: 190px; }
.scan-table td:last-child { width: 44px; text-align: right; }

.data-form .scan-table input.scan-code {
    height: 34px;
    font-family: ui-monospace, Consolas, monospace;
    font-size: 13px;
    background: #fff;
    border: 1px solid transparent;
    padding: 0 8px;
}

.data-form .scan-table input.scan-code:hover,
.data-form .scan-table input.scan-code:focus { border-color: #C9D3DB; }

.scan-row.error { background: #FDF0EF; }
.scan-row.error .scan-code { color: #7A1620; }
.scan-row-msg { color: #8E1B1B; font-size: 12px; font-weight: 600; margin-top: 2px; }
.scan-row.flash { animation: scan-flash 0.8s ease; }
@keyframes scan-flash { from { background: #FFF1C2; } to { background: transparent; } }

.scan-remove {
    width: 30px; height: 30px; border-radius: 6px; border: none; cursor: pointer;
    background: transparent; color: var(--color-text-muted); font-size: 20px; line-height: 1;
}
.scan-remove:hover { background: #F8D9D6; color: #7A1620; }

.scan-empty {
    border: 1.5px dashed #E7C9C2;
    border-radius: 8px;
    padding: 18px;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 14px;
}

.scan-summary { margin-top: 8px; font-size: 14px; font-weight: 600; text-align: right; }
.scan-summary.warn { color: #B45309; }

/* ---------- cupom de venda (impressora térmica, rolo de 80 mm) ---------- */
.thermal-wrap { display: flex; flex-direction: column; align-items: center; }

.thermal-receipt {
    width: 72mm;                   /* área útil do rolo de 80 mm */
    background: #fff;
    color: #000;
    font-family: ui-monospace, Consolas, "Courier New", monospace;
    font-size: 12px;
    line-height: 1.45;
    padding: 6mm 4mm;
    border: 1px dashed #C9B3AA;    /* só na tela */
}

.thermal-receipt * { font-family: inherit; }  /* o style.css põe Inter em tudo; o cupom é monoespaçado */
.t-center { text-align: center; }
.t-strong { font-weight: 700; }
.t-big { font-size: 14px; }
.t-small { font-size: 10px; }
.t-mono { font-family: inherit; }
.t-row { display: flex; justify-content: space-between; gap: 8px; }
.t-row span:last-child { text-align: right; white-space: nowrap; }
.t-rule { border-top: 1px dashed #000; margin: 6px 0; }
.t-item { margin-bottom: 4px; }

/* ---------- etiquetas adaptáveis (impressora térmica de etiquetas) ---------- */
.label-size {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
    background: #fff;
    border: 1px solid #F0DCD3;
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 12px;
    max-width: 760px;
}
.label-size label {
    display: block; font-size: 12px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.04em; margin-bottom: 6px;
}
.label-size select, .label-size input {
    height: 40px; border-radius: 6px; border: 1px solid #C9D3DB; background: var(--color-input-bg);
    padding: 0 12px; font-size: 14px;
}
.label-size input { width: 96px; }
.label-size-custom { display: flex; gap: 12px; }
.label-size-custom[hidden] { display: none; }

.label-roll {
    --label-w: 50mm;
    --label-h: 30mm;
    display: flex;
    flex-direction: column;      /* fila única vertical */
    align-items: flex-start;
    gap: 12px;
    margin-top: 16px;
}

.copy-label {
    width: var(--label-w);
    height: var(--label-h);
    box-sizing: border-box;
    padding: 2mm 2.5mm;
    background: #fff;
    color: #000;
    border: 1px dashed #C9B3AA;  /* só na tela */
    border-radius: 2mm;
    display: flex;
    flex-direction: column;      /* modelo vertical: tudo empilhado */
    overflow: hidden;
    container-type: size;        /* as letras acompanham o tamanho da etiqueta */
}

.copy-label-title {
    font-weight: 700;
    font-size: clamp(6pt, min(11cqh, 7.5cqw), 16pt);
    line-height: 1.15;
    display: -webkit-box;
    -webkit-line-clamp: 2;       /* título longo: até 2 linhas */
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-shrink: 0;
}

.copy-label-meta {
    font-size: clamp(5pt, min(8cqh, 5.5cqw), 11pt);
    margin: 1cqh 0 2.5cqh;
    flex-shrink: 0;
}

.copy-label-bars {
    flex: 1;                     /* as barras ocupam o espaço que sobra */
    min-height: 0;
    display: flex;
    justify-content: center;
}

.copy-label svg.barcode {
    height: 100%;
    display: block;
    shape-rendering: crispEdges; /* barras sem borda borrada */
}

.copy-label-code {
    font-family: ui-monospace, Consolas, monospace;
    font-size: clamp(5pt, min(8cqh, 5.2cqw), 11pt);
    text-align: center;
    letter-spacing: 0.04em;
    margin-top: 1.5cqh;
    flex-shrink: 0;
}

/* ---------- impressão térmica ---------- */
@page etiqueta { size: 50mm 30mm; margin: 0; }  /* o js/labels.js troca pelo tamanho escolhido */
@page cupom { margin: 0; }

@media print {
    /* etiquetas: uma por página, do tamanho da etiqueta (a página inteira usa o formato da etiqueta) */
    body:has(.label-roll) { page: etiqueta; }
    .app .content, .app .page-wrapper { padding: 0 !important; margin: 0; min-height: 0; }
    .label-roll { display: block; margin: 0; }
    .copy-label { page: etiqueta; break-after: page; border: none; border-radius: 0; margin: 0; }
    .copy-label:last-child { break-after: auto; }

    /* cupom: só o cupom, encostado no topo, na largura do rolo */
    body.print-thermal dialog[open] { page: cupom; padding: 0; }
    /* o modal sai do centro da tela e encosta no topo do papel */
    dialog[open] {
        position: absolute !important;
        inset: 0 auto auto 0 !important;
        margin: 0 !important;
        max-height: none !important;
        overflow: visible !important;
        outline: none !important;
    }
    body.print-thermal .modal-header { display: none; }
    body.print-thermal .modal-body { padding: 0; }
    .thermal-wrap { align-items: flex-start; }
    .thermal-receipt { border: none; padding: 2mm 4mm; }
}

/* cupom impresso fora de modal (reimpressão em Saídas > Comprovantes) */
@media print {
    body.print-thermal .content section > :not(.thermal-wrap) { display: none !important; }
    body.print-thermal .thermal-wrap { page: cupom; }
}

/* ---------- campo com botão ao lado (ISBN + Buscar dados) ---------- */
.input-with-button { display: flex; gap: 10px; }
.input-with-button input { flex: 1; }
.data-form .input-with-button .btn-outline { height: 42px; padding: 0 18px; white-space: nowrap; }
.isbn-status { margin-top: 8px; font-size: 13px; padding: 8px 12px; border-radius: 6px; background: #FBF3EE; color: var(--color-text-muted); }
.isbn-status.ok { background: #DCF3E3; color: #1E5A32; }
.isbn-status.warn { background: #FFF4DB; color: #8A5A00; }
.isbn-status[hidden] { display: none; }

.tab-count {
    display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 10px;
    background: #DC2626; color: #fff; font-size: 12px; font-weight: 700; text-align: center;
}

/* ---------- configurações ---------- */
.settings { max-width: 820px; }
.settings-section {
    background: #fff; border: 1px solid #F0DCD3; border-radius: 12px;
    padding: 8px 24px 4px; margin: 0 0 20px;
}
.settings-section legend {
    font-family: var(--font-serif); color: var(--color-accent); font-size: 20px; font-weight: 700;
    padding: 0 8px; margin-left: -8px;
}
.setting-row {
    display: flex; align-items: center; justify-content: space-between; gap: 24px;
    padding: 16px 0; border-top: 1px solid #F1E5DE;
}
.setting-row:first-of-type { border-top: none; }
.setting-text label { font-weight: 600; font-size: 15px; }
.setting-text .hint { margin-top: 4px; }
.setting-number {
    width: 110px; height: 42px; border-radius: 6px; border: 1px solid #C9D3DB;
    background: var(--color-input-bg); padding: 0 12px; font-size: 16px; text-align: right;
}

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; flex-shrink: 0; }
.switch input[type=checkbox] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
    width: 46px; height: 26px; border-radius: 13px; background: #C9C1BC; position: relative; transition: background .15s;
}
.switch-track::after {
    content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s;
}
.switch input:checked + .switch-track { background: var(--color-accent); }
.switch input:checked + .switch-track::after { transform: translateX(20px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.switch-label::after { content: attr(data-off); font-size: 14px; color: var(--color-text-muted); min-width: 72px; display: inline-block; }
.switch input:checked ~ .switch-label::after { content: attr(data-on); color: var(--color-text); font-weight: 600; }

/* ---------- menu: itens que são botões (grupo que só abre/fecha, "Alterar senha") ---------- */
button.sidebar-item {
    width: 100%;
    border: none;
    background: none;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-align: left;
    cursor: pointer;
}
.sidebar-sub button {
    display: block;
    width: 100%;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    color: #F3D9D6;
    font-size: 14px;
    padding: 10px 24px 10px 58px;
}
.sidebar-sub button:hover { color: #fff; background: var(--color-sidebar-active); }
.sidebar-sub[hidden] { display: none; }

/* sem a faixa "Searchoteca": o título da tela abre o conteúdo */
.app .content { padding-top: 32px; }

/* ---------- área do aluno ---------- */
.back-inline { display: inline-block; color: var(--color-accent); text-decoration: none; font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.back-inline:hover { text-decoration: underline; }

.book-detail { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; max-width: 1080px; }
.book-status {
    background: #fff; border: 1px solid #F0DCD3; border-radius: 12px; padding: 20px 22px;
}
.book-status p { color: var(--color-text-muted); font-size: 14px; line-height: 1.5; margin: 8px 0 14px; }
.status-big { font-family: var(--font-serif); font-size: 22px; font-weight: 700; }
.status-big.ok { color: #1E7A3E; }
.status-big.no { color: #7A1620; }
.status-big.wait { color: #8A5A00; }

.notice-ready {
    display: flex; flex-direction: column; gap: 2px;
    background: #DCF3E3; color: #1E5A32; border-left: 4px solid #1E7A3E;
    border-radius: 8px; padding: 14px 18px; margin-bottom: 16px; max-width: 1080px;
}

.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; max-width: 1080px; }
.stat { background: #fff; border: 1px solid #F0DCD3; border-radius: 12px; padding: 16px 18px; }
.stat-value { font-family: var(--font-serif); font-size: 30px; font-weight: 700; color: var(--color-accent); }
.stat-label { font-size: 13px; color: var(--color-text-muted); }
.stat.danger { border-color: #E8998D; background: #FDF0EF; }

.loan-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; max-width: 1080px; }
.loan-card { background: #fff; border: 1px solid #F0DCD3; border-radius: 12px; padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.loan-card.overdue { border-color: #E8998D; background: #FFF8F6; }
.loan-card-title { font-family: var(--font-serif); color: var(--color-accent); font-size: 19px; font-weight: 700; }
.loan-card-due { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; margin-top: 6px; }
.loan-card-left { font-size: 13px; color: var(--color-text-muted); }
.loan-card.overdue .loan-card-left { color: #8E1B1B; font-weight: 600; }

@media (max-width: 860px) {
    .book-detail { grid-template-columns: 1fr; }
    .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.data-table th.num { text-align: right; }

/* detalhe do livro dentro do modal */
.modal.modal-lg { width: min(980px, calc(100vw - 32px)); }
.modal .book-detail { grid-template-columns: minmax(0, 1fr) 280px; }
.modal .section-title { margin-top: 24px; }
.inline-form { display: inline; }
.actions-cell .btn-small, .actions-cell .status-pill { white-space: nowrap; }

/* ---------- consulta: linha inteira abre o detalhe; indisponível fica acinzentado ---------- */
.catalog-table tbody tr { cursor: pointer; }
.catalog-table tbody tr:hover td { background: #FBF3EE; }
.catalog-table tr.unavailable td { color: #A99A93; }
.catalog-table tr.unavailable .row-link { color: #A99A93; font-weight: 500; }
.row-note { font-size: 12px; margin-top: 2px; color: #A99A93; }

/* ---------- filtros em linha (logs) ---------- */
.filter-tabs-sm a { font-size: 13px; padding: 6px 12px; }
.filter-bar {
    display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px;
    background: #fff; border: 1px solid #F0DCD3; border-radius: 12px;
    padding: 14px 16px; margin-bottom: 16px; max-width: 1080px;
}
.filter-bar label { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; margin-bottom: 6px; }
.filter-bar input, .filter-bar select {
    height: 40px; border-radius: 6px; border: 1px solid #C9D3DB; background: #fff; padding: 0 10px; font-size: 14px;
}
.filter-bar-actions { display: flex; gap: 8px; margin-left: auto; }
.nowrap { white-space: nowrap; }
.log-details { font-size: 13px; word-break: break-word; max-width: 520px; }
.action-tag { font-size: 12px; background: #F6ECE7; border-radius: 6px; padding: 2px 6px; }

/* ---------- dashboard ---------- */
.dash { max-width: 1240px; }
.dash .page-head { flex-wrap: wrap; gap: 12px; }
.dash-period { margin-bottom: 0; }
.dash-updated { margin: -8px 0 16px; }
.dash-stats { max-width: none; margin-bottom: 14px; }
.stat-link { text-decoration: none; color: inherit; transition: border-color .15s, box-shadow .15s; }
.stat-link:hover, .stat-link:focus-visible { border-color: var(--color-accent-soft); box-shadow: 0 2px 10px rgba(122, 22, 32, .08); }

.dash-mini {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px;
}
.dash-mini > div {
    background: #fff; border: 1px solid #F0DCD3; border-radius: 12px; padding: 12px 16px;
    display: flex; flex-direction: column; gap: 2px;
}
.dash-mini span { font-size: 13px; color: var(--color-text-muted); }
.dash-mini strong { font-size: 18px; color: var(--color-text); }

.dash-grid { display: grid; gap: 16px; margin-bottom: 16px; }
.dash-grid-8-4 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.dash-grid-7-5 { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.dash-grid-6-3-3 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); }

.dash-card { background: #fff; border: 1px solid #F0DCD3; border-radius: 12px; padding: 16px 18px; min-width: 0; }
.dash-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.dash-card-head h2 { font-family: var(--font-serif); color: var(--color-accent); font-size: 17px; margin: 0; }
.dash-card-head a { font-size: 13px; color: var(--color-accent); }
.dash-empty { color: var(--color-text-muted); font-size: 14px; padding: 24px 0; text-align: center; }

/* legenda: texto sempre na cor do texto; a cor fica só na amostra */
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--color-text-muted); }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.ln { display: inline-block; width: 18px; height: 0; border-top: 2px solid; }
.ln-loans { border-color: var(--color-accent); }
.ln-returns { border-color: #2a78d6; border-top-style: dashed; }

.line-chart { width: 100%; height: auto; display: block; overflow: visible; }
.line-chart .grid line { stroke: #EFE3DD; stroke-width: 1; }
.line-chart .axis { font-size: 11px; fill: var(--color-text-muted); }
.line-chart .area-loans { fill: var(--color-accent); fill-opacity: .07; }
.line-chart .line-loans { fill: none; stroke: var(--color-accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.line-chart .line-returns { fill: none; stroke: #2a78d6; stroke-width: 2; stroke-dasharray: 5 4; stroke-linejoin: round; }
.line-chart .peak-label { font-size: 11px; font-weight: 700; fill: var(--color-text); }
.line-chart .hover-day .hit { fill: transparent; }
.line-chart .hover-day .crosshair { stroke: #B9A89E; stroke-width: 1; stroke-dasharray: 2 3; opacity: 0; }
.line-chart .hover-day circle { opacity: 0; stroke: #fff; stroke-width: 2; }
.line-chart .hover-day .dot-loans { fill: var(--color-accent); }
.line-chart .hover-day .dot-returns { fill: #2a78d6; }
.line-chart .hover-day:hover .crosshair, .line-chart .hover-day:focus .crosshair,
.line-chart .hover-day:hover circle, .line-chart .hover-day:focus circle { opacity: 1; }
.line-chart .hover-day:focus { outline: none; }

.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut-total { font-size: 22px; font-weight: 700; fill: var(--color-text); }
.donut-caption { font-size: 10px; fill: var(--color-text-muted); }
.donut-wrap circle { stroke-linecap: butt; }
.donut-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; flex: 1; min-width: 150px; }
.donut-legend li { display: flex; align-items: center; gap: 8px; }
.donut-legend strong { margin-left: auto; }
.donut-legend .sw { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }

.data-table.compact th, .data-table.compact td { padding: 8px 10px; font-size: 13px; }
.sev { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.sev-1 { background: #FDF3D7; color: #7A5300; }
.sev-2 { background: #FDE7C8; color: #8A4B08; }
.sev-3 { background: #F8D9D6; color: #7A1620; }

.occ-row { margin-bottom: 12px; }
.occ-text { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; margin-bottom: 4px; }
.occ-text strong { font-size: 13px; color: var(--color-text-muted); font-weight: 600; }
.occ-bar { height: 8px; background: #F3E8E3; border-radius: 4px; overflow: hidden; }
.occ-bar > div { height: 100%; background: var(--color-accent); border-radius: 4px; }

.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.feed li { display: flex; gap: 10px; font-size: 13px; line-height: 1.4; }
.feed .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-accent-soft); margin-top: 6px; flex-shrink: 0; }
.feed small { display: block; }
.feed li > span { min-width: 0; word-break: break-word; }

.kv { display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.kv > div { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px solid #F6ECE7; padding-bottom: 6px; }
.kv strong.warn { color: #8A4B08; }
.kv .hint { margin: 6px 0 0; }

@media (max-width: 1100px) {
    .dash-grid-8-4, .dash-grid-7-5, .dash-grid-6-3-3 { grid-template-columns: 1fr; }
    .dash-mini { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
    .dash-mini, .dash-stats { grid-template-columns: 1fr; }
    .filter-bar-actions { margin-left: 0; }
}
