/**
 * Presidium — modais Backup / Relatório / PDF viewer
 */

#modal-root .presidium-modal {
  width: min(560px, 96vw);
  max-height: 92vh;
  overflow: auto;
  padding: 0;
  border: none;
  border-radius: 20px;
  background: linear-gradient(165deg, #16161e 0%, #0c0c12 100%);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.65);
  color: #f5f5f7;
  display: flex;
  flex-direction: column;
}

#modal-root .presidium-modal__header {
  padding: 22px 24px 16px;
  border-bottom: none;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
}

#modal-root .presidium-modal__eyebrow {
  margin: 0 0 6px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #5a9fd4;
}

#modal-root .presidium-modal__title,
#modal-root .report-modal-title {
  margin: 0 0 6px;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: #f5f5f7;
  line-height: 1.15;
}

#modal-root .presidium-modal__sub,
#modal-root .report-modal-sub {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.5;
  color: rgba(235, 235, 245, 0.62);
}

#modal-root .presidium-modal__body {
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#modal-root .presidium-modal__panel,
#modal-root .report-filter-block,
#modal-root .backup-filter-block {
  margin: 0;
  padding: 16px;
  border: none;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.32);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  color: #f5f5f7;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#modal-root .backup-mode-row {
  gap: 8px;
}

#modal-root .backup-mode-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  border: none;
  background: rgba(255, 255, 255, 0.04);
  color: #f5f5f7;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

#modal-root .backup-mode-opt:hover {
  background: rgba(255, 255, 255, 0.07);
}

#modal-root .backup-mode-opt span {
  color: #f5f5f7;
}

#modal-root .backup-mode-opt:has(input:checked) {
  background: linear-gradient(135deg, rgba(74, 144, 200, 0.16), rgba(42, 90, 138, 0.08));
  box-shadow: 0 4px 18px rgba(74, 144, 200, 0.14);
}

#modal-root .backup-db-check {
  color: #f5f5f7;
  padding: 4px 2px 0;
}

#modal-root .backup-db-check span {
  color: #f5f5f7;
}

#modal-root .backup-db-check code {
  color: rgba(235, 235, 245, 0.55);
}

#modal-root .report-date-label,
#modal-root .report-date-sep {
  color: rgba(235, 235, 245, 0.5);
}

#modal-root .report-date-input,
#modal-root .report-text-input {
  height: 42px;
  color: #f5f5f7;
  background: rgba(255, 255, 255, 0.05);
  border: none;
  border-radius: 10px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  color-scheme: dark;
}

#modal-root .report-date-input:focus,
#modal-root .report-text-input:focus {
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(74, 144, 200, 0.45), 0 0 0 3px rgba(74, 144, 200, 0.1);
}

#modal-root .report-tipo-check {
  border: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28);
}

#modal-root .report-tipo-check--desl {
  background: linear-gradient(135deg, rgba(35, 75, 125, 0.28), rgba(20, 45, 80, 0.16));
  color: #a8d4f8;
}

#modal-root .report-tipo-check--st {
  background: linear-gradient(135deg, rgba(210, 80, 25, 0.26), rgba(140, 45, 10, 0.14));
  color: #ffd0a8;
}

#modal-root .report-tipo-check span {
  color: inherit;
}

/* —— Tema do PDF (modal relatório) —— */
.report-pdf-theme-block {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.report-pdf-theme-label {
  display: block;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(235, 235, 245, 0.42);
  margin-bottom: 8px;
}

.report-pdf-theme-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.report-pdf-theme-opt {
  cursor: pointer;
  margin: 0;
}

.report-pdf-theme-opt input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.report-pdf-theme-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.report-pdf-theme-card strong {
  font-size: 0.82rem;
  font-weight: 600;
  color: #f5f5f7;
}

.report-pdf-theme-card em {
  font-style: normal;
  font-size: 0.68rem;
  color: rgba(235, 235, 245, 0.42);
}

.report-pdf-theme-opt input:checked + .report-pdf-theme-card {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.32);
}

.report-pdf-theme-opt--digital input:checked + .report-pdf-theme-card {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.38);
}

.report-pdf-theme-opt--print input:checked + .report-pdf-theme-card {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(0, 0, 0, 0.12);
}

.report-pdf-theme-opt--print input:checked + .report-pdf-theme-card strong {
  color: #111;
}

.report-pdf-theme-opt--print input:checked + .report-pdf-theme-card em {
  color: #666;
}

#modal-root .presidium-modal__footer {
  padding: 0 24px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#modal-root .presidium-modal__actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

#modal-root .presidium-modal__btn {
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.86rem;
  font-weight: 600;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: #f5f5f7;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28);
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

#modal-root .presidium-modal__btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
}

#modal-root .presidium-modal__btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

#modal-root .presidium-modal__btn--primary {
  background: linear-gradient(180deg, #5a9fd4 0%, #3d7eb5 100%);
  color: #f5f5f7;
  box-shadow: 0 6px 22px rgba(74, 144, 200, 0.34);
}

#modal-root .presidium-modal__btn--primary:hover:not(:disabled) {
  filter: brightness(1.06);
}

#modal-root .presidium-modal__btn--ghost {
  background: transparent;
  box-shadow: none;
  color: rgba(235, 235, 245, 0.55);
}

#modal-root .presidium-modal__btn--ghost:hover:not(:disabled) {
  color: #f5f5f7;
  background: rgba(255, 255, 255, 0.05);
}

#modal-root .presidium-modal__summary,
#modal-root .report-summary {
  margin: 0;
  padding: 14px 16px;
  border: none;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.28);
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.45;
  text-align: center;
  color: #f5f5f7;
}

#modal-root .presidium-modal__summary .warn,
#modal-root .report-summary .warn {
  color: #fbbf24;
}

#modal-root .presidium-modal__summary .err,
#modal-root .report-summary .err {
  color: #f08080;
}

/* —— PDF Viewer —— */
.pdf-viewer-backdrop {
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.pdf-viewer-toolbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: linear-gradient(180deg, #12121a 0%, #0a0a0f 100%);
  border-bottom: none;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
}

.pdf-viewer-toolbar-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.pdf-viewer-theme {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
}

.pdf-theme-btn {
  min-height: 28px;
  padding: 4px 12px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: rgba(235, 235, 245, 0.55);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.pdf-theme-btn.is-active {
  background: rgba(255, 255, 255, 0.12);
  color: #f5f5f7;
}

.pdf-theme-btn:hover:not(.is-active) {
  color: rgba(235, 235, 245, 0.82);
}

.pdf-viewer-title {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #f5f5f7;
  text-align: center;
}

.pdf-viewer-btn {
  min-height: 42px;
  border-radius: 12px;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: #f5f5f7;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.pdf-viewer-btn.gold {
  background: linear-gradient(180deg, #5a9fd4 0%, #3d7eb5 100%);
  color: #f5f5f7;
}

.pdf-viewer-scroll {
  background: #1a1a22;
  padding: 20px 16px;
}

/* —— PDF Paper —— */
.pdf-paper {
  max-width: 720px;
  margin: 0 auto;
  border-radius: 6px;
  overflow: hidden;
  padding: 0 0 20px;
  font-family: var(--pro-font);
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.pdf-paper--digital {
  background: #0a0a0c;
  color: #e8ecf0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
  min-height: calc(720px * 297 / 210);
  display: flex;
  flex-direction: column;
}

.pdf-paper--print {
  background: #fff;
  color: #111;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  min-height: calc(720px * 297 / 210);
  display: flex;
  flex-direction: column;
}

.pdf-doc {
  width: 100%;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

/* Cabeçalho v2 */
.pdf-head--v2 {
  page-break-after: avoid;
}

.pdf-head-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px 14px;
}

.pdf-head-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 1 1 auto;
}

.pdf-head--v2 .pdf-head-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.pdf-head-eyebrow {
  display: block;
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.pdf-head-text h1 {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.pdf-head-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  flex: 0 0 52%;
  max-width: 52%;
}

.pdf-meta-item {
  padding: 10px 12px;
  border-radius: 10px;
}

.pdf-meta-item .pdf-meta-lbl {
  display: block;
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 3px;
}

.pdf-meta-item strong {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.25;
  word-break: break-word;
}

.pdf-head-rule {
  height: 1px;
  margin: 0 22px;
}

/* Digital preview */
.pdf-paper--digital .pdf-head--v2 {
  background: #0a0a0c;
  color: #fff;
}

.pdf-paper--digital .pdf-head-eyebrow {
  color: rgba(235, 235, 245, 0.42);
}

.pdf-paper--digital .pdf-head-text h1 {
  color: #f5f5f7;
}

.pdf-paper--digital .pdf-meta-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.pdf-paper--digital .pdf-meta-lbl {
  color: rgba(235, 235, 245, 0.38);
}

.pdf-paper--digital .pdf-meta-item strong {
  color: #f5f5f7;
}

.pdf-paper--digital .pdf-head-rule {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.16), transparent);
}

/* Print preview */
.pdf-paper--print .pdf-head--v2 {
  background: #fff;
  color: #111;
}

.pdf-paper--print .pdf-head-eyebrow {
  color: #666;
}

.pdf-paper--print .pdf-head-text h1 {
  color: #111;
}

.pdf-paper--print .pdf-meta-item {
  background: #f7f7f8;
  border: 1px solid #ddd;
}

.pdf-paper--print .pdf-meta-lbl {
  color: #666;
}

.pdf-paper--print .pdf-meta-item strong {
  color: #111;
}

.pdf-paper--print .pdf-head-rule {
  background: #222;
}

.pdf-entries--modern {
  padding: 14px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  flex: 1 1 auto;
  min-height: 0;
}

.pdf-paper--digital .pdf-entry--modern {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: #121216;
  overflow: hidden;
  break-inside: avoid;
}

.pdf-paper--print .pdf-entry--modern {
  border: 1px solid #ccc;
  border-radius: 10px;
  background: #fff;
  box-shadow: none;
  overflow: hidden;
  break-inside: avoid;
}

.pdf-paper--print .pdf-entry--st {
  border-color: #ccc;
}

.pdf-entry-accent {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
}

.pdf-paper--digital .pdf-entry--desl .pdf-entry-accent {
  background: linear-gradient(180deg, #5a9fd4 0%, #2a5a8a 100%);
}

.pdf-paper--digital .pdf-entry--st .pdf-entry-accent {
  background: linear-gradient(180deg, #f08040 0%, #c85018 100%);
}

.pdf-paper--print .pdf-entry--desl .pdf-entry-accent {
  background: #2a5a8a;
}

.pdf-paper--print .pdf-entry--st .pdf-entry-accent {
  background: #c85018;
}

.pdf-entry--modern {
  position: relative;
}

.pdf-entry-inner {
  padding: 12px 14px 12px 18px;
}

.pdf-entry-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  padding-bottom: 8px;
}

.pdf-paper--digital .pdf-entry-head {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.pdf-paper--print .pdf-entry-head {
  border-bottom: 1px solid #ddd;
}

.pdf-entry-index {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.pdf-paper--digital .pdf-entry-index {
  color: rgba(235, 235, 245, 0.45);
}

.pdf-paper--print .pdf-entry-index {
  color: #666;
}

.pdf-entry-badge {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 4px 10px;
  border-radius: 999px;
  text-transform: uppercase;
}

.pdf-paper--digital .pdf-entry-badge--desl {
  background: rgba(35, 90, 150, 0.35);
  color: #b8d8f4;
  border: 1px solid rgba(90, 159, 212, 0.35);
}

.pdf-paper--digital .pdf-entry-badge--st {
  background: rgba(200, 80, 24, 0.32);
  color: #ffd8b8;
  border: 1px solid rgba(240, 128, 64, 0.38);
}

.pdf-paper--print .pdf-entry-badge {
  background: #fff;
}

.pdf-paper--print .pdf-entry-badge--desl {
  color: #2a5a8a;
  border: 1px solid #2a5a8a;
}

.pdf-paper--print .pdf-entry-badge--st {
  color: #b84a10;
  border: 1px solid #c85018;
}

.pdf-entry-body--modern {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.pdf-entry-photo--modern {
  flex-shrink: 0;
  width: 88px;
  height: 112px;
  overflow: hidden;
  border-radius: 10px;
  box-sizing: border-box;
  background: #0a0a0c;
}

.pdf-entry-photo--modern img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  border-radius: 0;
}

.pdf-paper--digital .pdf-entry-photo--modern {
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.pdf-paper--print .pdf-entry-photo--modern {
  border: 1px solid #ccc;
  background: #111;
  box-shadow: none;
}

.pdf-entry-photo-empty--modern {
  width: 88px;
  height: 112px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 700;
}

.pdf-paper--digital .pdf-entry-photo-empty--modern {
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  color: rgba(235, 235, 245, 0.4);
}

.pdf-paper--print .pdf-entry-photo-empty--modern {
  background: #f5f5f5;
  border: 1px dashed #bbb;
  color: #888;
}

.pdf-entry-grid--modern {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  min-width: 0;
}

.pdf-field--modern {
  padding: 8px 10px;
  border-radius: 8px;
}

.pdf-field--modern.pdf-field--full {
  grid-column: 1 / -1;
}

.pdf-paper--digital .pdf-field--modern {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.pdf-paper--print .pdf-field--modern {
  background: #fafafa;
  border: 1px solid #e5e5e5;
  box-shadow: none;
}

.pdf-field--modern .pdf-field-label {
  display: block;
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 3px;
}

.pdf-paper--digital .pdf-field-label {
  color: rgba(235, 235, 245, 0.38);
}

.pdf-paper--print .pdf-field-label {
  color: #666;
}

.pdf-field--modern .pdf-field-value {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.28;
  word-break: break-word;
}

.pdf-paper--digital .pdf-field-value {
  color: #f5f5f7;
}

.pdf-paper--print .pdf-field-value {
  color: #111;
}

@media (max-width: 640px) {
  .pdf-head-main {
    flex-direction: column;
  }

  .pdf-head-meta {
    flex: 1 1 auto;
    max-width: 100%;
    width: 100%;
  }

  .report-pdf-theme-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  #modal-root .presidium-modal__actions {
    grid-template-columns: 1fr;
  }

  #modal-root .presidium-modal__header,
  #modal-root .presidium-modal__body,
  #modal-root .presidium-modal__footer {
    padding-left: 16px;
    padding-right: 16px;
  }

  #modal-root .report-date-row {
    grid-template-columns: 1fr;
  }

  #modal-root .report-date-sep {
    display: none;
  }

  #modal-root .report-text-row {
    flex-direction: column;
  }
}
