:root {
  --navy-950: #0b1738;
  --navy-900: #12285f;
  --blue-700: #1f67a6;
  --blue-600: #287db9;
  --blue-100: #eaf4fb;
  --surface: #ffffff;
  --canvas: #f3f6fa;
  --ink: #17243a;
  --muted: #64748b;
  --line: #d7e1ed;
  --line-strong: #b7c7da;
  --danger: #b42318;
  --success: #177644;
  --shadow: 0 10px 30px rgba(18, 40, 95, .08);
}

* { box-sizing: border-box; }

html { color-scheme: light; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--canvas);
  color: var(--ink);
  font: 14px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select, textarea { font: inherit; }

.topbar {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px max(28px, calc((100vw - 1160px) / 2));
  color: white;
  background: linear-gradient(115deg, var(--navy-950), var(--navy-900));
}

.brand {
  width: 230px;
  height: 85px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 14px;
  background: transparent;
  box-shadow: none;
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 14px;
}

.nav { display: flex; align-items: center; gap: 18px; }
.nav form { margin: 0; }
.nav a, .login-link, .link-button {
  border: 0;
  background: none;
  color: #eaf4fb;
  text-decoration: none;
  cursor: pointer;
}

.page {
  width: min(1160px, calc(100% - 40px));
  margin: 30px auto 56px;
}

.hero { margin-bottom: 20px; }

.form-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.hero-copy { max-width: 760px; }

.form-hero h1 {
  margin: 0;
  color: var(--navy-900);
  font-size: clamp(34px, 4vw, 42px);
  line-height: 1.06;
  letter-spacing: -.035em;
}

.form-hero h1 span { color: var(--blue-600); }

.hero-subtitle {
  margin: 7px 0 0;
  color: var(--navy-900);
  font-size: 18px;
  font-weight: 700;
}

.hero-description {
  max-width: 700px;
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.compact-hero h1 {
  margin: 2px 0 4px;
  color: var(--navy-900);
  font-size: 30px;
  line-height: 1.15;
}

.compact-hero p:not(.eyebrow) { margin: 0 0 12px; color: var(--muted); }

.eyebrow {
  margin: 0;
  color: var(--blue-700);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.card, .filter-card, .login-card, .success-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.form { padding: 4px 28px 28px; }

.section {
  padding: 25px 0;
  border-bottom: 1px solid var(--line);
}

.section:last-of-type { border-bottom: 0; }

.section h2 {
  margin: 0;
  color: var(--navy-900);
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: -.01em;
}

.section h2 span {
  margin-left: 6px;
  color: var(--blue-700);
  font-size: 10px;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.section h3 {
  margin: 0;
  color: var(--navy-900);
  font-size: 13px;
}

.section-heading { margin-bottom: 18px; }
.section-heading p, .muted {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.private {
  margin: 0 -12px;
  padding-right: 12px;
  padding-left: 12px;
  background: #f8fbfe;
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 15px 16px;
}

.span-12 { grid-column: span 12; }
.span-8 { grid-column: span 8; }
.span-6 { grid-column: span 6; }
.span-4 { grid-column: span 4; }
.span-3 { grid-column: span 3; }
.span-2 { grid-column: span 2; }

.field {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 6px;
}

.field > label {
  color: #34445d;
  font-size: 12px;
  font-weight: 750;
}

.field input:not([type="radio"]):not([type="checkbox"]),
.field select,
.field textarea,
.filter-card input,
.filter-card select,
.authorized-row input {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  outline: none;
  background: white;
  color: var(--ink);
}

.field textarea { min-height: 92px; resize: vertical; }

.field input:not([type="radio"]):not([type="checkbox"]):focus,
.field select:focus,
.field textarea:focus,
.authorized-row input:focus {
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px rgba(40, 125, 185, .14);
}

.field em, .consent em {
  color: var(--danger);
  font-size: 11px;
  font-style: normal;
}

.registration-type { padding-bottom: 2px; }

.segmented-choice {
  width: fit-content;
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f2f5f9;
}

.segmented-choice label { position: relative; cursor: pointer; }
.segmented-choice input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.segmented-choice span {
  min-height: 34px;
  display: flex;
  align-items: center;
  padding: 7px 16px;
  border-radius: 7px;
  color: #52627a;
  font-size: 13px;
  font-weight: 700;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}

.segmented-choice input:checked + span {
  background: white;
  color: var(--navy-900);
  box-shadow: 0 1px 5px rgba(18, 40, 95, .15);
}

.segmented-choice input:focus-visible + span {
  outline: 2px solid var(--blue-600);
  outline-offset: 1px;
}

.choices {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px 18px;
  min-height: 42px;
}

.choices label, .consent label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 500;
}

.choices input[type="radio"],
.choices input[type="checkbox"],
.consent input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-height: 0;
  margin: 0;
  padding: 0;
  accent-color: var(--blue-600);
}

.lookup-feedback {
  min-height: 14px;
  color: var(--muted);
  font-size: 11px;
}

.lookup-feedback.loading { color: var(--blue-700); }
.lookup-feedback.success { color: var(--success); }
.lookup-feedback.error { color: var(--danger); }

.cnpj-overwrite-dialog {
  width: min(560px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: 16px;
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(11, 23, 56, .3);
}

.cnpj-overwrite-dialog::backdrop { background: rgba(11, 23, 56, .58); }
.cnpj-overwrite-content { padding: 28px; }
.cnpj-overwrite-content h2 { margin: 4px 0 10px; color: var(--navy-900); font-size: 24px; }
.cnpj-overwrite-content > p:not(.eyebrow) { margin: 0; color: var(--muted); }
.cnpj-overwrite-list { display: grid; gap: 8px; margin: 20px 0; padding: 0; list-style: none; }
.cnpj-overwrite-list li { display: grid; grid-template-columns: 1fr auto auto auto; gap: 7px; align-items: center; padding: 10px 12px; border-radius: 8px; background: #f3f7fb; font-size: 12px; }
.cnpj-overwrite-list strong { color: var(--navy-900); }
.cnpj-overwrite-list span { max-width: 140px; overflow: hidden; color: #52627a; text-overflow: ellipsis; white-space: nowrap; }
.cnpj-overwrite-list span:last-child { color: var(--success); font-weight: 700; }
.cnpj-overwrite-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; }

.inline-list { display: grid; gap: 16px; margin-top: 14px; }
.inline-group { display: grid; gap: 7px; }
.inline-record { display: grid; gap: 10px; }
.bank-record { grid-template-columns: 1.35fr repeat(4, 1fr); }
.commercial-record { grid-template-columns: 1.5fr 1fr 1fr; }
.responsible-record { grid-template-columns: 1.25fr 1fr 1.3fr 1fr; }

.authorized-row {
  display: grid;
  grid-template-columns: 1.25fr 1fr 1fr 42px;
  gap: 10px;
  margin: 14px 0 10px;
}

.remove-row {
  width: 42px;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: #fdecec;
  color: #9b2020;
  font-size: 20px;
  cursor: pointer;
}

.consent {
  display: grid;
  gap: 5px;
  margin: 22px 0;
  padding: 14px 16px;
  border-radius: 9px;
  background: #f3f7fb;
  color: #3e4f68;
  font-size: 12px;
}

.form-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

.primary { background: var(--blue-700); color: white; }
.primary:hover { background: #195a94; }
.secondary { border-color: var(--line-strong); background: white; color: var(--navy-900); }

.alert { margin: 0 0 14px; padding: 11px 14px; border-radius: 8px; }
.error { border: 1px solid #efb9b9; background: #fff0f0; color: #7d1717; }

.status-panel .compact { max-width: 280px; margin-top: 14px; }

.filter-card { display: flex; gap: 10px; margin-bottom: 16px; padding: 13px; }
.filter-card input { flex: 1; }
.filter-card select { max-width: 200px; }

.table-wrap { overflow: auto; }
.table-wrap table { width: 100%; min-width: 690px; border-collapse: collapse; }
.table-wrap th, .table-wrap td { padding: 12px 15px; border-bottom: 1px solid var(--line); text-align: left; }
.table-wrap th { background: #f8fafc; color: var(--muted); font-size: 11px; letter-spacing: .05em; text-transform: uppercase; }
.table-wrap a { color: var(--blue-700); font-weight: 700; }
.empty { text-align: center; color: var(--muted); }

.status { padding: 4px 8px; border-radius: 99px; background: var(--blue-100); color: #185b93; font-size: 11px; }
.status.concluido { background: #e6f7ed; color: var(--success); }
.status.recebido { background: #fff4dc; color: #875a00; }

.two-cols { display: grid; grid-template-columns: minmax(270px, .72fr) minmax(0, 1.75fr); gap: 18px; }
.small-card { padding: 20px; }
.small-card h2 { margin: 0 0 15px; color: var(--navy-900); font-size: 19px; }

.login-card { width: min(410px, 100%); margin: 8vh auto; padding: 28px; }
.login-card h1, .success-card h1 { margin: 4px 0 18px; color: var(--navy-900); font-size: 29px; }
.login-card .field { margin-bottom: 13px; }
.login-card .button { width: 100%; margin-top: 5px; }

.success-card { max-width: 650px; margin: 8vh auto; padding: 38px; text-align: center; }
.success-card .check { width: 54px; height: 54px; display: grid; place-items: center; margin: 0 auto 14px; border-radius: 50%; background: #e7f7ee; color: var(--success); font-size: 31px; }

footer { padding: 20px; color: var(--muted); font-size: 11px; text-align: center; }

@media (max-width: 980px) {
  .bank-record { grid-template-columns: repeat(3, 1fr); }
  .responsible-record { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .topbar { align-items: flex-start; padding: 12px 4vw; }
  .brand { width: 180px; height: 67px; border-radius: 11px; }
  .brand-logo { border-radius: 11px; }
  .nav { flex-wrap: wrap; justify-content: flex-end; gap: 10px; font-size: 12px; }
  .page { width: min(94vw, 1160px); margin-top: 22px; }
  .form { padding: 2px 18px 22px; }
  .form-hero { display: block; }
  .form-hero .button { margin-top: 14px; }
  .form-hero h1 { font-size: 34px; }
  .span-8, .span-6, .span-4, .span-3, .span-2 { grid-column: span 12; }
  .two-cols { grid-template-columns: 1fr; }
  .filter-card { flex-direction: column; }
  .filter-card select { max-width: none; }
  .authorized-row { grid-template-columns: 1fr; }
  .remove-row { width: 100%; }
  .cnpj-overwrite-list li { grid-template-columns: 1fr; gap: 3px; }
  .cnpj-overwrite-list span { max-width: none; }
  .cnpj-overwrite-actions .button { width: 100%; }
}

@media (max-width: 620px) {
  .bank-record, .commercial-record, .responsible-record { grid-template-columns: 1fr; }
  .segmented-choice { width: 100%; }
  .segmented-choice label { flex: 1; }
  .segmented-choice span { justify-content: center; }
}
