/* ============================================================
   Integration-panel showcase styles — Advbox & ZapSign
   Builds on cactus.css + screens.css tokens
   ============================================================ */

/* ---------- Gallery shell ---------- */
.gal {
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 12% -10%, rgba(123,160,91,.10), transparent 60%),
    var(--bg);
  padding: 40px 44px 80px;
}
.gal-head { max-width: 1100px; margin: 0 auto 30px; }
.gal-eyebrow {
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
  color: var(--green-500);
}
.gal-eyebrow .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }
.gal h1 { font-size: 38px; letter-spacing: -.02em; margin: 12px 0 8px; }
.gal-sub { color: var(--text-2); font-size: 15px; max-width: 720px; line-height: 1.6; }
.gal-legend { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 18px; }
.gal-legend span { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.gal-legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

.gal-section { margin: 0 auto; max-width: 1760px; }
.gal-section + .gal-section { margin-top: 46px; }
.gal-sec-head { display: flex; align-items: center; gap: 14px; margin: 0 0 18px; padding-left: 2px; }
.gal-sec-head h2 { font-size: 23px; letter-spacing: -.01em; white-space: nowrap; flex-shrink: 0; }
.gal-sec-head .tag {
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em;
  padding: 3px 9px; border-radius: 999px; background: var(--green-100); color: var(--green-700);
}
[data-theme="dark"] .gal-sec-head .tag { color: var(--green-400); }
.gal-sec-head .ln { flex: 1; height: 1px; background: var(--border); }

.gal-track {
  display: flex; gap: 30px; padding: 6px 2px 26px; overflow-x: auto; align-items: flex-start;
}
.gal-frame { display: flex; flex-direction: column; gap: 12px; flex-shrink: 0; }
.gal-cap { display: flex; align-items: center; gap: 9px; padding-left: 4px; }
.gal-cap .num {
  width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center;
  background: var(--green-700); color: var(--on-green); font-size: 11px; font-weight: 800; flex-shrink: 0;
}
.gal-cap .lab { font-weight: 800; font-size: 13.5px; white-space: nowrap; }
.gal-cap .meta { font-size: 12px; color: var(--text-3); font-weight: 600; white-space: nowrap; }

/* a single rendered panel sits in a device-ish frame */
.ip-frame {
  width: 366px; height: 822px; border-radius: 18px; overflow: hidden;
  box-shadow: var(--shadow-lg); background: var(--surface);
  border: 1px solid var(--border); position: relative;
}
.ip-frame.dark-frame { box-shadow: 0 18px 46px rgba(0,0,0,.5); }

/* ---------- Panel shell ---------- */
.ipanel { width: 100%; max-width: 100%; height: 100%; display: flex; flex-direction: column; background: var(--surface); min-height: 0; min-width: 0; }

.ip-head { display: flex; align-items: center; gap: 12px; padding: 15px 15px 14px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.ip-logo { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; color: #fff; flex-shrink: 0; box-shadow: var(--shadow-sm); }
.ip-head .nm { font-family: var(--font-title); font-weight: 700; font-size: 16px; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.ip-head .meta { font-size: 12px; color: var(--text-2); margin-top: 2px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.ip-head .meta .sep { width: 3px; height: 3px; border-radius: 50%; background: var(--text-3); }
.ip-cpf { font-family: ui-monospace, monospace; font-size: 11.5px; color: var(--text-3); margin-top: 3px; }

.ip-prefill {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 999px;
  font-size: 10.5px; font-weight: 800; letter-spacing: .02em;
  background: var(--gold-soft); color: var(--gold);
}
[data-theme="dark"] .ip-prefill { background: #3a3013; }

/* ---------- Tab strip ---------- */
.ip-tabs { display: flex; border-bottom: 1px solid var(--border); flex-shrink: 0; background: var(--surface-2); }
.ip-tab {
  flex: 1; border: none; background: transparent; cursor: pointer; padding: 9px 2px 7px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: var(--text-3); position: relative; transition: color .15s; min-width: 0;
}
.ip-tab .tl { font-size: 9.5px; font-weight: 800; letter-spacing: .01em; }
.ip-tab:hover { color: var(--text-2); }
.ip-tab.on { color: var(--green-600); }
[data-theme="dark"] .ip-tab.on { color: var(--green-400); }
.ip-tab.on::after {
  content: ""; position: absolute; left: 18%; right: 18%; bottom: -1px; height: 2.5px;
  border-radius: 2px 2px 0 0; background: var(--green-500);
}
[data-theme="dark"] .ip-tab.on::after { background: var(--green-400); }

/* ZapSign uses a 2-up segmented tab */
.ip-tabs.two .ip-tab { flex-direction: row; gap: 7px; padding: 12px 6px; }
.ip-tabs.two .ip-tab .tl { font-size: 12.5px; }

.ip-body { flex: 1; overflow-y: auto; min-height: 0; }
.ip-pad { padding: 14px 15px 26px; }

/* ---------- Process card (richer than integ-card) ---------- */
/* S9: leve elevação + realce no hover (o cartão leva pra Andamentos) */
.pc { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 13px; margin-bottom: 9px; box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s; }
.pc:hover { border-color: var(--green-200); }
.pc-top { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.pc-intern { font-family: ui-monospace, monospace; font-size: 11px; font-weight: 800; color: var(--text-2); background: var(--surface-3); padding: 2px 7px; border-radius: 5px; }
.pc-cnj { font-family: ui-monospace, monospace; font-size: 12.5px; font-weight: 700; letter-spacing: -.01em; margin-bottom: 9px; word-break: break-all; }
.pc-foot { display: flex; align-items: center; gap: 7px; margin-top: 10px; padding-top: 9px; border-top: 1px dashed var(--border); }
.pc-dates { display: flex; gap: 14px; margin-top: 9px; }
.pc-dates .kv-k { margin-bottom: 1px; }

/* clickable list row */
.ip-link { display: inline-flex; align-items: center; gap: 5px; color: var(--green-600); font-weight: 800; font-size: 12px; background: none; border: none; cursor: pointer; padding: 0; }
[data-theme="dark"] .ip-link { color: var(--green-400); }

/* ---------- Process selector ---------- */
.proc-select {
  display: flex; align-items: center; gap: 9px; width: 100%; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: 9px 11px; margin-bottom: 14px; text-align: left;
}
.proc-select .mono { font-family: ui-monospace, monospace; font-size: 11.5px; font-weight: 700; }

/* ---------- Andamento tag chip ---------- */
.mv-tag { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; padding: 2px 7px; border-radius: 999px; background: var(--green-50); color: var(--green-600); }
[data-theme="dark"] .mv-tag { background: var(--green-50); color: var(--green-400); }

/* ---------- CNJ search ---------- */
.cnj-search { display: flex; gap: 8px; margin-bottom: 6px; }
.cnj-search .input { flex: 1; font-family: ui-monospace, monospace; font-size: 12px; }
.cnj-result-head { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 13px; margin-bottom: 12px; }
.cnj-source { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 800; color: var(--st-active); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 9px; }

/* ---------- Parcela rows (financeiro) ---------- */
.parc-row { display: flex; align-items: center; gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--border-soft); }
.parc-n { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-size: 11px; font-weight: 800; flex-shrink: 0; background: var(--surface-3); color: var(--text-2); }
.parc-row.paid .parc-n { background: color-mix(in srgb, var(--st-done) 16%, transparent); color: var(--st-done); }
[data-theme="dark"] .parc-row.paid .parc-n { color: #9bbb5e; }
.parc-mid { flex: 1; min-width: 0; }
.parc-val { font-weight: 800; font-size: 13.5px; }
.parc-due { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.parc-hist { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.fin-totals { display: flex; gap: 9px; margin: 14px 0 6px; }

/* ---------- Aviso destacado: financeiro indisponível / Advbox degradado (S9) ----------
   Promove os 3 ramos do "Resumo financeiro" a CAIXA destacada.
   O texto e a lógica dos ramos ficam no JSX (AdvResumo) — aqui é só a casca visual. */
.adv-warn { display: flex; align-items: flex-start; gap: 9px; margin: 10px 0;
  padding: 11px 13px; border-radius: var(--r-lg); border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-2); box-shadow: var(--shadow-sm); }
.adv-warn svg { flex-shrink: 0; margin-top: 1px; }
.adv-warn .tiny, .adv-warn b { color: inherit; }
/* "sem CPF" — âmbar/ouro: cadastro incompleto, ação do operador resolve */
.adv-warn.indis { border-color: color-mix(in srgb, var(--gold) 38%, var(--border));
  background: color-mix(in srgb, var(--gold) 9%, var(--surface)); color: #8a6a26; }
[data-theme="dark"] .adv-warn.indis { background: color-mix(in srgb, var(--gold) 15%, var(--surface)); color: var(--gold-soft); }
/* "Advbox não respondeu" / dados parciais — teal: conectividade temporária, não erro de cadastro */
.adv-warn.degraded { border-color: color-mix(in srgb, var(--st-active) 32%, var(--border));
  background: color-mix(in srgb, var(--st-active) 8%, var(--surface)); color: var(--st-active); }
[data-theme="dark"] .adv-warn.degraded { color: #66b3a0; background: color-mix(in srgb, var(--st-active) 14%, var(--surface)); }

/* ---------- Cadastro (mini-form) ---------- */
.mini-form { display: flex; flex-direction: column; gap: 11px; }
.mini-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field .input.lock, .field .select.lock { background: var(--surface-3); color: var(--text-2); }
.lock-hint { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 700; color: var(--gold); }

/* ---------- Ações (shortcut tiles) ---------- */
.act-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.act-tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 9px; text-align: left;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 13px; cursor: pointer; transition: border-color .15s, transform .12s;
}
.act-tile:hover { border-color: var(--green-400); transform: translateY(-1px); }
.act-tile .ai { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; }
.act-tile .at { font-weight: 800; font-size: 13px; }
.act-tile .ad { font-size: 11px; color: var(--text-3); line-height: 1.35; }
.act-full { grid-column: 1 / -1; }

/* ---------- Envelopes (ZapSign) ---------- */
.env-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 13px; margin-bottom: 10px; position: relative; box-shadow: var(--shadow-sm); }
.env-card::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; }
.env-card.env-draft::before { background: var(--st-wait); }
.env-card.env-wait::before { background: var(--st-open); }
.env-card.env-signed::before { background: var(--st-done); }
.env-card.env-cancel::before { background: var(--text-3); }
.env-top { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.env-id { font-family: ui-monospace, monospace; font-size: 11px; font-weight: 800; color: var(--text-2); }
.env-model { font-weight: 700; font-size: 13px; line-height: 1.35; margin: 2px 0 4px; }
.env-progress { height: 5px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin: 9px 0 4px; }
.env-progress i { display: block; height: 100%; background: var(--green-400); border-radius: 99px; }
.env-actions { display: flex; gap: 7px; margin-top: 10px; }
.env-actions .btn { flex: 1; }

/* ---------- Form (Novo fechamento) ---------- */
.fsec { border: 1px solid var(--border); border-radius: var(--r-lg); margin-bottom: 12px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow-sm); }
.fsec-head { display: flex; align-items: center; gap: 10px; padding: 11px 13px; background: var(--surface-2); }
.fsec-num { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; background: var(--green-700); color: var(--on-green); font-size: 11px; font-weight: 800; flex-shrink: 0; }
[data-theme="dark"] .fsec-num { background: var(--green-400); color: var(--green-900); }
.fsec-title { font-weight: 800; font-size: 13px; }
.fsec-body { padding: 13px; display: flex; flex-direction: column; gap: 11px; }

/* checkbox doc row */
.doc-check { display: flex; align-items: center; gap: 11px; padding: 10px 11px; border: 1px solid var(--border); border-radius: var(--r); cursor: pointer; transition: border-color .15s, background .15s; }
.doc-check.on { border-color: var(--green-400); background: var(--green-50); }
.cbox { width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--border); display: grid; place-items: center; flex-shrink: 0; color: #fff; transition: background .15s, border-color .15s; }
.doc-check.on .cbox { background: var(--green-500); border-color: var(--green-500); }
.doc-check .col { flex: 1; min-width: 0; gap: 2px; }
.doc-check .dt { font-weight: 700; font-size: 13px; line-height: 1.2; }
.doc-check .ds { font-size: 11px; color: var(--text-3); line-height: 1.3; }

/* modality chips */
.mod-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.mod-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 700;
  font-size: 12.5px; color: var(--text-2); transition: all .15s;
}
.mod-chip.on { border-color: var(--green-500); background: var(--green-500); color: #fff; }
[data-theme="dark"] .mod-chip.on { background: var(--green-400); color: var(--green-900); border-color: var(--green-400); }

.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; min-width: 0; }
.witness-row { display: flex; gap: 9px; align-items: flex-start; }
.witness-row .wn { width: 26px; height: 26px; border-radius: 8px; background: var(--surface-3); color: var(--text-2); display: grid; place-items: center; font-weight: 800; font-size: 12px; flex-shrink: 0; margin-top: 26px; }

.form-foot { position: sticky; bottom: 0; background: linear-gradient(180deg, transparent, var(--surface) 28%); padding: 16px 0 2px; margin-top: 4px; }

/* ---------- State screens ---------- */
.ip-state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 40px 28px; text-align: center; }
.ip-state .si { width: 62px; height: 62px; border-radius: 16px; display: grid; place-items: center; }
.ip-state .st { font-family: var(--font-title); font-weight: 700; font-size: 17px; }
.ip-state .ss { font-size: 13px; color: var(--text-2); line-height: 1.5; max-width: 250px; }

/* skeleton loading */
.sk { background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%); background-size: 200% 100%; border-radius: 7px; animation: sksh 1.3s ease-in-out infinite; }
@keyframes sksh { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }
.sk-line { height: 11px; margin-bottom: 9px; }
.sk-card { height: 86px; border-radius: var(--r-lg); margin-bottom: 11px; }
.sk-circle { width: 42px; height: 42px; border-radius: 11px; }

.spinner { width: 38px; height: 38px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--green-500); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
