/* Listas e janelas de inclusão seguem o contrato visual da calculadora civil. */
.record-panel { padding: 0; overflow: hidden; }
.record-panel > .section-heading { margin: 0; padding: 10px 14px; }
.list-toolbar-start { flex: 1; min-width: 0; }
.list-toolbar-end { margin-left: auto; flex-shrink: 0; }
.record-panel .table-scroll { margin: 0; }
.record-empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 112px; padding: 24px; text-align: center; }
.record-empty-state p { margin: 0; color: var(--penal-ink); font-size: var(--penal-text); font-weight: 400; }
.record-table { min-width: 780px; }
#creditsTable, #periodsTable { min-width: 640px; }
.record-table :is(th, td) { padding: 13px 16px; }
.record-table th { background: #f9fbfc; font-size: var(--penal-caption); white-space: nowrap; }
.record-table td { font-size: var(--penal-text); }
.record-table tbody tr:last-child td { border-bottom: 0; }
.record-table tbody tr:hover { background: #fbfcfd; }
.record-table :is(th, td):first-child { width: 44px; color: var(--penal-muted); font-variant-numeric: tabular-nums; }
.record-table :is(th, td):last-child { width: 152px; }
.record-actions { white-space: nowrap; }
.record-action { border: 0; background: none; padding: 5px 7px; color: var(--penal-blue); font: inherit; font-size: var(--penal-text); cursor: pointer; }
.record-action[data-action="remove"] { color: var(--penal-muted); }
.record-action { border-radius: 5px; }
.record-action:hover { background: var(--penal-soft); }

/* Janela nativa: foco contido, fundo inativo e fechamento por Escape. */
html:has(.penal-editor[open]) { overflow: hidden; }
.penal-editor { position: fixed; inset: 0; box-sizing: border-box; width: min(680px, calc(100% - 32px)); height: min(620px, calc(100dvh - 32px)); max-width: none; max-height: calc(100dvh - 32px); margin: auto; padding: 0; overflow: hidden; border: 1px solid var(--penal-line); border-radius: 14px; background: #fff; color: var(--penal-ink); box-shadow: 0 24px 90px rgb(16 24 40 / 18%); }
.penal-editor:not([open]) { display: none; }
.penal-editor::backdrop { background: rgb(22 30 42 / 20%); backdrop-filter: blur(7px); }
.penal-editor > form { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.editor-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-shrink: 0; min-height: 56px; padding: 12px 20px; border-bottom: 1px solid var(--penal-line); }
.editor-heading h2 { margin: 0; font-size: .95rem; font-weight: 600; color: var(--penal-ink); }
.editor-close { padding: 6px; border: 0; background: none; color: var(--penal-muted); font: inherit; font-size: var(--penal-text); cursor: pointer; }
.editor-body { flex: 1; min-height: 0; padding: 20px; overflow-y: auto; overscroll-behavior: contain; }
.editor-status { margin: 0 0 16px; color: #8b241c; font-size: var(--penal-text); line-height: 1.5; }
.editor-status:empty { display: none; }

.editor-actions { display: flex; justify-content: flex-end; gap: 10px; flex-shrink: 0; padding: 14px 20px; border-top: 1px solid var(--penal-line); background: #fff; }
.editor-actions .btn-primary { background: var(--penal-blue); border-color: var(--penal-blue); }
.compact-editor { height: fit-content; }
.compact-editor > form { height: auto; }
.compact-editor .editor-body { flex: none; max-height: calc(100dvh - 180px); }
@media (max-width: 720px) {
  .record-panel > .section-heading { padding: 12px; }
  .record-empty-state { min-height: 112px; }
  .penal-editor { width: calc(100% - 24px); max-height: calc(100dvh - 24px); height: min(620px, calc(100dvh - 24px)); }
  .compact-editor { height: fit-content; }
  .editor-heading, .editor-body, .editor-actions { padding: 16px; }
  .editor-actions .btn { flex: 1; }
}
@media print { .penal-editor { display: none !important; } }

.checkpoint-balances { margin: 20px 0 0; padding: 16px 0 0; border: 0; border-top: 1px solid var(--penal-line); }
.checkpoint-balances legend { padding: 0 0 12px; font-size: var(--penal-text); font-weight: 500; }
#checkpointsTable input[type="radio"] { accent-color: var(--penal-blue); }

.entry-preview { display: block; margin-top: 14px; font-size: var(--penal-text); color: var(--penal-blue); }
.entry-preview:empty { display: none; }
#fillBalances { margin-bottom: 16px; }
