/* Design system do painel Reframinas - estilo Asaas.
   Mesmos tokens do Frente de Loja (public/styles.css), para os sistemas terem a mesma cara.
   Para trocar a cor da marca, mude --brand e --brand2. */
:root {
  --blue-50: #eef4ff; --blue-100: #dbe8ff; --blue-200: #bfd5ff; --blue-500: #2864f0; --blue-600: #123fe7; --blue-700: #0f34c5;
  --navy: #102045; --ink: #17213a; --muted: #64708a; --muted-2: #8d98ad;
  --bg: #f5f7fb; --panel: #ffffff; --line: #dce2ec; --line-soft: #edf0f5;
  --success: #079455; --success-soft: #eaf8f1;
  --warn: #b45f00; --warn-soft: #fff5e6;
  --danger: #d92740; --danger-soft: #ffedf0;
  --neutral: #53607a; --neutral-soft: #eef1f6;
  --brand: var(--blue-600); --brand2: var(--blue-500);
  --shadow-sm: 0 1px 2px rgba(16, 32, 69, .04);
  --shadow-md: 0 14px 36px rgba(16, 32, 69, .10);
  --radius-sm: 8px; --radius-md: 12px; --radius-lg: 16px;
  --sidebar-width: 248px; --topbar-height: 66px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; color: var(--navy); letter-spacing: -.01em; }
a { color: var(--brand); }
:focus-visible { outline: 2px solid var(--brand2); outline-offset: 2px; }

/* ---------- estrutura ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--panel); border-right: 1px solid var(--line); padding: 18px 14px; display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; }
.sidebar .logo { padding: 4px 8px 16px; }
.sidebar .logo img { height: 40px; display: block; }
.nav-label { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-2); padding: 12px 10px 4px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm); color: #53607a; font-weight: 600; text-decoration: none; border: 0; background: none; font: inherit; font-weight: 600; cursor: pointer; width: 100%; text-align: left; }
.nav-item svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.nav-item:hover { background: var(--bg); color: var(--navy); }
.nav-item.active { background: var(--blue-50); color: var(--brand); }
.nav-item .count { margin-left: auto; }
.sidebar .foot { margin-top: auto; font-size: 12px; color: var(--muted-2); padding: 10px; border-top: 1px solid var(--line-soft); }
.main { min-width: 0; }
.topbar { height: var(--topbar-height); background: var(--panel); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; padding: 0 28px; position: sticky; top: 0; z-index: 5; }
.topbar h1 { font-size: 18px; font-weight: 700; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .logo-m { display: none; height: 30px; }
.content { padding: 24px 28px 64px; max-width: 1320px; }

/* ---------- componentes ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); }
.card-head h2 { font-size: 15px; font-weight: 700; }
.card-body { padding: 18px; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-2); margin: 0 0 10px; }
.muted { color: var(--muted); } .small { font-size: 12.5px; }

.btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary { background: var(--brand); color: #fff; } .btn-primary:hover { background: var(--blue-700); }
.btn-ghost { background: var(--panel); color: var(--ink); border-color: var(--line); } .btn-ghost:hover { background: var(--bg); }

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.b-success { background: var(--success-soft); color: var(--success); }
.b-warn { background: var(--warn-soft); color: var(--warn); }
.b-danger { background: var(--danger-soft); color: var(--danger); }
.b-neutral { background: var(--neutral-soft); color: var(--neutral); }
.b-info { background: var(--blue-50); color: var(--brand); }

.field { position: relative; }
.field input { width: 100%; height: 38px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0 12px 0 36px; font: inherit; color: var(--ink); background: var(--panel); }
.field input::placeholder { color: var(--muted-2); }
.field input:focus { outline: none; border-color: var(--brand2); box-shadow: 0 0 0 3px var(--blue-100); }
.field svg { position: absolute; left: 11px; top: 11px; width: 16px; height: 16px; stroke: var(--muted-2); fill: none; stroke-width: 2; stroke-linecap: round; }

.alert { display: flex; gap: 12px; border-radius: var(--radius-md); padding: 12px 14px; border: 1px solid var(--line); background: var(--panel); font-size: 13.5px; }
.alert-info { background: var(--blue-50); border-color: var(--blue-200); color: #1b2f6b; }
.alert-success { background: var(--success-soft); border-color: #b5e3cc; color: #05603a; }
.alert-warn { background: var(--warn-soft); border-color: #f6d9a8; color: #7a4100; }
.alert-danger { background: var(--danger-soft); border-color: #f7bcc5; color: #8f1527; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.stat { padding: 16px 18px; display: flex; gap: 14px; align-items: center; }
.stat .ico { width: 42px; height: 42px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; flex: none; background: var(--blue-50); color: var(--brand); }
.stat .ico svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.stat .ico.danger { background: var(--danger-soft); color: var(--danger); } .stat .ico.warn { background: var(--warn-soft); color: var(--warn); }
.stat .ico.neutral { background: var(--neutral-soft); color: var(--neutral); } .stat .ico.success { background: var(--success-soft); color: var(--success); }
.stat b { display: block; font-size: 26px; line-height: 1.1; color: var(--navy); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat span { font-size: 12.5px; color: var(--muted); }

.dropzone { display: flex; align-items: center; gap: 16px; border: 1.5px dashed var(--blue-200); background: var(--blue-50); border-radius: var(--radius-lg); padding: 18px 20px; cursor: pointer; transition: .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--brand2); background: var(--blue-100); }
.dropzone .ico { width: 44px; height: 44px; border-radius: 50%; background: var(--panel); color: var(--brand); display: flex; align-items: center; justify-content: center; flex: none; box-shadow: var(--shadow-sm); }
.dropzone .ico svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dropzone b { display: block; color: var(--navy); font-size: 15px; }
.dropzone span { color: var(--muted); font-size: 13px; }
.dropzone input { display: none; }

.list-item { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; border: 0; background: none; padding: 11px 18px; border-bottom: 1px solid var(--line-soft); font: inherit; cursor: pointer; color: inherit; }
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: #fafbfe; }
.list-item.active { background: var(--blue-50); box-shadow: inset 3px 0 0 var(--brand); }
.list-item .t { flex: 1; min-width: 0; font-weight: 600; font-size: 13.5px; color: var(--navy); }
.list-item .t small { display: block; font-weight: 400; color: var(--muted); font-size: 12.5px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--blue-100); color: var(--brand); font-weight: 700; font-size: 12.5px; display: flex; align-items: center; justify-content: center; flex: none; }
.avatar.lg { width: 48px; height: 48px; font-size: 16px; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.d-ok { background: var(--success); } .d-avencer { background: #f59e0b; } .d-vencido { background: var(--danger); } .d-faltando { background: var(--muted-2); } .d-semdata { background: var(--brand2); }

.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.check { display: block; border: 1px solid var(--line); border-radius: var(--radius-md); padding: 12px 14px; text-decoration: none; color: inherit; background: var(--panel); }
a.check:hover { border-color: var(--brand2); box-shadow: var(--shadow-md); }
.check .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.check b { font-size: 14px; color: var(--navy); }
.check .txt { font-size: 12.5px; color: var(--muted); }
.check.c-vencido { border-color: #f7bcc5; background: #fff8f9; } .check.c-avencer { border-color: #f6d9a8; background: #fffaf2; }
.check.c-faltando { border-style: dashed; background: #fafbfd; }

.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-2); font-weight: 700; padding: 10px 12px; background: #fafbfd; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: #fafbfe; }
.tbl a { font-weight: 600; text-decoration: none; } .tbl a:hover { text-decoration: underline; }
.tbl .num { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- celular ---------- */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { padding: 0 16px; }
  .topbar .logo-m { display: block; }
  .topbar h1 { font-size: 15px; }
  .topbar .hide-m { display: none; }
  .content { padding: 16px 16px 48px; }
}

/* ---------- formularios ---------- */
.label { display: block; font-size: 13px; font-weight: 600; color: var(--navy); margin-bottom: 6px; }
.input { width: 100%; height: 46px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0 14px; font: inherit; font-size: 16px; color: var(--ink); background: var(--panel); }
.input::placeholder { color: var(--muted-2); }
.input:focus { outline: none; border-color: var(--brand2); box-shadow: 0 0 0 3px var(--blue-100); }
.form-row + .form-row { margin-top: 16px; }
.btn-block { width: 100%; justify-content: center; height: 46px; font-size: 15px; }
.btn-icon { width: 38px; padding: 0; justify-content: center; }

/* ---------- tela de entrada ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--panel); }
.auth-brand { background: linear-gradient(155deg, var(--navy) 0%, #0f2f8f 55%, var(--blue-600) 100%); color: #fff; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-brand::after { content: ""; position: absolute; right: -140px; bottom: -140px; width: 420px; height: 420px; border-radius: 50%; border: 60px solid rgba(255, 255, 255, .06); }
.auth-brand img { height: 52px; align-self: flex-start; }
.auth-brand h1 { color: #fff; font-size: 34px; line-height: 1.15; letter-spacing: -.02em; max-width: 440px; }
.auth-brand p { color: #c9d6f7; font-size: 15px; max-width: 420px; margin: 14px 0 0; }
.auth-points { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 12px; position: relative; z-index: 1; }
.auth-points li { display: flex; gap: 10px; align-items: center; color: #e6edff; font-size: 14px; }
.auth-points li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #7fb0ff; flex: none; }
.auth-brand small { color: #9fb3e6; font-size: 12.5px; position: relative; z-index: 1; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--bg); }
.auth-card { width: 100%; max-width: 400px; padding: 32px; }
.auth-card h2 { font-size: 22px; }
.auth-card .sub { color: var(--muted); margin: 6px 0 24px; }
.auth-card .logo-m { display: none; height: 40px; margin-bottom: 22px; }
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-form { padding: 24px 16px; align-items: flex-start; padding-top: 12vh; }
  .auth-card { padding: 24px 20px; }
  .auth-card .logo-m { display: block; }
}

/* ---------- navegacao inferior (celular) ---------- */
.bottom-nav { display: none; }
.back { display: none; }

@media (max-width: 900px) {
  body { font-size: 15px; }
  .topbar { height: 58px; padding: 0 14px; gap: 10px; }
  .topbar .logo-m { height: 28px; }
  .content { padding: 14px 14px calc(92px + env(safe-area-inset-bottom)); }
  .btn { height: 44px; }
  .bottom-nav { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--panel); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -6px 20px rgba(16, 32, 69, .06); }
  .bottom-nav a, .bottom-nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 60px; border: 0; background: none; font: inherit; font-size: 11.5px; font-weight: 600; color: var(--muted); text-decoration: none; cursor: pointer; position: relative; }
  .bottom-nav svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
  .bottom-nav .active { color: var(--brand); }
  .bottom-nav .primary span.fab { width: 44px; height: 44px; border-radius: 50%; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; margin-top: -18px; box-shadow: 0 8px 18px rgba(18, 63, 231, .35); }
  .bottom-nav .pip { position: absolute; top: 9px; left: calc(50% + 8px); min-width: 17px; height: 17px; border-radius: 999px; background: #f59e0b; color: #fff; font-size: 10.5px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
  .bottom-nav .pip:empty, .bottom-nav .pip[data-n="0"] { display: none; }

  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 12px; gap: 10px; }
  .stat .ico { width: 36px; height: 36px; border-radius: 10px; }
  .stat b { font-size: 22px; }
  .stat span { font-size: 12px; line-height: 1.25; display: block; }
  .dropzone { padding: 14px; gap: 12px; }
  .dropzone b { font-size: 14.5px; }
  .list-item { padding: 13px 16px; min-height: 62px; }
  .check-grid { grid-template-columns: 1fr; }
  .check { padding: 14px; }
  .back { display: inline-flex; }

  /* tabela vira cartoes empilhados */
  .tbl thead { display: none; }
  .tbl, .tbl tbody { display: block; }
  .tbl tr { display: block; padding: 13px 16px; border-bottom: 1px solid var(--line-soft); }
  .tbl tr:last-child { border-bottom: 0; }
  .tbl td { display: flex; justify-content: space-between; gap: 14px; padding: 3px 0; border: 0; text-align: right; }
  .tbl td::before { content: attr(data-l); color: var(--muted-2); font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; text-align: left; flex: none; padding-top: 2px; }
  .tbl td:first-child { display: block; text-align: left; font-size: 15.5px; margin-bottom: 6px; }
  .tbl td:first-child::before { display: none; }
  .tbl td:empty { display: none; }
  .tbl td { min-width: 0; overflow-wrap: anywhere; }
  .tbl .num { white-space: normal; }
  /* no celular a tabela mostra so o essencial; origem e nome do arquivo ficam para a tela grande */
  .tbl td[data-l="Origem"], .tbl td[data-l="Arquivo"] { display: none; }
  .card, .check, .alert { min-width: 0; }
}

[hidden] { display: none !important; }

/* ---------- cartao de indicador clicavel (filtro) e etiqueta de filtro ---------- */
.stat-btn { font: inherit; color: inherit; text-align: left; width: 100%; cursor: pointer; transition: box-shadow .15s, border-color .15s; }
.stat-btn > span:last-child { display: block; min-width: 0; }
.stat-btn:hover { border-color: var(--blue-200); box-shadow: var(--shadow-md); }
.stat-btn.on { border-color: var(--brand); box-shadow: 0 0 0 3px var(--blue-100); }
.chip { display: inline-flex; align-items: center; gap: 8px; margin: 10px 14px 0; height: 30px; padding: 0 10px 0 12px; border-radius: 999px; border: 1px solid var(--blue-200); background: var(--blue-50); color: var(--brand); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.chip span[aria-hidden] { font-size: 16px; line-height: 1; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
