/* =========================================================
   CrediFiado — STYLE (v4.6.3)
   - Tema escuro com vidro suave
   - Menu lateral fixo
   - Componentes: cards, tabelas, inputs, botões, modal
   - Correções de layout para cliques no conteúdo
   ========================================================= */

/* ---------- Reset/Norma ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
  background: linear-gradient(180deg,#0d2b4a 0%, #0a1f32 100%);
  color: #e8f4ff;
}

/* Links */
a { color: #9ad4ff; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Cores / Tokens ---------- */
:root{
  --bg-deep: #0a1f32;
  --bg-panel: rgba(255,255,255,0.06);
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.12);
  --text: #e8f4ff;
  --text-dim: #cfe6ff;
  --primary: #1b4d7d;
  --primary-2: #2263a3;
  --accent-1: #29b6f6;
  --accent-2: #00c2a8;
  --warn: #ffd666;
  --success: #2ecc71;
  --danger: #ff6b6b;
}

/* ---------- App Shell + Sidebar ---------- */
.app-shell{
  display: flex;
  align-items: flex-start;   /* evita esticar a sidebar sobre o main */
  min-height: 100vh;
  position: relative;
}

.sidebar{
  flex: 0 0 260px;          /* reserva espaço fixo */
  width: 260px;
  background: #0a223a;
  border-right: 1px solid var(--border);
  padding: 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 2;               /* fica acima, mas apenas nessa faixa */
}

.brand{
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.brand-logo{
  width: 36px; height: 36px; border-radius: 10px;
  background: conic-gradient(from 180deg at 50% 50%, var(--accent-1) 0deg, var(--accent-2) 160deg, var(--accent-1) 360deg);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.06) inset;
}
.brand-title{ font-weight: 700; letter-spacing: .2px; line-height: 1.1; }
.brand-sub{ font-size: 12px; opacity: .75; }

.menu{
  display: flex; flex-direction: column; gap: 6px; margin-top: 8px;
}
.menu a[data-route]{
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 12px;
  color: var(--text-dim);
  background: transparent;
  transition: background .15s ease, color .15s ease, transform .05s ease;
}
.menu a[data-route] .ico{ width: 1.2em; display: inline-block; text-align: center; }
.menu a[data-route]:hover{ background: #123a61; color: #fff; transform: translateX(2px); }
.menu a[data-route].active{ background: #1b4d7d; color: #fff; }

.sidebar-bottom{ margin-top: auto; }

/* ---------- Conteúdo ---------- */
.content{
  flex: 1 1 auto;
  position: relative;
  z-index: 1;
  padding: 24px;
}
.container{
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

/* ---------- Tipografia util ---------- */
h1,h2,h3{ margin: 0 0 8px 0; }
p{ margin: 0 0 10px 0; }

/* ---------- Cards ---------- */
.card{
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  backdrop-filter: blur(3px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
}

/* ---------- Grid / Linhas ---------- */
.grid{ display: grid; gap: 12px; }
.row{ display: flex; align-items: center; gap: 8px; }

/* KPIs */
.kpis .card h2{ margin: .35rem 0 0 0; }

/* ---------- Inputs / Form ---------- */
.label{
  font-size: 12px; opacity: .8; margin-bottom: 6px; display: block;
}
.input{
  width: 100%;
  background: #0c2035;
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
}
.input:focus{
  border-color: var(--accent-1);
  box-shadow: 0 0 0 3px rgba(41,182,246,.15);
}

/* Selects e file input */
input[type="file"].input, select.input{
  padding: 8px 10px;
  background: #0c2035;
  color: var(--text);
}

/* ---------- Botões ---------- */
button, .btn{ pointer-events: auto; cursor: pointer; }

.btn{
  background: var(--primary);
  color: #fff;
  border: 0;
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 600;
  transition: background .15s ease, transform .05s ease;
}
.btn:hover{ background: var(--primary-2); }
.btn:active{ transform: translateY(1px); }

.btn-light{
  background: #163a5e; color: #fff;
}
.btn-light:hover{ background: #1e4f82; }

.btn-link{
  color: #9ad4ff;
  background: transparent;
  border: 0;
  padding: 0;
  text-decoration: underline;
}

.btn-logout{
  width: 100%;
  background: #163a5e;
  border: 0;
  color: #fff;
  border-radius: 12px;
  padding: 10px 12px;
}
.btn-logout:hover{ background: #1e4f82; }

/* Botões com ícone à esquerda (se usar <span class="ico">) */
.btn .ico{ margin-right: 6px; width: 1.1em; display: inline-block; text-align: center; }

/* ---------- Tabelas ---------- */
.table{
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table th, .table td{
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.table thead th{
  text-align: left;
  font-weight: 700;
  color: var(--text-dim);
  background: rgba(255,255,255,0.03);
}
.table tbody tr:hover td{
  background: rgba(255,255,255,0.03);
}

/* ---------- Footer ---------- */
.footer{
  opacity: .65;
  margin-top: 18px;
  font-size: 12px;
}

/* ---------- Modal ---------- */
.modal{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}
.modal-body{
  background: #0a223a;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  width: min(520px, 90vw);
  color: var(--text);
}

/* ---------- Badges / Estados ---------- */
.badge{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--border);
}
.badge.ok{ color: #d6ffe4; background: rgba(46,204,113,.15); border-color: rgba(46,204,113,.35); }
.badge.warn{ color: #fff2cc; background: rgba(255,214,102,.15); border-color: rgba(255,214,102,.35); }
.badge.danger{ color: #ffe1e1; background: rgba(255,107,107,.15); border-color: rgba(255,107,107,.35); }

/* ---------- Auth (login) ---------- */
.auth-shell{
  min-height: 100vh;
}
.auth-center{
  display: grid;
  place-items: center;
  padding: 24px;
}

/* ---------- Utilitários ---------- */
.text-dim{ color: var(--text-dim); }
.text-warn{ color: var(--warn); }
.text-success{ color: var(--success); }
.text-danger{ color: var(--danger); }

.mt-0{ margin-top: 0 !important; }
.mt-8{ margin-top: 8px !important; }
.mt-12{ margin-top: 12px !important; }
.mt-16{ margin-top: 16px !important; }
.mt-24{ margin-top: 24px !important; }

.mb-0{ margin-bottom: 0 !important; }
.mb-8{ margin-bottom: 8px !important; }
.mb-12{ margin-bottom: 12px !important; }
.mb-16{ margin-bottom: 16px !important; }
.mb-24{ margin-bottom: 24px !important; }

.w-100{ width: 100% !important; }

/* ---------- Correções de clique / overlay ---------- */
/* (garantem que os botões do conteúdo sejam clicáveis) */
.app-shell { pointer-events: auto; }
.sidebar    { pointer-events: auto; }
.content    { pointer-events: auto; }
.card, .table, .btn, input, select, label { pointer-events: auto; }

/* ---------- Responsivo ---------- */
@media (max-width: 960px){
  .content{ padding: 16px; }
}

@media (max-width: 720px){
  .sidebar{
    flex-basis: 220px;
    width: 220px;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
  }
  .content{
    margin-left: 220px; /* empurra o conteúdo para não ficar sob a sidebar fixa */
    padding: 12px;
  }
  .container{ max-width: 100%; }
}

/* ---------- Scrollbar discreto (WebKit) ---------- */
::-webkit-scrollbar{ width: 10px; height: 10px; }
::-webkit-scrollbar-thumb{
  background: rgba(255,255,255,.12);
  border-radius: 8px;
}
::-webkit-scrollbar-track{
  background: rgba(255,255,255,.04);
}
