*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #f1f5f9;
  --white: #ffffff;
  --sidebar: #071B3A;
  --sidebar-hover: #0d2a50;
  --sidebar-active: rgba(201,162,77,.15);
  --gold: #C9A24D;
  --navy: #071B3A;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.05);
  --radius: 10px;
  --sidebar-w: 230px;
}

html { font-size: 14px; }
body { font-family: 'Inter', system-ui, sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; }

/* SHELL */
.app-shell { display: flex; min-height: 100vh; }

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-w); min-height: 100vh; background: var(--sidebar);
  display: flex; flex-direction: column; position: fixed; top: 0; left: 0; z-index: 100;
  border-right: 1px solid rgba(255,255,255,.06);
}
.sidebar-logo {
  padding: 22px 20px 18px; border-bottom: 1px solid rgba(255,255,255,.08);
  font-size: 1.1rem; font-weight: 800; letter-spacing: .02em;
}
.logo-crd { color: #fff; }
.logo-fin { color: var(--gold); }

.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 18px; color: rgba(255,255,255,.62); text-decoration: none;
  font-size: .83rem; font-weight: 500; transition: all .18s;
  border-left: 2px solid transparent;
}
.nav-item:hover { background: var(--sidebar-hover); color: rgba(255,255,255,.9); }
.nav-item.active { background: var(--sidebar-active); color: var(--gold); border-left-color: var(--gold); font-weight: 600; }
.nav-icon { font-size: .95rem; width: 18px; text-align: center; }

.sidebar-footer {
  padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; justify-content: space-between;
}
.sidebar-user { color: rgba(255,255,255,.5); font-size: .75rem; }
.btn-logout {
  background: transparent; border: 1px solid rgba(255,255,255,.18); color: rgba(255,255,255,.5);
  font-size: .72rem; padding: 4px 10px; border-radius: 6px; cursor: pointer; transition: all .18s;
}
.btn-logout:hover { border-color: rgba(255,255,255,.4); color: rgba(255,255,255,.8); }

/* MAIN */
.main-area { margin-left: var(--sidebar-w); flex: 1; min-height: 100vh; }
.page-inner { padding: 28px 32px; max-width: 1400px; }

/* PAGE HEADER */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-title { font-size: 1.35rem; font-weight: 700; color: var(--navy); }
.page-sub { font-size: .82rem; color: var(--muted); margin-top: 2px; }

/* CARDS */
.card {
  background: var(--white); border-radius: var(--radius); border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.card-body { padding: 20px 24px; }
.card-header {
  padding: 16px 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: .95rem; font-weight: 600; color: var(--navy); }

/* STAT CARDS */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card {
  background: var(--white); border-radius: var(--radius); border: 1px solid var(--border);
  box-shadow: var(--shadow); padding: 18px 20px;
}
.stat-label { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 6px; }
.stat-value { font-size: 1.5rem; font-weight: 800; color: var(--navy); line-height: 1; }
.stat-value.green { color: var(--success); }
.stat-value.red { color: var(--danger); }
.stat-value.gold { color: var(--gold); }
.stat-delta { font-size: .75rem; color: var(--muted); margin-top: 4px; }

/* TABLES */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .83rem; }
thead tr { background: #f8fafc; }
th { padding: 10px 14px; text-align: left; font-weight: 600; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid #f1f5f9; color: var(--text); vertical-align: middle; }
tr:hover td { background: #f8fafc; }
tr:last-child td { border-bottom: none; }

/* BADGES */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 50px; font-size: .7rem; font-weight: 600; letter-spacing: .04em; white-space: nowrap;
}
.badge-green  { background: #dcfce7; color: #16a34a; }
.badge-red    { background: #fee2e2; color: #dc2626; }
.badge-yellow { background: #fef9c3; color: #b45309; }
.badge-blue   { background: #dbeafe; color: #1d4ed8; }
.badge-grey   { background: #f1f5f9; color: #64748b; }
.badge-orange { background: #fed7aa; color: #c2410c; }

/* FORMS */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: .78rem; font-weight: 600; color: var(--navy); }
input, select, textarea {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: .85rem; color: var(--text); background: var(--white); outline: none;
  transition: border-color .18s, box-shadow .18s; font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,162,77,.12);
}
textarea { resize: vertical; min-height: 80px; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 6px; }

/* BUTTONS */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 18px; border-radius: 8px; font-size: .83rem; font-weight: 600;
  cursor: pointer; border: none; transition: all .18s; text-decoration: none; font-family: inherit;
}
.btn-primary { background: var(--gold); color: var(--navy); }
.btn-primary:hover { background: #b8912e; }
.btn-secondary { background: var(--white); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #f8fafc; }
.btn-danger { background: #fee2e2; color: var(--danger); border: 1px solid #fecaca; }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-success { background: #dcfce7; color: #16a34a; border: 1px solid #bbf7d0; }
.btn-sm { padding: 5px 12px; font-size: .76rem; }
.btn-icon { padding: 6px 8px; }

/* FILTERS */
.filters-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; align-items: flex-end; }
.filters-row .form-group { min-width: 150px; }
.filters-row label { font-size: .72rem; }
.filters-row input, .filters-row select { font-size: .82rem; padding: 7px 10px; }

/* MODAL */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(7,27,58,.45);
  z-index: 1000; align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--white); border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.2);
  width: 90%; max-width: 680px; max-height: 90vh; overflow-y: auto;
}
.modal-header {
  padding: 18px 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 1rem; font-weight: 700; color: var(--navy); }
.modal-close { background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* NATUREZA COLORS */
.nat-pagar  { color: var(--danger); font-weight: 600; }
.nat-receber { color: var(--success); font-weight: 600; }

/* EMPTY STATE */
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty-state p { font-size: .9rem; }

/* ALERTS */
.alert { padding: 12px 16px; border-radius: 8px; font-size: .85rem; margin-bottom: 16px; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* TABS */
.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--border); margin-bottom: 24px; }
.tab-btn {
  padding: 10px 20px; font-size: .85rem; font-weight: 600; cursor: pointer;
  background: none; border: none; color: var(--muted); border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: all .18s; font-family: inherit;
}
.tab-btn.active { color: var(--navy); border-bottom-color: var(--gold); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* DASHBOARD CHART PLACEHOLDER */
.chart-area { background: var(--bg); border-radius: 8px; height: 180px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: .85rem; }

/* UTILITIES */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-gold { color: var(--gold); }
.font-bold { font-weight: 700; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }
.gap-2 { gap: 16px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* UPLOAD ZONE */
.upload-zone {
  border: 2px dashed var(--border); border-radius: 10px; padding: 32px;
  text-align: center; cursor: pointer; transition: all .18s; color: var(--muted);
}
.upload-zone:hover, .upload-zone.dragover { border-color: var(--gold); background: rgba(201,162,77,.04); }
.upload-zone .upload-icon { font-size: 2rem; margin-bottom: 8px; }

/* CONCILIACAO */
.conc-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.conc-list { max-height: 500px; overflow-y: auto; }
.conc-item {
  padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px;
  margin-bottom: 8px; cursor: pointer; transition: all .18s; background: var(--white);
}
.conc-item:hover { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(201,162,77,.12); }
.conc-item.selected { border-color: var(--gold); background: rgba(201,162,77,.06); }
.conc-item.conciliado { background: #f0fdf4; border-color: #bbf7d0; opacity: .7; }
.conc-val { font-weight: 700; font-size: .95rem; }
.conc-desc { font-size: .78rem; color: var(--muted); margin-top: 2px; }
.conc-date { font-size: .72rem; color: var(--muted); }

/* RESPONSIVO */
@media (max-width: 900px) {
  :root { --sidebar-w: 64px; }
  .nav-label { display: none; }
  .sidebar-logo { padding: 16px 10px; font-size: .7rem; text-align: center; }
  .logo-fin { display: none; }
  .sidebar-user { display: none; }
  .page-inner { padding: 16px; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .conc-row { grid-template-columns: 1fr; }
}
