:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --ink: #1c2530;
  --muted: #6b7684;
  --line: #e3e8ee;
  --accent: #0d7a5f;
  --accent-ink: #ffffff;
  --accent-soft: #e6f4ef;
  --ok: #137333;
  --pend: #b06000;
  --err: #b00020;
  --sched: #1a56db;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(20,30,45,.08), 0 8px 24px rgba(20,30,45,.06);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
.hidden { display: none !important; }
.brand { font-weight: 600; font-size: 17px; display: flex; align-items: center; gap: 9px; }
.dot { width: 11px; height: 11px; border-radius: 50%; background: var(--accent); display: inline-block; flex-shrink: 0; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; }
.login .sub { margin: -6px 0 4px; color: var(--muted); font-size: 13px; }

/* shell: sidebar + main */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex-shrink: 0; background: var(--card); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 6px; padding: 18px 14px;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { padding: 4px 8px 14px; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 8px;
  color: #45505f; text-decoration: none; font-size: 14px; font-weight: 500;
}
.nav a:hover { background: var(--bg); }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.nav a svg { flex-shrink: 0; }
.nav a.soon { color: #aab3bd; cursor: default; }
.nav a.soon em { margin-left: auto; font-size: 10px; font-style: normal; background: #eef1f4; color: #8b95a1; padding: 1px 7px; border-radius: 10px; }
.side-foot { border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.side-foot .who { color: var(--muted); font-size: 12px; padding: 0 4px; word-break: break-all; }

.main-area { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { padding: 16px 26px; border-bottom: 1px solid var(--line); background: var(--card); position: sticky; top: 0; z-index: 5; }
.topbar h1 { margin: 0; font-size: 19px; font-weight: 600; }
.content { max-width: 1000px; width: 100%; margin: 22px auto; padding: 0 24px; display: flex; flex-direction: column; gap: 20px; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.stat-n { font-size: 30px; font-weight: 600; line-height: 1.1; }
.stat-n.pend { color: var(--pend); }
.stat-l { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; }
.card h2 { margin: 0 0 16px; font-size: 16px; }
.row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; }
.row h2 { margin: 0; }
.count { color: var(--muted); font-weight: 400; font-size: 13px; }
.tools { display: inline-flex; gap: 8px; align-items: center; }

/* form */
form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: #3a4552; }
form label small { font-weight: 400; color: var(--muted); }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid .wide { grid-column: 1 / -1; }
.actions { flex-direction: row !important; align-items: center; gap: 14px; }
.chk { flex-direction: row; display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; color: var(--ink); }
.chk input { width: auto; margin: 0; }

input, textarea, select {
  font: inherit; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
  background: #fbfcfd; color: var(--ink); width: 100%;
}
select { width: auto; cursor: pointer; padding: 8px 10px; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px #0d7a5f22; }
input[type=file] { padding: 8px; cursor: pointer; }
textarea { resize: vertical; }

.pw { position: relative; display: flex; }
.pw input { padding-right: 78px; }
.eye {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; color: var(--accent); font: inherit; font-size: 12px;
  font-weight: 600; cursor: pointer; padding: 4px 8px;
}

button { cursor: pointer; }
.primary { border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 600; padding: 10px 20px; border-radius: 8px; font-size: 14px; }
.primary:hover { filter: brightness(1.06); }
.primary:disabled { opacity: .55; cursor: default; }
.ghost { border: 1px solid var(--line); background: var(--card); color: var(--ink); padding: 7px 14px; border-radius: 8px; font-size: 13px; font-weight: 500; text-decoration: none; display: inline-block; }
.ghost:hover { border-color: var(--muted); }

.msg { font-size: 13px; }
.msg.ok { color: var(--ok); font-weight: 600; }
.msg.err { color: var(--err); }
.empty { color: var(--muted); }

/* tabela — largura fixa por %, sem estourar o card (sem scroll lateral) */
table { border-collapse: collapse; width: 100%; table-layout: fixed; font-size: 13.5px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 600; }
/* colunas: Fornecedor | Valor | Vcto | Status | E1 | Itaú | Pagto | Quitar */
th:nth-child(1), td:nth-child(1) { width: 28%; white-space: normal; }
th:nth-child(2), td:nth-child(2) { width: 12%; }
th:nth-child(3), td:nth-child(3) { width: 11%; }
th:nth-child(4), td:nth-child(4) { width: 13%; }
.et-col { width: 9%; text-align: center; }
.et-check { width: 18px; height: 18px; margin: 0; accent-color: var(--ok); cursor: pointer; vertical-align: middle; }
.et-badge { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; font-size: 12px; font-weight: 700; }
.et-badge.ok { background: #e6f4ea; color: var(--ok); }
.et-badge.sched { background: #e7edfb; color: var(--sched); }
.et-badge.wait { background: #eef1f4; color: var(--muted); font-weight: 400; }
.legenda { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; color: var(--muted); font-size: 12px; margin: -6px 0 14px; }
.legenda .et-badge { width: 17px; height: 17px; font-size: 10px; }
.lg-chk { width: 14px; height: 14px; border: 2px solid var(--ok); border-radius: 3px; display: inline-block; }
tbody tr:hover { background: #f9fafb; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.pill.ok { background: #e6f4ea; color: var(--ok); }
.pill.pend { background: #fdf0e1; color: var(--pend); }
.pill.err { background: #fce8ea; color: var(--err); }
.pill.neutral { background: #eef1f4; color: var(--muted); }
.info-dot {
  display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 14px;
  border: 1px solid var(--line); border-radius: 50%; font-size: 10px; color: var(--muted); cursor: help;
}
a.pdf-link { text-decoration: none; }
.duvida-badge { cursor: help; }
/* staging de agrupamento no upload */
.stage-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.stage-head small { color: var(--muted); font-weight: 400; }
.stage-head button { margin-left: auto; }
.stage-cols { display: grid; grid-template-columns: 260px 1fr; gap: 14px; align-items: start; }
.zone { border: 1.5px dashed var(--line); border-radius: 11px; padding: 10px; min-height: 64px; background: var(--bg); display: flex; flex-direction: column; gap: 7px; }
.zone.over, .stage-grupo.over { border-color: var(--accent); background: var(--accent-soft); }
.stage-cols .col-title { font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700; margin: 0 0 8px; }
.stage-grupo { border: 1.5px solid #1a56db; border-radius: 11px; padding: 10px; background: #e7edfb; margin-bottom: 11px; }
.stage-grupo .g-head { display: flex; align-items: center; gap: 8px; }
.stage-grupo .g-head .gt { font-weight: 700; font-size: 12.5px; }
.stage-grupo .g-head .cnt { color: #3452a4; font-size: 11.5px; }
.stage-grupo .g-obs { width: 100%; margin-top: 7px; font-size: 12.5px; padding: 6px 9px; }
.stage-grupo .grid-g { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 7px; margin-top: 7px; }
.stage-card { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; background: var(--card); cursor: grab; font-size: 12.5px; }
.stage-card:active { cursor: grabbing; }
.stage-card.drag { opacity: .4; }
.stage-card .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage-empty { color: var(--muted); font-size: 12px; font-style: italic; }
/* popover de parcelas ligadas na tabela */
.grp-link { border: 0; background: transparent; cursor: pointer; font-size: 13px; padding: 0 2px; }
.grp-pop { position: absolute; z-index: 50; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 10px 12px; font-size: 12.5px; min-width: 240px; max-width: 340px; }
.grp-pop h4 { margin: 0 0 6px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.grp-pop .gi { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-top: 1px solid var(--line); }
.grp-pop .gi span:last-child { color: var(--muted); white-space: nowrap; }

@media (max-width: 680px) { .stage-cols { grid-template-columns: 1fr; } }
@media (max-width: 860px) { .stats { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 680px) {
  .shell { flex-direction: column; }
  .sidebar { width: auto; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
  .sidebar .brand { padding: 4px 8px; }
  .nav { flex-direction: row; flex-wrap: wrap; flex: 1 1 100%; }
  .side-foot { border: 0; padding: 0; flex-direction: row; align-items: center; }
  .grid { grid-template-columns: 1fr; }
  .content { margin: 16px auto; }
}
