/* ==========================================================================
   Análise de Crédito — Ponto Mix Express
   Design: laranja da marca sobre slate neutro · Lexend + Source Sans 3
   ========================================================================== */
:root {
  /* Marca — laranja + azul royal do Ponto Mix Express */
  --brand: #e8611d;
  --brand-600: #d2530f;
  --brand-700: #b8480c;
  --brand-50: #fef4ee;
  --brand-100: #fbe4d5;
  --blue: #22389f;
  --blue-600: #1c2f88;
  --blue-50: #eef1fb;

  /* Neutros (slate) */
  --ink: #0f172a;
  --text: #334155;
  --muted: #64748b;
  --faint: #94a3b8;
  --line: #e5e9f0;
  --line-soft: #eef2f7;
  --bg: #f5f7fa;
  --card: #ffffff;

  /* Semânticos */
  --ok: #15803d;      --ok-bg: #e7f6ec;   --ok-line: #c3e9cf;
  --warn: #b45309;    --warn-bg: #fdf4e3; --warn-line: #f5e2b8;
  --danger: #b91c1c;  --danger-bg: #fdeceb; --danger-line: #f6cfcc;
  --info: #3538a8;    --info-bg: #eef1fb; --info-line: #d9def6;

  /* Formas */
  --r-sm: 8px; --r: 12px; --r-lg: 16px; --r-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.04), 0 1px 3px rgba(15,23,42,.05);
  --shadow: 0 2px 4px rgba(15,23,42,.04), 0 6px 16px rgba(15,23,42,.06);
  --shadow-md: 0 8px 28px rgba(15,23,42,.10);

  --font-ui: 'Lexend', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Source Sans 3', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --tap: 0;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-body); font-size: 15px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--brand-700); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--brand); text-decoration: underline; }

h1, h2, h3, .brand, .stat .n, .menu a, th, .btn, label {
  font-family: var(--font-ui);
}
h1 { font-size: 22px; font-weight: 600; letter-spacing: -.01em; color: var(--ink); margin: 0 0 4px; }
h2 { font-size: 16px; font-weight: 600; letter-spacing: -.005em; color: var(--ink); margin: 0 0 14px; }
h3 { font-weight: 600; color: var(--ink); }
.sub { color: var(--muted); margin: 0 0 22px; font-size: 14.5px; }

/* ── Topbar ─────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 28px;
  background: rgba(255,255,255,.85); backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 0 24px; height: 60px;
}
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); font-weight: 600; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--brand) 0%, var(--brand-600) 100%);
  color: #fff; font-weight: 800; font-size: 13px; letter-spacing: .02em;
  box-shadow: 0 2px 6px rgba(232,97,29,.35); flex: none;
}
.brand-name { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name b { font-size: 15px; letter-spacing: -.01em; color: var(--blue); font-weight: 700; }
.brand-name b em { color: var(--brand); font-style: normal; }
.brand-name span { font-size: 11px; color: var(--muted); font-weight: 500; }
.brand img.logo { height: 34px; width: auto; display: block; }

.menu { display: flex; gap: 2px; flex: 1; }
.menu a {
  display: inline-flex; align-items: center; gap: 7px;
  color: var(--text); padding: 8px 13px; border-radius: var(--r-sm);
  font-weight: 500; font-size: 14px; transition: background .15s ease, color .15s ease;
}
.menu a:hover { background: var(--line-soft); color: var(--ink); text-decoration: none; }
.menu a svg { width: 16px; height: 16px; opacity: .7; }

.user-box { display: flex; align-items: center; gap: 14px; }
.user-name { font-size: 13.5px; color: var(--muted); font-family: var(--font-ui); }
.tag-admin {
  background: var(--brand-50); color: var(--brand-700); font-size: 10.5px; font-weight: 600;
  padding: 2px 7px; border-radius: var(--r-pill); margin-left: 4px; letter-spacing: .02em;
  text-transform: uppercase; border: 1px solid var(--brand-100);
}
.inline { display: inline; margin: 0; }
.btn-link {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font: inherit; font-family: var(--font-ui); font-size: 13.5px; padding: 0; transition: color .15s;
}
.btn-link:hover { color: var(--danger); }

.container { max-width: 1120px; margin: 30px auto; padding: 0 24px; }

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm); padding: 22px; margin-bottom: 20px;
}
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 820px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ── Stat tiles ─────────────────────────────────────────────────────────── */
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 18px 20px; box-shadow: var(--shadow-sm);
  transition: transform .15s ease, box-shadow .15s ease;
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat .n { font-size: 32px; font-weight: 700; line-height: 1; color: var(--ink); letter-spacing: -.02em; }
.stat .l { color: var(--muted); font-size: 13px; margin-top: 8px; font-weight: 500; }
.stat.alerta { border-color: var(--danger-line); background: linear-gradient(180deg, #fff, var(--danger-bg)); }
.stat.alerta .n { color: var(--danger); }

/* ── Formulários ────────────────────────────────────────────────────────── */
label { display: block; font-weight: 500; font-size: 12.5px; color: var(--ink); margin-bottom: 6px; letter-spacing: .005em; }
input[type=text], input[type=password], input[type=number], input[type=date], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm);
  font: inherit; font-size: 14.5px; background: #fff; color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(232,97,29,.15);
}
textarea { min-height: 68px; resize: vertical; }
.field { margin-bottom: 15px; }
.field .ajuda { color: var(--muted); font-size: 12px; margin-top: 5px; font-weight: 400; line-height: 1.45; }
.field .ajuda a { font-weight: 500; }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > .field { flex: 1; min-width: 150px; }
.check { display: flex; align-items: center; gap: 9px; font-weight: 500; color: var(--ink); font-size: 14px; cursor: pointer; }
.check input { width: auto; accent-color: var(--brand); width: 16px; height: 16px; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 34px; }

/* ── Botões ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--brand); color: #fff; border: 1px solid transparent;
  padding: 10px 18px; border-radius: var(--r-sm); font-weight: 600; font-size: 14px;
  cursor: pointer; transition: background .15s ease, box-shadow .15s ease, transform .05s ease;
  box-shadow: 0 1px 2px rgba(232,97,29,.25); line-height: 1.2;
}
.btn:hover { background: var(--brand-600); text-decoration: none; box-shadow: 0 3px 10px rgba(232,97,29,.28); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn.sec { background: #fff; color: var(--ink); border-color: var(--line); box-shadow: var(--shadow-sm); }
.btn.sec:hover { background: var(--line-soft); border-color: #d7dde6; }
.btn.small { padding: 7px 13px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ── Alerts ─────────────────────────────────────────────────────────────── */
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 15px; border-radius: var(--r-sm); margin-bottom: 18px;
  font-size: 14px; border: 1px solid transparent; line-height: 1.45;
}
.alert::before { content: ""; width: 4px; align-self: stretch; border-radius: 4px; flex: none; margin: -1px 3px -1px -3px; }
.alert.ok { background: var(--ok-bg); color: #14562a; border-color: var(--ok-line); }
.alert.ok::before { background: var(--ok); }
.alert.warn { background: var(--warn-bg); color: #8a4a08; border-color: var(--warn-line); }
.alert.warn::before { background: var(--warn); }
.alert.err { background: var(--danger-bg); color: #8f1a17; border-color: var(--danger-line); }
.alert.err::before { background: var(--danger); }
.alert.info { background: var(--info-bg); color: #2b2e7d; border-color: var(--info-line); }
.alert.info::before { background: var(--info); }

/* ── Badges de classificação ────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 11px; border-radius: var(--r-pill); font-size: 12px; font-weight: 600;
  white-space: nowrap; font-family: var(--font-ui); border: 1px solid transparent;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; }
.badge.APTO_PRAZO { background: var(--ok-bg); color: #14562a; border-color: var(--ok-line); }
.badge.APTO_PRAZO::before { background: var(--ok); }
.badge.SOMENTE_AVISTA { background: var(--warn-bg); color: #8a4a08; border-color: var(--warn-line); }
.badge.SOMENTE_AVISTA::before { background: var(--warn); }
.badge.RECUSAR { background: var(--danger-bg); color: #8f1a17; border-color: var(--danger-line); }
.badge.RECUSAR::before { background: var(--danger); }
.badge.venc { background: var(--danger-bg); color: #8f1a17; border-color: var(--danger-line); }
.badge.venc::before { background: var(--danger); }
.badge.dir { background: #ede9fe; color: #5b21b6; border-color: #ddd6fe; }
.badge.dir::before { background: #7c3aed; }

/* ── Tabelas ────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
thead th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; background: #fafbfc; border-bottom: 1px solid var(--line); }
tbody tr { transition: background .12s ease; }
tbody tr:hover td { background: #fafbfc; }
tbody tr:last-child td { border-bottom: none; }

.dl { display: grid; grid-template-columns: 180px 1fr; gap: 1px 18px; font-size: 14px; }
.dl dt { color: var(--muted); padding: 6px 0; font-size: 13px; }
.dl dd { margin: 0; padding: 6px 0; font-weight: 500; color: var(--ink); }

.muted { color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, 'SF Mono', 'Cascadia Code', Menlo, monospace; }
hr { border: none; border-top: 1px solid var(--line-soft); margin: 18px 0; }
details summary { cursor: pointer; font-weight: 600; color: var(--brand-700); font-family: var(--font-ui); font-size: 14px; }
details summary:hover { color: var(--brand); }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar .grow { flex: 1; min-width: 200px; }

/* ── Login ──────────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 50% -10%, #fff 0%, var(--bg) 55%);
}
.login-wrap { width: 100%; max-width: 390px; }
.login-head { text-align: center; margin-bottom: 22px; }
.login-head .brand-mark { width: 52px; height: 52px; font-size: 19px; border-radius: 13px; margin: 0 auto 16px; }
.login-head h1 { font-size: 22px; }
.login-head .sub { margin: 4px 0 0; }
.login-wrap .card { box-shadow: var(--shadow-md); padding: 26px; }

/* ── Rodapé / créditos ──────────────────────────────────────────────────── */
.rodape {
  text-align: center; color: var(--faint); font-size: 12.5px; padding: 34px 20px 40px;
  border-top: 1px solid var(--line-soft); margin-top: 10px;
}
.rodape .cred { color: var(--muted); font-weight: 500; }
.rodape .sep { margin: 0 8px; opacity: .5; }

/* ── Cabeçalho de página ─────────────────────────────────────────────────── */
.page-head { display: flex; align-items: flex-start; gap: 15px; margin-bottom: 24px; }
.page-head .ph-icon {
  width: 44px; height: 44px; border-radius: 12px; flex: none; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--brand) 0%, var(--brand-600) 100%); color: #fff;
  box-shadow: 0 4px 12px rgba(232,97,29,.28);
}
.page-head .ph-icon.blue { background: linear-gradient(145deg, var(--blue) 0%, var(--blue-600) 100%); box-shadow: 0 4px 12px rgba(34,56,159,.25); }
.page-head .ph-icon svg { width: 22px; height: 22px; }
.page-head h1 { margin: 0; }
.page-head .sub { margin: 3px 0 0; }
.page-head .ph-actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }

/* ── Stat tiles com ícone ────────────────────────────────────────────────── */
.stat .stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.stat-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; }
.stat-icon svg { width: 19px; height: 19px; }
.stat-icon.brand { background: var(--brand-50); color: var(--brand); }
.stat-icon.blue { background: var(--blue-50); color: var(--blue); }
.stat-icon.ok { background: var(--ok-bg); color: var(--ok); }
.stat-icon.warn { background: var(--warn-bg); color: var(--warn); }
.stat-icon.danger { background: var(--danger-bg); color: var(--danger); }
.stat .n { font-size: 30px; }
.stat .chip { font-size: 11px; font-weight: 600; color: var(--muted); background: var(--line-soft); padding: 3px 9px; border-radius: var(--r-pill); font-family: var(--font-ui); }

/* ── Cabeçalho de card com ícone ─────────────────────────────────────────── */
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.card-head .ch-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--line-soft); color: var(--muted); flex: none; }
.card-head .ch-ico svg { width: 16px; height: 16px; }
.card-head h2 { margin: 0; }
.card-head .ch-meta { margin-left: auto; font-size: 12px; color: var(--muted); }

/* ── Barra de distribuição ───────────────────────────────────────────────── */
.bar { display: flex; height: 12px; border-radius: var(--r-pill); overflow: hidden; background: var(--line-soft); margin: 4px 0 16px; }
.bar .seg { transition: width .4s ease; }
.bar .seg.APTO_PRAZO { background: #22a55a; }
.bar .seg.SOMENTE_AVISTA { background: #e0a316; }
.bar .seg.RECUSAR { background: #dc5148; }
.legend { display: flex; flex-wrap: wrap; gap: 16px; }
.legend .li { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.legend .dot { width: 10px; height: 10px; border-radius: 50%; }
.legend .li b { font-family: var(--font-ui); font-size: 14px; color: var(--ink); }
.legend .APTO_PRAZO .dot { background: #22a55a; } .legend .SOMENTE_AVISTA .dot { background: #e0a316; } .legend .RECUSAR .dot { background: #dc5148; }

/* ── Ações rápidas ───────────────────────────────────────────────────────── */
.quick { display: grid; gap: 12px; }
.quick a {
  display: flex; align-items: center; gap: 13px; padding: 14px 16px; border-radius: var(--r);
  border: 1px solid var(--line); background: #fff; transition: border-color .15s, box-shadow .15s, transform .1s;
}
.quick a:hover { text-decoration: none; border-color: var(--brand-100); box-shadow: var(--shadow); transform: translateY(-1px); }
.quick .q-ico { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); flex: none; }
.quick .q-ico.blue { background: var(--blue-50); color: var(--blue); }
.quick .q-ico svg { width: 20px; height: 20px; }
.quick .q-txt b { display: block; font-family: var(--font-ui); font-weight: 600; color: var(--ink); font-size: 14.5px; }
.quick .q-txt span { font-size: 12.5px; color: var(--muted); }
.quick .q-arrow { margin-left: auto; color: var(--faint); }

/* ── Estado vazio ────────────────────────────────────────────────────────── */
.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty svg { width: 40px; height: 40px; color: var(--faint); margin-bottom: 12px; }
.empty p { margin: 0 0 4px; }

/* ── Acessibilidade / movimento ─────────────────────────────────────────── */
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

@media (max-width: 640px) {
  .topbar { gap: 14px; padding: 0 16px; height: 56px; }
  .brand-name span { display: none; }
  .menu { gap: 0; overflow-x: auto; }
  .menu a { padding: 8px 9px; font-size: 13px; }
  .menu a span.lbl { display: none; }
  .user-name { display: none; }
  .container { margin: 20px auto; padding: 0 16px; }
}
