:root{
  --bg:#f4f7fb;
  --surface:#ffffff;
  --surface-2:#f8fafc;
  --surface-3:#eef2f7;
  --text:#101828;
  --muted:#667085;
  --muted-2:#98a2b3;
  --line:#e4e7ec;

  --primary:#3157d5;
  --primary-strong:#2545b5;
  --primary-soft:#eef2ff;

  --success:#079455;
  --success-soft:#ecfdf3;
  --danger:#d92d20;
  --danger-soft:#fef3f2;
  --warning:#dc6803;
  --warning-soft:#fff6ed;

  --sidebar:#0b1220;
  --sidebar-2:#111b2e;
  --sidebar-text:#e5e7eb;
  --sidebar-muted:#8290a7;

  --shadow-xs:0 1px 2px rgba(16,24,40,.05);
  --shadow-sm:0 2px 8px rgba(16,24,40,.06);
  --shadow-md:0 10px 28px rgba(16,24,40,.08);
  --shadow-lg:0 24px 60px rgba(16,24,40,.15);

  --radius-sm:10px;
  --radius:14px;
  --radius-lg:20px;
  --sidebar-width:274px;
}

*{box-sizing:border-box}

html{scroll-behavior:smooth}

body{
  margin:0;
  font-family:Inter,ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;
  background:var(--bg);
  color:var(--text);
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
}

body.menu-open{overflow:hidden}

a{text-decoration:none;color:inherit}
button,input,select,textarea{font:inherit}
button{touch-action:manipulation}

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

.sidebar{
  width:var(--sidebar-width);
  background:
    radial-gradient(circle at 30% 0%,rgba(49,87,213,.20),transparent 30%),
    linear-gradient(180deg,var(--sidebar),#0a1020 100%);
  color:#fff;
  padding:18px 14px;
  display:flex;
  flex-direction:column;
  position:fixed;
  inset:0 auto 0 0;
  z-index:50;
  border-right:1px solid rgba(255,255,255,.06);
  overflow-y:auto;
}

.brand{
  display:flex;
  gap:12px;
  align-items:center;
  padding:8px 8px 20px;
}

.brand-mark{
  width:44px;
  height:44px;
  min-width:44px;
  border-radius:14px;
  display:grid;
  place-items:center;
  background:linear-gradient(135deg,#5b7cff,var(--primary));
  font-weight:900;
  letter-spacing:-1px;
  box-shadow:0 10px 28px rgba(49,87,213,.28);
}

.brand strong{
  display:block;
  font-size:15px;
  letter-spacing:.1px;
}

.brand small,
.sidebar-footer small{
  display:block;
  color:var(--sidebar-muted);
  margin-top:3px;
  font-size:12px;
}

.sidebar-section-label{
  padding:11px 13px 7px;
  color:#66758d;
  font-size:10px;
  font-weight:800;
  letter-spacing:.12em;
  text-transform:uppercase;
}

.sidebar nav{
  display:grid;
  gap:4px;
}

.sidebar nav a{
  display:flex;
  align-items:center;
  gap:11px;
  padding:11px 12px;
  border-radius:12px;
  color:#b7c0cf;
  font-size:14px;
  font-weight:650;
  transition:.16s ease;
  border:1px solid transparent;
}

.sidebar nav a svg{
  width:19px;
  height:19px;
  flex:0 0 19px;
  stroke:currentColor;
}

.sidebar nav a:hover{
  background:rgba(255,255,255,.055);
  color:#fff;
}

.sidebar nav a.active{
  background:linear-gradient(90deg,rgba(49,87,213,.30),rgba(49,87,213,.13));
  border-color:rgba(116,145,255,.20);
  color:#fff;
  box-shadow:inset 3px 0 0 #6f8cff;
}

.sidebar-footer{
  margin-top:auto;
  padding:16px 11px 5px;
  border-top:1px solid rgba(255,255,255,.08);
}

.sidebar-user{
  display:flex;
  align-items:center;
  gap:10px;
}

.sidebar-avatar{
  width:38px;
  height:38px;
  border-radius:12px;
  display:grid;
  place-items:center;
  background:#1a2943;
  color:#dbe6ff;
  font-weight:800;
}

.sidebar-user-info{
  min-width:0;
  flex:1;
}

.sidebar-user-info span{
  display:block;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  font-size:13px;
  font-weight:700;
}

.sidebar-footer a.logout-link{
  display:flex;
  align-items:center;
  justify-content:center;
  margin-top:12px;
  padding:9px 12px;
  border-radius:10px;
  color:#fda4af;
  font-size:13px;
  font-weight:700;
  background:rgba(217,45,32,.08);
}

.sidebar-overlay{
  display:none;
  position:fixed;
  inset:0;
  background:rgba(15,23,42,.48);
  backdrop-filter:blur(2px);
  z-index:40;
}

.main{
  margin-left:var(--sidebar-width);
  width:calc(100% - var(--sidebar-width));
  padding:0 30px 48px;
}

.topbar{
  position:sticky;
  top:0;
  z-index:30;
  min-height:84px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
  margin:0 -30px 24px;
  padding:16px 30px;
  background:rgba(244,247,251,.88);
  backdrop-filter:blur(14px);
  border-bottom:1px solid rgba(228,231,236,.85);
}

.topbar-left{
  display:flex;
  align-items:center;
  gap:13px;
  min-width:0;
}

.topbar-copy{
  min-width:0;
}

.topbar h1{
  margin:0;
  font-size:24px;
  line-height:1.2;
  letter-spacing:-.025em;
}

.topbar p{
  margin:4px 0 0;
  color:var(--muted);
  font-size:13px;
}

.topbar-actions{
  display:flex;
  align-items:center;
  gap:10px;
}

.topbar-pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  min-height:38px;
  padding:8px 12px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.82);
  border-radius:12px;
  color:#475467;
  font-size:12px;
  font-weight:700;
  box-shadow:var(--shadow-xs);
}

.status-dot{
  width:8px;
  height:8px;
  border-radius:999px;
  background:var(--success);
  box-shadow:0 0 0 4px rgba(7,148,85,.10);
}

.menu-button{
  display:none;
  width:42px;
  height:42px;
  border:1px solid var(--line);
  background:#fff;
  border-radius:12px;
  box-shadow:var(--shadow-xs);
  cursor:pointer;
  font-size:20px;
  align-items:center;
  justify-content:center;
}

.grid{
  display:grid;
  gap:18px;
}

.grid.cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}
.grid.cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}
.grid.cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}

.card{
  background:var(--surface);
  border:1px solid rgba(228,231,236,.95);
  border-radius:var(--radius-lg);
  padding:20px;
  box-shadow:var(--shadow-sm);
}

.card:hover{
  box-shadow:0 8px 24px rgba(16,24,40,.07);
}

.card h2{
  margin:0 0 16px;
  font-size:17px;
  letter-spacing:-.01em;
}

.card h3{
  margin-top:0;
}

.metric{
  position:relative;
  overflow:hidden;
  min-height:126px;
}

.metric::after{
  content:"";
  position:absolute;
  width:90px;
  height:90px;
  right:-32px;
  top:-35px;
  border-radius:50%;
  background:rgba(49,87,213,.05);
}

.metric small{
  color:var(--muted);
  display:block;
  font-size:12px;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:.04em;
}

.metric strong{
  font-size:27px;
  line-height:1.15;
  display:block;
  margin-top:12px;
  letter-spacing:-.035em;
}

.metric.danger strong{color:var(--danger)}
.metric.success strong{color:var(--success)}

.section-title{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:14px;
  margin-bottom:16px;
}

.section-title h2{margin:0}

.table-wrap{
  overflow:auto;
  border:1px solid var(--line);
  border-radius:14px;
}

.table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  background:#fff;
}

.table th,
.table td{
  text-align:left;
  padding:13px 14px;
  border-bottom:1px solid var(--line);
  white-space:nowrap;
  font-size:13px;
  vertical-align:middle;
}

.table th{
  color:#475467;
  font-size:11px;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:.04em;
  background:#f8fafc;
  position:sticky;
  top:0;
  z-index:1;
}

.table tbody tr:last-child td{border-bottom:0}
.table tbody tr:hover td{background:#fbfcfe}

.badge{
  display:inline-flex;
  align-items:center;
  padding:6px 9px;
  border-radius:999px;
  font-size:11px;
  font-weight:800;
  background:var(--primary-soft);
  color:#3448b7;
}

.badge.pendente{background:var(--warning-soft);color:#b54708}
.badge.pago,.badge.recebido{background:var(--success-soft);color:#027a48}
.badge.atrasado,.badge.atrasada{background:var(--danger-soft);color:#b42318}
.badge.parcial{background:#eff8ff;color:#175cd3}

.form-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:16px;
}

.field{
  display:grid;
  gap:7px;
}

.field.full{grid-column:1/-1}

.field label{
  font-size:12px;
  color:#344054;
  font-weight:750;
}

.field input,
.field select,
.field textarea{
  width:100%;
  min-height:44px;
  border:1px solid #d0d5dd;
  border-radius:12px;
  padding:10px 12px;
  background:#fff;
  color:var(--text);
  outline:none;
  box-shadow:var(--shadow-xs);
  transition:.15s ease;
}

.field textarea{min-height:96px;resize:vertical}

.field input:focus,
.field select:focus,
.field textarea:focus{
  border-color:#6f8cff;
  box-shadow:0 0 0 4px rgba(49,87,213,.10);
}

.field input::placeholder,
.field textarea::placeholder{color:#98a2b3}

.button{
  min-height:42px;
  border:0;
  border-radius:11px;
  padding:10px 15px;
  background:linear-gradient(180deg,#3f66df,var(--primary));
  color:#fff;
  font-weight:800;
  font-size:13px;
  cursor:pointer;
  box-shadow:0 3px 8px rgba(49,87,213,.18);
  transition:.15s ease;
}

.button:hover{
  transform:translateY(-1px);
  background:linear-gradient(180deg,#365bd0,var(--primary-strong));
}

.button.secondary{
  background:#f2f4f7;
  color:#344054;
  box-shadow:none;
  border:1px solid #eaecf0;
}

.button.secondary:hover{background:#e9edf3}

.button.danger{
  background:var(--danger);
  box-shadow:0 3px 8px rgba(217,45,32,.15);
}

.actions{
  display:flex;
  gap:9px;
  flex-wrap:wrap;
  align-items:center;
}

.alert{
  padding:13px 15px;
  border-radius:12px;
  margin:0 0 18px;
  border:1px solid transparent;
  font-size:13px;
  font-weight:650;
}

.alert.success{
  background:var(--success-soft);
  color:#027a48;
  border-color:#abefc6;
}

.alert.error{
  background:var(--danger-soft);
  color:#b42318;
  border-color:#fecdca;
}

.empty{
  padding:34px;
  text-align:center;
  color:var(--muted);
  background:var(--surface-2);
  border-radius:14px;
  border:1px dashed #d0d5dd;
}

.muted{color:var(--muted)}

code{
  background:#f2f4f7;
  padding:2px 6px;
  border-radius:6px;
  font-size:.92em;
}

/* LOGIN PROFISSIONAL */
.login-page{
  min-height:100vh;
  display:grid;
  place-items:center;
  padding:26px;
  background:
    radial-gradient(circle at 12% 8%,rgba(49,87,213,.18),transparent 27%),
    radial-gradient(circle at 85% 82%,rgba(49,87,213,.10),transparent 25%),
    #eef2f7;
}

.login-shell{
  width:min(1040px,100%);
  min-height:620px;
  display:grid;
  grid-template-columns:1.05fr .95fr;
  background:#fff;
  border:1px solid rgba(255,255,255,.80);
  border-radius:28px;
  overflow:hidden;
  box-shadow:0 35px 100px rgba(15,23,42,.17);
}

.login-visual{
  position:relative;
  padding:44px;
  color:#fff;
  background:
    linear-gradient(145deg,rgba(49,87,213,.92),rgba(16,37,86,.98)),
    #1d3f99;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  overflow:hidden;
}

.login-visual::before,
.login-visual::after{
  content:"";
  position:absolute;
  border-radius:50%;
  border:1px solid rgba(255,255,255,.13);
}

.login-visual::before{
  width:420px;
  height:420px;
  right:-150px;
  top:-120px;
}

.login-visual::after{
  width:270px;
  height:270px;
  left:-120px;
  bottom:-90px;
}

.login-brand{
  position:relative;
  z-index:1;
  display:flex;
  align-items:center;
  gap:12px;
}

.login-brand .brand-mark{
  background:rgba(255,255,255,.15);
  border:1px solid rgba(255,255,255,.18);
  box-shadow:none;
}

.login-brand strong{font-size:16px}
.login-brand small{display:block;color:#c9d5ff;margin-top:3px}

.login-visual-copy{
  position:relative;
  z-index:1;
  max-width:500px;
}

.login-visual-copy h2{
  margin:0;
  max-width:420px;
  font-size:40px;
  line-height:1.08;
  letter-spacing:-.04em;
}

.login-visual-copy p{
  margin:18px 0 0;
  max-width:420px;
  color:#d8e1ff;
  line-height:1.6;
}

.login-features{
  position:relative;
  z-index:1;
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
  margin-top:28px;
}

.login-feature{
  padding:13px 14px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(255,255,255,.07);
  border-radius:14px;
  color:#edf2ff;
  font-size:12px;
  font-weight:700;
}

.login-form-side{
  display:flex;
  align-items:center;
  justify-content:center;
  padding:50px;
  background:#fff;
}

.login-card{
  width:100%;
  max-width:390px;
  background:transparent;
  border:0;
  border-radius:0;
  padding:0;
  box-shadow:none;
}

.login-card .mobile-login-brand{display:none}

.login-card h1{
  margin:0;
  font-size:30px;
  letter-spacing:-.03em;
}

.login-card > p{
  color:var(--muted);
  margin:8px 0 28px;
  line-height:1.5;
}

.login-card .field{margin-top:15px}

.login-card .button{
  width:100%;
  margin-top:20px;
  min-height:48px;
  border-radius:12px;
}

.login-foot{
  margin-top:24px;
  color:#98a2b3;
  text-align:center;
  font-size:11px;
}

/* APP-like mobile */
@media(max-width:1100px){
  .grid.cols-4{grid-template-columns:repeat(2,minmax(0,1fr))}
  .grid.cols-3{grid-template-columns:repeat(2,minmax(0,1fr))}
}

@media(max-width:820px){
  .sidebar{
    transform:translateX(-100%);
    transition:transform .22s ease;
    box-shadow:var(--shadow-lg);
  }

  .sidebar.open{transform:translateX(0)}
  .sidebar-overlay.open{display:block}

  .main{
    margin-left:0;
    width:100%;
    padding:0 16px 34px;
  }

  .topbar{
    margin:0 -16px 18px;
    padding:12px 16px;
    min-height:70px;
  }

  .menu-button{display:inline-flex}

  .topbar-actions .topbar-pill{display:none}

  .grid.cols-4,
  .grid.cols-3,
  .grid.cols-2,
  .form-grid{
    grid-template-columns:1fr;
  }

  .field.full{grid-column:auto}
  .card{padding:17px;border-radius:16px}
  .metric{min-height:108px}
  .metric strong{font-size:25px}

  .section-title{
    align-items:flex-start;
    flex-direction:column;
  }

  .actions{width:100%}
  .actions .button{flex:1 1 auto;text-align:center}

  .table th,.table td{padding:11px 12px}

  .login-page{padding:14px}
  .login-shell{
    display:block;
    min-height:0;
    border-radius:22px;
  }

  .login-visual{display:none}

  .login-form-side{
    padding:28px 22px;
    min-height:560px;
  }

  .login-card .mobile-login-brand{
    display:flex;
    align-items:center;
    gap:11px;
    margin-bottom:34px;
  }

  .login-card .mobile-login-brand .brand-mark{
    color:#fff;
  }
}

@media(max-width:520px){
  .main{padding:0 12px 28px}
  .topbar{margin:0 -12px 16px;padding:11px 12px}
  .topbar h1{font-size:21px}
  .card{padding:15px}
  .grid{gap:12px}
  .metric strong{font-size:23px}
  .button{min-height:44px}
  .table-wrap{margin-left:-2px;margin-right:-2px}

  /* dashboard cards remain 1-per-line for app readability */
  .grid.cols-4,.grid.cols-3{grid-template-columns:1fr}
}
