:root {
  color-scheme: light;
  --bg: #f5f3ff; /* Lilás bem clarinho para o fundo geral */
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: #ffffff;
  --text: #1a102f; /* Roxo escuro quase preto */
  --muted: #6c5f78; /* Cinza arroxeado */
  --border: rgba(26, 16, 47, 0.12); /* Bordas com tom roxo sutil */
  --primary: #7c3aed; /* Roxo vibrante (antigo verde primary) */
  --primary-strong: #5b21b6; /* Roxo escuro (antigo verde primary-strong) */
  --accent: #f97316;
  --shadow: 0 18px 50px rgba(26, 16, 47, 0.12);
  --radius: 24px;
  --radius-sm: 16px;
  --focus: 0 0 0 4px rgba(124, 58, 237, 0.16); /* Foco roxo translúcido */
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(124, 58, 237, 0.16), transparent 28%), /* Gradiente em roxo */
    radial-gradient(circle at top right, rgba(249, 115, 22, 0.14), transparent 24%),
    linear-gradient(180deg, #faf5ff 0%, #f3e8ff 100%); /* Tons lilás e violeta claro no fundo */
  min-height: 100vh;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 0.9rem 1.2rem;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--text);
  padding: 0.8rem 0.95rem;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input[type="checkbox"],
input[type="radio"] {
  width: 1rem;
  height: 1rem;
  padding: 0;
  border-radius: 4px;
  accent-color: var(--primary); /* Checkboxes e Radios ficam roxos automaticamente */
}

textarea {
  resize: vertical;
  min-height: 3.5rem;
}

select {
  appearance: none;
}

.app-shell {
  width: min(1220px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.4rem 0 2rem;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: stretch;
  padding: 1rem 0 1.2rem;
}

.eyebrow,
.section-kicker {
  /* text-transform: uppercase; */
  letter-spacing: 0.14em;
  font-size: 1.15rem;
  color: var(--primary-strong);
  font-weight: 700;
  margin: 0 0 0.4rem;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 1.02;
  max-width: 12ch;
}

.lead {
  margin-top: 0.95rem;
  max-width: 62ch;
  color: var(--muted);
  font-size: 1.03rem;
  line-height: 1.6;
}

.card,
.notice {
  background: var(--surface);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow);
}

.hero-actions {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: flex-end;
}

.utility-actions {
  align-self: start;
  justify-self: end;
  padding-top: 0.2rem;
}

.page-header {
  padding: 1.5rem 0 1.2rem;
  display: grid;
  gap: 1.5rem;
}

.page-header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

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

.page-header-brand img {
  width: 100px;
  height: 100px;
  object-fit: contain;
  flex-shrink: 0;
}

.page-header-brand .eyebrow {
  margin: 0;
}

.page-header-title {
  text-align: center;
  max-width: none;
}

.primary,
.secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.9rem 1.2rem;
  border-radius: 999px;
  text-decoration: none;
  cursor: pointer;
}

.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: white;
  box-shadow: 0 10px 28px rgba(124, 58, 237, 0.24); /* Sombra roxa sutil */
}

.secondary {
  background: rgba(255, 255, 255, 0.84);
  color: var(--text);
  border: 1px solid rgba(26, 16, 47, 0.12);
}

/* Apply hover transform to anchor-styled buttons too */
.primary:hover,
.secondary:hover,
button.primary:hover,
button.secondary:hover {
  transform: translateY(-1px);
}

.content {
  display: grid;
  gap: 1rem;
}

.view {
  display: grid;
  gap: 1rem;
}

.notice,
.card {
  border-radius: var(--radius);
}

.notice {
  padding: 1rem 1.15rem;
  display: flex;
  gap: 0.65rem;
  align-items: center;
  color: var(--muted);
}

.notice strong {
  color: var(--text);
}

.record-form {
  display: grid;
  gap: 1rem;
}

.card {
  padding: 1.2rem;
  display: grid;
  gap: 1rem;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  flex-wrap: wrap;
}

.section-head h2,
.card h3 {
  font-size: 1.15rem;
}

.grid {
  display: grid;
  gap: 0.9rem;
}

.two-cols {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.span-2 {
  grid-column: span 2;
}

label,
.field-group {
  display: grid;
  gap: 0.45rem;
  color: var(--text);
}

label > span,
.field-group > span {
  font-weight: 600;
}

.field-group,
.check-grid,
.check-list {
  padding: 0.95rem;
  border: 1px solid rgba(26, 16, 47, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
}

.field-group {
  grid-template-columns: repeat(auto-fit, minmax(160px, max-content));
  align-items: center;
  gap: 0.55rem 0.9rem;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem 1rem;
}

.check-list {
  display: grid;
  gap: 0.7rem;
}

.check-grid label,
.check-list label,
.field-group label {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 500;
}

.inline-field {
  display: grid;
  gap: 0.35rem;
  align-items: center;
}

.inline-field.small {
  grid-template-columns: 130px minmax(0, 1fr);
}

.compact {
  min-width: min(100%, 260px);
}

.spaced-top {
  margin-top: 0.2rem;
}

.spaced-top-sm {
  margin-top: 1rem;
}

.form-actions {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.records-view {
  min-height: 40vh;
}

.records-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
}

.records-lead {
  max-width: 56ch;
  margin-top: 0.55rem;
}

.records-summary {
  display: grid;
  justify-items: end;
  gap: 0.2rem;
  color: var(--muted);
  min-width: 8rem;
}

.records-summary strong {
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1;
  color: var(--primary-strong);
}

.records-summary span {
  font-size: 0.9rem;
}

.records-list {
  display: grid;
  gap: 0.9rem;
}

.record-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  padding: 1.1rem 1.15rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(26, 16, 47, 0.09);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 10px 30px rgba(26, 16, 47, 0.08);
}

.record-card-content {
  display: grid;
  gap: 0.35rem;
}

.record-card h3 {
  font-size: 1.05rem;
}

.record-card-meta,
.record-card-secondary {
  color: var(--muted);
  line-height: 1.45;
}

.record-card-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.record-card-actions .secondary {
  white-space: nowrap;
}

.records-empty {
  justify-content: space-between;
}

.toast {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  background: rgba(26, 16, 47, 0.96); /* Toast com base roxa bem escura */
  color: white;
  padding: 0.95rem 1.1rem;
  border-radius: 16px;
  box-shadow: 0 16px 42px rgba(26, 16, 47, 0.24);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

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

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

  .utility-actions {
    justify-self: start;
  }

  .records-header,
  .record-card {
    grid-template-columns: 1fr;
  }

  .records-summary {
    justify-items: start;
  }

  .record-card-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 740px) {
  .app-shell {
    width: min(100% - 1rem, 100%);
    padding-top: 0.5rem;
  }

  .two-cols,
  .check-grid {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }

  .inline-field.small {
    grid-template-columns: 1fr;
  }

  .hero-card,
  .card,
  .notice {
    border-radius: 20px;
  }

  .records-header {
    align-items: start;
  }

  .hero-actions,
  .form-actions {
    flex-direction: column;
  }

  .hero-actions button,
  .form-actions button {
    width: 100%;
  }
}

@media print {
  body {
    background: white;
  }

  .utility-actions,
  .notice,
  .form-actions,
  .records-view,
  .toast {
    display: none !important;
  }

  .app-shell {
    width: 100%;
    padding: 0;
  }

  .card {
    box-shadow: none;
    border: 1px solid #d8b4fe; /* Borda lilás sutil no papel de impressão */
    page-break-inside: auto;
    break-inside: auto;
  }

  input,
  textarea,
  select {
    border-color: #a78bfa; /* Tom roxo/lilás para os inputs na impressão */
    background: white;
  }

  * {
    page-break-inside: auto !important;
    break-inside: auto !important;
  }

  html,
  body {
    page-break-after: avoid;
    page-break-before: avoid;
  }
}