:root {
  --primary: #1e3a8a;
  --primary-light: #3b82f6;
  --primary-dark: #172554;
  --accent: #059669;
  --accent-light: #10b981;
  --accent-dark: #047857;
  --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --border: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background-color: #f1f5f9;
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
}

/* HEADER */
.site-header {
  background: var(--bg-gradient);
  color: white;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-content {
  max-width: 1300px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-brand-logo {
  background: transparent;
  padding: 0;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  border: none;
}

.navbar-logo-img {
  height: 48px;
  max-width: 220px;
  object-fit: contain;
  display: block;
}

.header-brand-divider {
  width: 1.5px;
  height: 38px;
  background: rgba(255, 255, 255, 0.2);
  margin: 0 0.2rem;
}

.site-title {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.site-subtitle {
  font-size: 0.8rem;
  color: #94a3b8;
  font-weight: 400;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.3);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
}

.badge-dot {
  width: 8px;
  height: 8px;
  background-color: #34d399;
  border-radius: 50%;
  box-shadow: 0 0 8px #34d399;
}

.btn-header {
  background: rgba(255, 255, 255, 0.12);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-header:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: translateY(-1px);
}

.btn-header-accent {
  background: var(--accent);
  border-color: var(--accent-light);
}
.btn-header-accent:hover {
  background: var(--accent-dark);
}

.btn-header-logout {
  background: rgba(239, 68, 68, 0.15) !important;
  color: #fca5a5 !important;
  border-color: rgba(239, 68, 68, 0.35) !important;
}
.btn-header-logout:hover {
  background: rgba(239, 68, 68, 0.3) !important;
  color: #ffffff !important;
}

.header-user-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
}

/* ================= LOGIN SCREEN ================= */
.login-overlay {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-gradient);
  padding: 1.5rem;
}

.login-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  width: 100%;
  max-width: 440px;
  padding: 2.5rem 2rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  animation: fadeIn 0.4s ease-out;
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo-box {
  background: transparent;
  padding: 0;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
  border: none;
  box-shadow: none;
}

.login-logo-img {
  max-height: 64px;
  max-width: 240px;
  object-fit: contain;
  display: block;
}

.login-header h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary-dark);
  margin-bottom: 0.35rem;
  letter-spacing: -0.02em;
}

.login-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.login-error-msg {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: #b91c1c;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  animation: shake 0.3s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.login-input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.login-input-icon {
  position: absolute;
  left: 0.85rem;
  font-size: 1rem;
  color: #94a3b8;
  pointer-events: none;
}

.login-input-group input {
  padding-left: 2.6rem !important;
  padding-right: 2.6rem !important;
  height: 46px;
  border: 1.5px solid #cbd5e1;
  font-size: 0.95rem;
}

.login-input-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.15);
}

.btn-toggle-pass {
  position: absolute;
  right: 0.75rem;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  color: #64748b;
  padding: 0.25rem;
}

.btn-toggle-pass:hover {
  color: var(--primary);
}

.btn-login {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
  border: none;
  height: 48px;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
  transition: all 0.2s ease;
  margin-top: 0.5rem;
}

.btn-login:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

.login-footer {
  text-align: center;
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid #f1f5f9;
  font-size: 0.75rem;
  color: #94a3b8;
}

/* PROGRESS BAR */
.progress-bar-container {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
  box-shadow: var(--shadow-sm);
}

.progress-steps {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  z-index: 2;
  transition: all 0.2s;
}

.step-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #f1f5f9;
  color: var(--text-muted);
  border: 2px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  transition: all 0.3s;
}

.step span {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

.step.active .step-circle {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

.step.active span {
  color: var(--primary);
  font-weight: 700;
}

.step.completed .step-circle {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.step-line {
  flex: 1;
  height: 3px;
  background: #e2e8f0;
  margin: 0 0.5rem;
  margin-bottom: 1.2rem;
  transition: all 0.3s;
}

/* MAIN CONTENT */
.main-content {
  max-width: 1250px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

.form-section {
  display: none;
  animation: fadeIn 0.3s ease-in-out;
}

.form-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  background: white;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.section-icon {
  font-size: 2.2rem;
  width: 54px;
  height: 54px;
  background: #eff6ff;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.section-header h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
}

.section-header p {
  color: var(--text-muted);
  font-size: 0.88rem;
}

/* CARDS & GRIDS */
.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  width: 100%;
}

@media (max-width: 960px) {
  .card-grid {
    grid-template-columns: 1fr;
  }
}

.form-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease;
  overflow: hidden;
  min-width: 0;
  box-sizing: border-box;
  width: 100%;
}

.form-card:hover {
  box-shadow: var(--shadow-md);
}

.form-card.full-width {
  grid-column: 1 / -1;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 0.75rem;
}

.card-icon {
  margin-right: 0.5rem;
}

/* FORM FIELDS */
.field-group {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  min-width: 0;
  box-sizing: border-box;
}

.field-group label {
  font-size: 0.83rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.35rem;
}

.required {
  color: #ef4444;
}

.field-hint {
  font-size: 0.74rem;
  color: #2563eb;
  margin-top: 0.35rem;
  font-weight: 500;
  line-height: 1.4;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  width: 100%;
  box-sizing: border-box;
}

.field-row > .field-group {
  min-width: 0;
}

@media (max-width: 640px) {
  .field-row {
    grid-template-columns: 1fr;
  }
}

/* TIMBRE BOX (CUSTOM, CLEAN, NO OVERFLOW) */
.timbre-box {
  margin-top: 0.75rem;
  background: #f8fafc;
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px dashed #cbd5e1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-sizing: border-box;
  width: 100%;
  overflow: hidden;
}

.timbre-box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.timbre-box-title {
  font-size: 0.83rem;
  font-weight: 600;
  color: #334155;
}

.btn-timbre-restore {
  background: #e0f2fe;
  color: #0284c7;
  border: 1px solid #bae6fd;
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-timbre-restore:hover {
  background: #bae6fd;
}

.timbre-box-body {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.85rem;
  width: 100%;
  box-sizing: border-box;
}

.timbre-img-wrap {
  flex-shrink: 0;
  background: #ffffff;
  padding: 4px 8px;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 150px;
}

.timbre-preview-img {
  max-height: 42px;
  max-width: 130px;
  object-fit: contain;
  display: block;
}

.timbre-action-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  flex: 1;
  min-width: 150px;
}

.btn-timbre-upload {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #ffffff;
  color: #1e3a8a;
  border: 1.5px solid #cbd5e1;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-timbre-upload:hover {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1d4ed8;
}

.timbre-filename-label {
  font-size: 0.74rem;
  color: #64748b;
  word-break: break-all;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

input[type="text"],
input[type="date"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text-main);
  background-color: #ffffff;
  transition: all 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.input-highlight {
  border-color: #3b82f6 !important;
  background-color: #f0f7ff !important;
  font-weight: 600;
  color: #1e3a8a !important;
}

.input-readonly {
  background-color: #f8fafc;
  border-color: #e2e8f0;
  color: #475569;
  cursor: not-allowed;
  font-weight: 600;
}

textarea {
  resize: vertical;
}

/* TOTALS BOXES */
.totals-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 2px dashed #e2e8f0;
}

.total-box {
  background: #f8fafc;
  padding: 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid #e2e8f0;
  text-align: center;
}

.total-box span {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.total-box strong {
  font-size: 1.6rem;
  color: var(--primary-dark);
  font-weight: 800;
}

/* DYNAMIC TABLE / ROWS */
.btn-add-row {
  background: var(--accent);
  color: white;
  border: none;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-add-row:hover {
  background: var(--accent-dark);
}

.dynamic-row-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1rem;
  position: relative;
}

.dynamic-row-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
}

.btn-remove-row {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fecaca;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-remove-row:hover {
  background: #dc2626;
  color: white;
}

/* NAVIGATION BUTTONS */
.nav-buttons {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2rem;
  padding-top: 1rem;
}

.btn-next,
.btn-back {
  padding: 0.75rem 1.6rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-next {
  background: var(--primary);
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.btn-next:hover {
  background: var(--primary-light);
  transform: translateY(-1px);
}

.btn-back {
  background: white;
  color: #475569;
  border: 1.5px solid #cbd5e1;
}

.btn-back:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

/* STEP 5: ANEXOS GRID */
.anexos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.anexo-card {
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.anexo-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  opacity: 0;
  transition: opacity 0.25s;
}

.anexo-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary-light);
  box-shadow: var(--shadow-xl);
}

.anexo-card:hover::before {
  opacity: 1;
}

.anexo-numero {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #eff6ff;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  display: inline-block;
  margin-bottom: 0.65rem;
  align-self: flex-start;
}

.anexo-nome {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.45rem;
}

.anexo-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  flex: 1;
}

.btn-pdf {
  width: 100%;
  background: #f1f5f9;
  color: var(--primary-dark);
  border: 1.5px solid #cbd5e1;
  padding: 0.7rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.anexo-card:hover .btn-pdf {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.gerar-todos-box {
  background: linear-gradient(135deg, #1e3a8a 0%, #1e1b4b 100%);
  padding: 2rem;
  border-radius: var(--radius-lg);
  text-align: center;
  color: white;
  box-shadow: var(--shadow-xl);
  margin-bottom: 2rem;
}

.btn-gerar-todos {
  background: var(--accent);
  color: white;
  border: none;
  padding: 1rem 2.5rem;
  font-size: 1.15rem;
  font-weight: 800;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
  transition: all 0.2s ease;
}

.btn-gerar-todos:hover {
  background: var(--accent-light);
  transform: scale(1.02);
}

/* TOAST */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #0f172a;
  color: white;
  padding: 0.85rem 1.4rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-xl);
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border-left: 4px solid var(--accent);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* MODAL DE HISTÓRICO */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 750px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  padding: 1.75rem;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
}

.modal-header h3 {
  font-size: 1.3rem;
  font-weight: 700;
}

.btn-close-modal {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
}

.saved-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.2s;
}

.saved-item:hover {
  background: #f8fafc;
}

.saved-item-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.saved-item-convenio {
  font-size: 0.95rem;
  color: var(--primary-dark);
}

.saved-item-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
  margin-top: 0.15rem;
}

.saved-item-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.btn-load-item {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-load-item:hover {
  background: var(--primary-light);
  transform: translateY(-1px);
}

.btn-delete-item {
  background: #fee2e2;
  color: #ef4444;
  border: 1px solid #fca5a5;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-delete-item:hover {
  background: #ef4444;
  color: white;
}

/* ========================================================= */
/* IMPRESSÃO & TEMPLATES OFICIAIS PARA PDF (PADRÃO ESTADO)  */
/* ========================================================= */
.pdf-page {
  width: 794px; /* A4 width at 96 DPI */
  min-height: 1123px; /* A4 height */
  background: white;
  padding: 35px 45px;
  font-family: Arial, 'Roboto', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 10.5pt;
  color: black;
  line-height: 1.4;
  margin-bottom: 20px;
}

/* TIMBRE INSTITUCIONAL NO TOPO DO PDF */
.pdf-timbre-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #1e293b;
  padding-bottom: 10px;
  margin-bottom: 22px;
  gap: 15px;
}

.pdf-timbre-logo {
  height: 52px;
  max-width: 220px;
  object-fit: contain;
}

.pdf-timbre-info {
  text-align: center;
  font-size: 7.8pt;
  color: #334155;
  line-height: 1.3;
  flex: 1;
}

.pdf-timbre-info strong {
  color: #0f172a;
  font-size: 8.5pt;
  display: block;
  margin-bottom: 2px;
}

.pdf-timbre-selo {
  height: 54px;
  max-width: 80px;
  object-fit: contain;
}

.pdf-header-title {
  text-align: center;
  font-weight: 800;
  font-size: 12.5pt;
  margin-bottom: 5px;
  text-transform: uppercase;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.pdf-header-sub {
  text-align: center;
  font-size: 11pt;
  margin-bottom: 18px;
  font-weight: 700;
  color: #334155;
}

.pdf-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 9pt;
  background-color: #ffffff;
}

.pdf-table th,
.pdf-table td {
  border: 1px solid #e2e8f0;
  padding: 6px 9px;
  vertical-align: middle;
  line-height: 1.35;
}

.pdf-table th {
  background-color: #f8fafc;
  font-weight: 700;
  font-size: 8.5pt;
  text-align: center;
  color: #1e293b;
  letter-spacing: 0.02em;
  border-bottom: 1.5px solid #94a3b8;
  border-top: 1px solid #cbd5e1;
}

.pdf-table tbody tr:nth-child(even) td {
  background-color: #fbfcfd;
}

.pdf-table tfoot tr td {
  background-color: #f8fafc !important;
  font-weight: 700;
  color: #0f172a;
  border-top: 1.5px solid #94a3b8;
  border-bottom: 1.5px solid #94a3b8;
  padding: 6px 9px;
}

/* TABELA DE METADADOS / CABEÇALHO DO CONVÊNIO */
.pdf-table-info {
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  margin-bottom: 12px;
}

.pdf-table-info td {
  border: 1px solid #e2e8f0;
  padding: 6px 10px;
  font-size: 8.5pt;
  color: #334155;
  background-color: #f8fafc;
}

.pdf-table-info td strong {
  color: #0f172a;
  font-size: 8pt;
  letter-spacing: 0.02em;
}

.pdf-section-title {
  font-weight: 800;
  font-size: 9.5pt;
  margin-top: 14px;
  margin-bottom: 6px;
  color: #0f172a;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.pdf-signature-area {
  margin-top: 45px;
  text-align: center;
}

.pdf-signature-line {
  display: inline-block;
  width: 380px;
  border-top: 1px solid #475569;
  padding-top: 6px;
  font-weight: 700;
  font-size: 9.5pt;
  color: #0f172a;
}