/* Assessoria Mercury — azul e cinza (identidade institucional). */
:root {
  --forest: #1e3a5f;
  --forest-700: #2c5282;
  --forest-600: #3b6fb0;
  --mint-200: #e2e8f0;
  --mint-400: #93c5fd;
  --mint-500: #60a5fa;
  --mint-600: #2563eb;
  --surface: #f1f5f9;
  --text: #0f172a;
  --muted: #64748b;
  --border: #cbd5e1;
  --danger: #b91c1c;
  --focus-ring: 0 0 0 3px #93c5fd;
  --radius: 10px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface);
  line-height: 1.55;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--forest);
  color: #fff;
  padding: 0.75rem 1rem;
  z-index: 1000;
  border-radius: 0 0 var(--radius) 0;
}

.skip-link:focus {
  left: 0;
  outline: none;
  box-shadow: var(--focus-ring);
}

.site-header {
  background: linear-gradient(135deg, var(--forest) 0%, var(--forest-700) 100%);
  color: #fff;
  padding: 1rem clamp(1rem, 4vw, 2.5rem);
  box-shadow: 0 2px 12px rgba(30, 58, 95, 0.28);
}

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

.brand {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand small {
  display: block;
  font-weight: 400;
  opacity: 0.88;
  font-size: 0.8rem;
}

nav[aria-label="Principal"] ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
}

nav[aria-label="Principal"] a {
  color: #fff;
  text-decoration: none;
  border-radius: 6px;
  padding: 0.35rem 0.5rem;
}

nav[aria-label="Principal"] a:hover {
  background: rgba(255, 255, 255, 0.12);
}

nav[aria-label="Principal"] a:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2rem);
}

h1 {
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  color: var(--forest);
  margin-top: 0;
}

.muted {
  color: var(--muted);
  font-size: 0.95rem;
}

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 1px 3px rgba(30, 58, 95, 0.08);
}

.card--perigo {
  border-color: #fecaca;
  background: #fffafa;
}

.card__titulo-perigo {
  font-size: 1rem;
  color: var(--danger);
  margin: 0 0 0.5rem;
}

.btn--danger {
  background: #fff;
  color: var(--danger);
  border-color: var(--danger);
}

.btn--danger:hover {
  background: #ffebee;
}

.pdf-frame-wrap {
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #525659;
  min-height: 72vh;
}

.pdf-frame {
  width: 100%;
  min-height: 72vh;
  height: 80vh;
  border: none;
  display: block;
}

.grid-2 {
  display: grid;
  gap: 1rem;
}

@media (min-width: 720px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--forest-700);
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="tel"],
input[type="url"],
select,
textarea {
  width: 100%;
  max-width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  background: #fff;
}

/* Evita fundo azulado do autofill do Chrome no e-mail/senha (alinhado ao resto do formulário). */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px #fff inset;
  box-shadow: 0 0 0 1000px #fff inset;
  -webkit-text-fill-color: var(--text);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 1;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-color: var(--mint-600);
}

textarea {
  min-height: 88px;
  resize: vertical;
}

.field-hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn--primary {
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  color: #fff;
  border-color: #1d4ed8;
}

.btn--primary:hover {
  filter: brightness(1.03);
}

.btn--secondary {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.55);
}

.btn--ghost {
  background: #e2e8f0;
  color: var(--forest);
  border-color: #94a3b8;
}

.btn--ghost:hover {
  background: #cbd5e1;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th,
td {
  text-align: left;
  padding: 0.65rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--forest-700);
}

tr:hover td {
  background: var(--mint-200);
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge--ativo {
  background: #dbeafe;
  color: #1e40af;
}

.badge--expirado {
  background: #ffe5e5;
  color: var(--danger);
}

.badge--futuro,
.badge--rascunho {
  background: #eef2ff;
  color: #3730a3;
}

.site-footer {
  margin-top: 2rem;
  padding: 1.5rem clamp(1rem, 4vw, 2.5rem);
  background: #fff;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--muted);
}

.site-footer a {
  color: var(--forest-700);
}

fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 0 0 1rem;
  padding: 1rem;
}

legend {
  font-weight: 700;
  color: var(--forest);
  padding: 0 0.35rem;
}

input[type="url"] {
  width: 100%;
  max-width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  background: #fff;
}

.tabs__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.tabs__tab {
  border: none;
  background: transparent;
  padding: 0.6rem 1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
  border-radius: 8px 8px 0 0;
}

.tabs__tab[aria-selected="true"] {
  color: var(--forest);
  background: #fff;
  box-shadow: 0 -2px 0 var(--mint-600) inset;
}

.tabs__tab:hover {
  color: var(--forest-700);
}

.tabs__panel {
  display: none;
}

.tabs__panel.is-active {
  display: block;
}

.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem 1rem;
  text-align: center;
  background: var(--surface);
  color: var(--muted);
  margin-top: 0.75rem;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone.is-dragover {
  border-color: var(--mint-600);
  background: var(--mint-200);
}

.dropzone:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Painel: mapa de calor por vencimento */
.heatmap {
  margin-bottom: 1.5rem;
}

.heatmap__heading {
  font-size: 1.1rem;
  color: var(--forest);
  margin: 0 0 0.35rem;
}

.heatmap__sub {
  margin: 0 0 1rem;
}

.heatmap__grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

.heatmap__grid--4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 720px) {
  .heatmap__grid--4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.heatmap__tile {
  border-radius: var(--radius);
  padding: 1rem 0.85rem;
  text-align: center;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 1px 4px rgba(30, 58, 95, 0.1);
}

.heatmap__n {
  display: block;
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.2;
}

.heatmap__lbl {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  margin-top: 0.35rem;
  line-height: 1.3;
  opacity: 0.92;
}

.heatmap__tile--total {
  background: linear-gradient(180deg, #e8f5e9 0%, #c8e6c9 100%);
  color: var(--forest);
}

.heatmap__tile--critico {
  background: linear-gradient(180deg, #ffebee 0%, #ffcdd2 100%);
  color: #7f1d1d;
}

.heatmap__tile--atencao {
  background: linear-gradient(180deg, #fff8e1 0%, #ffecb3 100%);
  color: #5d4037;
}

.heatmap__tile--medio {
  background: linear-gradient(180deg, #fff9c4 0%, #fff176 100%);
  color: #4a4a00;
}

.heatmap__tile--ok {
  background: linear-gradient(180deg, #dbeafe 0%, #93c5fd 100%);
  color: #1e3a5f;
}

.heatmap__tile--sem {
  background: linear-gradient(180deg, #eceff1 0%, #cfd8dc 100%);
  color: #37474f;
}

/* Lista: vencido / próximo / ativo / sem data */
.contract-row--vencido td:first-child {
  box-shadow: inset 4px 0 0 0 #b91c1c;
}
.contract-row--proximo td:first-child {
  box-shadow: inset 4px 0 0 0 #d97706;
}
.contract-row--ativo td:first-child {
  box-shadow: inset 4px 0 0 0 #2563eb;
}
.contract-row--sem td:first-child {
  box-shadow: inset 4px 0 0 0 #64748b;
}

/* Lista de contratos: resumo (texto já gerado na importação / cadastro) */
.contract-list__resumo {
  max-width: min(42rem, 92vw);
}

.contract-list__resumo > summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--forest-700);
  list-style-position: outside;
}

.contract-list__resumo-corpo {
  margin-top: 0.65rem;
  padding: 0.75rem 0.85rem;
  max-height: 22rem;
  overflow: auto;
  white-space: pre-wrap;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text);
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
}

.contract-list__resumo-vazio {
  margin: 0.65rem 0 0;
  max-width: 28rem;
  font-size: 0.9rem;
}

.visually-hidden,
.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;
}

/* —— Ficha do contrato (resumo em destaque) —— */
.contrato-hero {
  max-width: 920px;
  margin: 0 auto 1.75rem;
  padding: 1.75rem clamp(1rem, 4vw, 2.25rem);
  background: linear-gradient(145deg, #fff 0%, #f0f7ff 55%, #e8f0fa 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(30, 58, 95, 0.12);
}

.contrato-hero__eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--forest-600);
  font-weight: 600;
}

.contrato-hero__title {
  margin: 0 0 1rem;
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  color: var(--forest);
  line-height: 1.25;
}

.contrato-hero__cliente {
  margin: 0 0 1rem;
  padding: 1rem 1.15rem;
  background: #fff;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--mint-200);
}

.contrato-hero__cliente-label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.contrato-hero__cliente-nome {
  margin: 0;
  font-size: clamp(1.1rem, 2.4vw, 1.35rem);
  font-weight: 700;
  color: var(--forest);
  line-height: 1.35;
}

.contrato-hero__meta {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.contrato-hero__pendencia {
  margin: 0 0 1rem;
  padding: 0.65rem 0.85rem;
  background: #fffbeb;
  border-left: 4px solid #d97706;
  border-radius: 4px;
  font-size: 0.92rem;
  color: #78350f;
}

.contrato-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.btn--hero {
  padding: 0.8rem 1.4rem;
  font-size: 1.02rem;
}

.contrato-resumo {
  max-width: 920px;
  margin: 0 auto;
}

.contrato-resumo__titulo {
  margin: 0 0 1rem;
  font-size: 1.35rem;
  color: var(--forest);
  border-bottom: 2px solid var(--mint-500);
  padding-bottom: 0.5rem;
}

.contrato-resumo__corpo {
  white-space: pre-wrap;
  font-size: 0.98rem;
  line-height: 1.65;
  color: var(--text);
  margin: 0;
}

.contrato-detalhes-extra__summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--forest-700);
}

.contrato-detalhes-extra[open] .contrato-detalhes-extra__summary {
  margin-bottom: 0;
}
