:root {
  --bg: #f5f6f8;
  --card: #fff;
  --text: #1c2230;
  --muted: #667085;
  --line: #e3e6eb;
  --brand: #1f2c8f;
  --brand-2: #c8102e;
  --ok: #157f3b;
  --ok-bg: #e7f6ec;
  --info: #1d5fbf;
  --info-bg: #e8f0fc;
  --warn: #8a5a00;
  --warn-bg: #fff6e0;
  --err: #b42318;
  --err-bg: #fdecea;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--brand); }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 12px; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 24px; padding-bottom: 48px; }
.muted { color: var(--muted); margin: 0 0 16px; }

.nav { background: #fff; border-bottom: 1px solid var(--line); }
.nav .wrap { display: flex; align-items: center; gap: 24px; min-height: 56px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--brand); font-weight: 700; }
.brand img { height: 30px; }
.nav nav { display: flex; gap: 16px; flex: 1; flex-wrap: wrap; }
.nav nav a { text-decoration: none; color: var(--text); }
.nav nav a:hover { color: var(--brand); }
.me { display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: 13px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px; margin-bottom: 16px; }
.head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.grid { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 16px; align-items: start; }
@media (max-width: 960px) { .grid { grid-template-columns: 1fr; } }

.btn { display: inline-block; border: 1px solid var(--line); background: #fff; color: var(--text); padding: 8px 14px; border-radius: 8px; font: inherit; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: #c5cad3; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: #18237a; }
.btn.big { padding: 12px 22px; font-size: 16px; }
.btn[disabled], .link[disabled] { opacity: .5; cursor: not-allowed; }
.link { background: none; border: 0; padding: 0; color: var(--brand); cursor: pointer; font: inherit; text-decoration: underline; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
form.inline { display: inline; }

.form label { display: block; margin-bottom: 14px; font-weight: 600; font-size: 14px; }
.form input:not([type=radio]):not([type=checkbox]), .form select, .form textarea, .search input {
  display: block; width: 100%; margin-top: 4px; padding: 8px 10px; border: 1px solid #cfd4dc; border-radius: 8px; font: inherit; font-weight: 400; background: #fff;
}
.form small { display: block; font-weight: 400; color: var(--muted); margin-top: 4px; }
.form.row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.form.row label { flex: 1; min-width: 180px; margin-bottom: 0; }
.form fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin: 0 0 14px; }
.form legend { font-weight: 700; padding: 0 4px; }
.radios label { display: inline-flex; gap: 6px; margin-right: 20px; font-weight: 400; }
.cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 14px; }
.cols2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 0 14px; }
textarea.code { font: 13px/1.4 ui-monospace, Menlo, monospace; }
.search { display: flex; gap: 8px; margin-bottom: 16px; }
.search input { margin: 0; max-width: 420px; }

table { border-collapse: collapse; width: 100%; }
.list { background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.list th, .list td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); }
.list th { background: #fafbfc; font-size: 13px; color: var(--muted); }
.list tbody tr { cursor: pointer; }
.list tbody tr:hover { background: #f8f9fc; }
tr.inativo td { color: var(--muted); }
tr.inativo td a { color: var(--muted); text-decoration: line-through; }
.docs td { padding: 8px 4px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 14px; }
.docs td a { word-break: break-word; }
.docs small { display: block; color: var(--muted); }
.docs small.erro { color: var(--err); }
.docs + form { margin-top: 14px; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.erro { background: var(--err-bg); color: var(--err); }
.badge.neutro { background: #eef0f3; color: var(--muted); }

.alert { padding: 10px 14px; border-radius: 8px; margin: 0 0 16px; }
.alert.ok { background: var(--ok-bg); color: var(--ok); }
.alert.info { background: var(--info-bg); color: var(--info); }
.alert.aviso { background: var(--warn-bg); color: var(--warn); }
.alert.erro { background: var(--err-bg); color: var(--err); word-break: break-word; }
.alert.aviso form { margin-left: 8px; }
.alert ul { margin: 8px 0 0; padding-left: 20px; }
.alert summary { cursor: pointer; font-weight: 600; }

.preview { width: 100%; border: 1px solid var(--line); border-radius: 6px; display: block; }
.empty { color: var(--muted); padding: 24px 0; text-align: center; }
.versions, .events { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.versions li, .events li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.versions a { margin-left: 6px; }
.events span { color: var(--muted); }

.scroll { overflow-x: auto; }
.edit-grid th, .edit-grid td { padding: 3px 4px; border-bottom: 1px solid var(--line); font-size: 13px; }
.edit-grid thead th { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.edit-grid tbody th { text-align: left; font-weight: 500; white-space: nowrap; }
.edit-grid th.ind { padding-left: 20px; color: var(--muted); }
.edit-grid input { margin: 0 !important; min-width: 140px; padding: 5px 7px !important; }
input.editado { background: #fff6d6 !important; border-color: #e0b000 !important; }

.logos { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.logo-card { display: flex; flex-direction: column; align-items: center; gap: 6px; text-decoration: none; color: var(--text); margin: 0; }
.logo-card img { height: 48px; max-width: 150px; object-fit: contain; }
.logo-card small { color: var(--muted); }
.logo-card.inativo { opacity: .5; }
.help li { margin-bottom: 6px; }

.login { max-width: 420px; margin: 60px auto; text-align: center; }
.login-logo { height: 70px; }
.login .dev { margin-top: 24px; text-align: left; border-top: 1px solid var(--line); padding-top: 16px; }
.login .dev input { display: block; width: 100%; padding: 8px; margin: 4px 0 8px; border: 1px solid #cfd4dc; border-radius: 8px; }

/* Área de upload (arrastar e soltar) */
.dropzone {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px; margin: 0;
  border: 1.5px dashed #b9c0cc; border-radius: 12px; background: #fbfcfe; color: var(--text);
  cursor: pointer; transition: border-color .15s, background .15s, box-shadow .15s;
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--brand); background: #f3f5fd; outline: none; }
.dropzone.over { border-color: var(--brand); border-style: solid; background: #eaeefc; box-shadow: 0 0 0 4px rgba(31, 44, 143, .12); }
.dropzone.erro { border-color: var(--err); }
.dropzone.erro .dz-hint { color: var(--err); }
.dropzone.busy { cursor: progress; border-style: solid; }
.dropzone.disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.dz-icon {
  flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 10px;
  background: var(--brand); color: #fff; transition: transform .15s;
}
.dropzone.over .dz-icon { transform: translateY(-2px); }
.dropzone.busy .dz-icon svg { animation: dz-pulse 1s ease-in-out infinite; }
@keyframes dz-pulse { 50% { transform: translateY(-3px); opacity: .6; } }
.dz-text { display: flex; flex-direction: column; min-width: 0; }
.dz-text b { font-size: 15px; }
.dz-hint { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.dz-hint u { color: var(--brand); text-decoration-color: rgba(31, 44, 143, .35); }
aside .dropzone { margin-top: 14px; padding: 12px 14px; }
aside .dz-icon { width: 34px; height: 34px; }

/* Lista de propostas */
.head .search { margin: 0; }
.head .search input { width: 280px; max-width: 100%; }
.list.home td { vertical-align: middle; }
.list.home tr.new-row, .list.home tr.new-row:hover { background: #fff; cursor: default; }
.list.home tr.new-row td { padding: 10px; }
.list.home tr.vazio td { text-align: center; color: var(--muted); padding: 24px; cursor: default; }
.list .cliente { font-weight: 600; text-decoration: none; color: var(--text); }
.list td small { display: block; color: var(--muted); font-size: 12px; }
.list .seg { display: inline-flex; align-items: center; gap: 8px; }
.list .seg img { height: 22px; max-width: 56px; object-fit: contain; }
.muted-i { color: var(--muted); font-style: italic; }
.nowrap { white-space: nowrap; color: var(--muted); font-size: 13px; }
.badge.info::before {
  content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; vertical-align: -1px;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 720px) {
  .list.home th:nth-child(4), .list.home td:nth-child(4), .list.home th:nth-child(5), .list.home td:nth-child(5) { display: none; }
}

/* Página da proposta */
.solo { max-width: 760px; }
.spin { display: inline-block; width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; }
.alert .spin { margin-right: 6px; }
.progresso h2 { font-size: 18px; margin-bottom: 4px; }
.steps { list-style: none; margin: 18px 0 4px; padding: 0; }
.step { position: relative; display: flex; gap: 14px; align-items: flex-start; padding-bottom: 18px; color: var(--muted); }
.step:not(:last-child)::before { content: ""; position: absolute; left: 13px; top: 28px; bottom: 2px; width: 2px; background: var(--line); }
.step.feito:not(:last-child)::before { background: var(--ok); }
.step .dot { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line); background: #fff; font-size: 13px; font-weight: 700; }
.step b { display: block; font-weight: 600; padding-top: 3px; }
.step small { display: block; font-size: 13px; }
.step.feito { color: var(--text); }
.step.feito .dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.step.atual { color: var(--text); }
.step.atual .dot { border-color: var(--info); color: var(--info); }
.step.erro { color: var(--err); }
.step.erro .dot { background: var(--err); border-color: var(--err); color: #fff; }

.doclist { list-style: none; margin: 0; padding: 0; }
.doc { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.doc-st { flex: none; display: grid; place-items: center; width: 20px; height: 20px; margin-top: 1px; border-radius: 50%; font-size: 12px; font-weight: 700; background: #eef0f3; color: var(--muted); }
.doc.extraido .doc-st { background: var(--ok-bg); color: var(--ok); }
.doc.extraindo .doc-st { background: var(--info-bg); color: var(--info); }
.doc.extraindo .doc-st .spin { width: 10px; height: 10px; }
.doc.erro .doc-st { background: var(--err-bg); color: var(--err); }
.doc-main { flex: 1; min-width: 0; }
.doc-main a { color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.doc-main a:hover { text-decoration: underline; }
.doc-main small { display: block; color: var(--muted); font-size: 12px; }
.doc.erro small { color: var(--err); }
.doc.fora { opacity: .65; }
.doc.fora.inativo a { text-decoration: line-through; }
.doc-sep { padding: 14px 0 2px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.link.sutil { color: var(--muted); font-size: 13px; text-decoration: none; }
.link.sutil:hover { color: var(--brand); text-decoration: underline; }
.reproc { margin-top: 10px; text-align: right; }
.card .dropzone { margin-top: 14px; }

details.dobra summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; }
details.dobra summary::-webkit-details-marker { display: none; }
details.dobra summary h2 { margin: 0; }
details.dobra summary::after { content: "▾"; color: var(--muted); transition: transform .15s; }
details.dobra[open] summary::after { transform: rotate(180deg); }
details.dobra[open] summary { margin-bottom: 12px; }
.list.home tr.recem td { animation: recem 2.5s ease-out; }
@keyframes recem { from { background: #e3e9fd; } to { background: transparent; } }
.obs { margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.obs summary { cursor: pointer; }
.obs ul { margin: 6px 0 0; padding-left: 18px; }
.obs li { margin-bottom: 4px; }
.obs b { font-weight: 600; color: var(--text); }
.uso small { display: inline; } .nota { font-size: 12px; margin: 10px 0 0; }
