:root{
  --bg:#f6f8ff;
  --card:#ffffff;
  --text:#0f172a;
  --muted:#475569;
  --line:#e2e8f0;

  --btn:#2563eb;      /* azul */
  --btnText:#ffffff;

  --btn2:#0f172a;     /* quase preto */
  --btn2Text:#ffffff;

  --danger:#ef4444;   /* vermelho */
  --dangerText:#ffffff;

  --ok:#16a34a;       /* verde */
  --okBg: rgba(22,163,74,0.10);

  --out:#ef4444;
  --outBg: rgba(239,68,68,0.10);

  --shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

*{ box-sizing:border-box; }

body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial;
  background: linear-gradient(180deg, #ffffff, var(--bg));
  color: var(--text);
}

.container{
  width:min(1000px, 92vw);
  margin: 0 auto;
  padding: 18px 0;
}

.topbar{
  position: sticky;
  top:0;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.brand{
  font-weight:800;
  letter-spacing:0.2px;
}

.nav{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

.card{
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.grid{
  display:grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap:16px;
}
@media (max-width: 860px){
  .grid{ grid-template-columns: 1fr; }
}

h1,h2{ margin: 0 0 10px; }
.muted{ color: var(--muted); }

.form{ display:flex; flex-direction:column; gap:12px; }

label{
  display:flex;
  flex-direction:column;
  gap:6px;
  color: var(--muted);
  font-size: 14px;
}

input, select{
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  outline: none;
}

input:focus, select:focus{
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.row{
  display:flex;
  gap:12px;
  align-items:end;
  flex-wrap:wrap;
}
.row > *{
  flex:1;
  min-width: 180px;
}

.btn{
  appearance:none;
  border:0;
  cursor:pointer;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--btn);
  color: var(--btnText);
  font-weight: 800;
  text-decoration:none;
  display:inline-flex;
  justify-content:center;
  align-items:center;
  gap:8px;
  box-shadow: 0 8px 18px rgba(37,99,235,0.18);
}

.btn:hover{ filter: brightness(1.03); }

.btn-secondary{
  background: var(--btn2);
  color: var(--btn2Text);
  box-shadow: 0 8px 18px rgba(15,23,42,0.14);
}

.btn-ghost{
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  box-shadow: none;
}

.btn-danger{
  background: var(--danger);
  color: var(--dangerText);
  box-shadow: 0 8px 18px rgba(239,68,68,0.16);
}

.alert{
  border: 1px solid rgba(239,68,68,0.25);
  background: rgba(239,68,68,0.08);
  padding: 12px 14px;
  border-radius: 14px;
}

.alert ul{ margin:0; padding-left: 18px; }

.kpis{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 14px;
}
@media (max-width: 520px){
  .kpis{ grid-template-columns: 1fr; }
}

.kpi{
  border:1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: #fbfdff;
}

.value{
  font-size: 18px;
  font-weight: 900;
  margin-top: 4px;
}

.table-wrap{
  overflow:auto;
  border-radius: 14px;
  border:1px solid var(--line);
}

table{
  width:100%;
  border-collapse:collapse;
  min-width: 650px;
  background: #ffffff;
}

th, td{
  padding: 12px;
  border-bottom:1px solid var(--line);
}

th{
  text-align:left;
  color: var(--muted);
  font-weight: 800;
  background: #f8fafc;
}

tr:hover td{
  background: #fbfdff;
}

.right{ text-align:right; }

.badge{
  display:inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  border: 1px solid var(--line);
}

.badge.in{
  background: var(--okBg);
  color: var(--ok);
}

.badge.out{
  background: var(--outBg);
  color: var(--out);
}
/* Responsive helpers */
.small{ font-size: 13px; }
.big{ font-size: 26px; font-weight: 900; }
.hide-sm{ display: inline; }
.hide-md{ display:block; }
@media (max-width: 720px){
  .hide-sm{ display:none; }
  .hide-md{ display:none; }
}

.left{ display:flex; align-items:center; gap:10px; }
.right{ display:flex; align-items:center; gap:10px; }

.icon-btn{
  appearance:none;
  border:1px solid var(--line);
  background:#fff;
  border-radius: 12px;
  padding: 10px 12px;
  cursor:pointer;
}

.icon-btn:hover{ background:#f8fafc; }

.card-title-row{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
}

.card-soft{
  border: 1px solid var(--line);
  background: #fbfdff;
  border-radius: 16px;
  padding: 12px;
  margin-top: 12px;
}

/* Filters layout */
.filters-row{
  display:grid;
  grid-template-columns: 1fr 1fr 2fr auto;
  gap: 12px;
  align-items:end;
}
@media (max-width: 860px){
  .filters-row{
    grid-template-columns: 1fr 1fr;
  }
}

/* Caixa box */
.cash-box .row{ align-items:center; }
.cash-box .muted{ flex: 2; min-width: 220px; }

/* Note */
.note{
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border:1px solid var(--line);
  background:#ffffff;
}

/* Disabled button look */
.btn.disabled{
  opacity: .45;
  pointer-events: none;
}

/* Pagination */
.pagination{
  display:flex;
  justify-content:center;
  align-items:center;
  gap:12px;
  margin-top: 14px;
}

/* Drawer */
.drawer-backdrop{
  position: fixed; inset:0;
  background: rgba(15,23,42,0.35);
  z-index: 40;
}

.drawer{
  position: fixed;
  top:0; left:0;
  width: 300px;
  height: 100%;
  background: #fff;
  border-right: 1px solid var(--line);
  box-shadow: var(--shadow);
  transform: translateX(-105%);
  transition: transform .18s ease;
  z-index: 41;
  padding: 14px;
}

.drawer.open{ transform: translateX(0); }

.drawer-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.drawer-nav{
  display:flex;
  flex-direction:column;
  gap: 10px;
  padding-top: 12px;
}
.drawer-nav a{
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  text-decoration:none;
  color: var(--text);
  background:#fbfdff;
}
.drawer-nav a:hover{ background:#f8fafc; }

/* FAB + Modal */
.fab{
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 56px;
  height: 56px;
  border-radius: 999px;
  border: 0;
  background: var(--btn);
  color: #fff;
  font-size: 30px;
  line-height: 0;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 16px 30px rgba(37,99,235,0.25);
  z-index: 30;
}
.fab:hover{ filter: brightness(1.03); }

.modal-backdrop{
  position: fixed; inset:0;
  background: rgba(15,23,42,0.35);
  z-index: 50;
}

.modal{
  position: fixed;
  right: 18px;
  bottom: 90px;
  width: min(560px, calc(100vw - 36px));
  background:#fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 14px;
  z-index: 51;

  transform: translateY(16px);
  opacity: 0;
  pointer-events: none;
  transition: all .18s ease;
}

.modal.open{
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.modal-header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}

.modal-title{ font-size: 18px; font-weight: 900; }