:root {
  --green: #1f8a3b;
  --green-d: #146128;
  --green-l: #e8f5ec;
  --ink: #1f2430;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f4f6f8;
  --card: #ffffff;
  --danger: #dc2626;
  --shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 1px 2px rgba(0, 0, 0, .04);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
}
button { font: inherit; cursor: pointer; }
input, select { font: inherit; }
.hidden { display: none !important; }

/* ---------- Auth ---------- */
.auth-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: linear-gradient(135deg, var(--green) 0%, var(--green-d) 100%);
}
.auth-card {
  background: var(--card); border-radius: 16px; box-shadow: var(--shadow);
  padding: 32px; width: 100%; max-width: 380px; text-align: center;
}
.auth-card img { width: 150px; margin-bottom: 8px; }
.auth-card h1 { font-size: 18px; margin: 4px 0 2px; }
.auth-card p.sub { color: var(--muted); margin: 0 0 20px; font-size: 13px; }
.field { text-align: left; margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.field input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 8px; outline: none;
}
.field input:focus { border-color: var(--green); }
.btn {
  background: var(--green); color: #fff; border: none; border-radius: 8px;
  padding: 11px 16px; width: 100%; font-weight: 600;
  transition: background .18s ease, transform .12s ease, box-shadow .18s ease;
}
.btn:hover { background: var(--green-d); transform: translateY(-1px); box-shadow: 0 4px 10px rgba(0,0,0,.12); }
.btn:active { transform: translateY(0); box-shadow: none; }
.btn.sm { width: auto; padding: 7px 12px; font-weight: 500; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--bg); }
.btn.danger { background: var(--danger); }
.msg { font-size: 13px; margin-top: 12px; min-height: 18px; }
.msg.err { color: var(--danger); }
.msg.ok { color: var(--green); }
.link { color: var(--green); cursor: pointer; text-decoration: underline; font-size: 13px; }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.sidebar { background: var(--card); border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.sidebar .brand { padding: 18px 16px; border-bottom: 1px solid var(--line); text-align: center; }
.sidebar .brand img { width: 130px; }
.nav { padding: 10px; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px;
  color: var(--ink); text-decoration: none; margin-bottom: 2px; font-weight: 500;
  transition: background .18s ease, transform .12s ease, padding-left .12s ease;
}
.nav a:hover { background: var(--bg); transform: translateX(2px); padding-left: 14px; }
.nav a.active { background: var(--green-l); color: var(--green-d); }
.nav a .ic { width: 18px; text-align: center; }
.sidebar .foot { padding: 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }

.main { padding: 22px 26px; overflow: auto; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 20px; }

/* cards / grid */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; box-shadow: var(--shadow); }
.card .k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.card .v { font-size: 24px; font-weight: 700; margin-top: 6px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px; box-shadow: var(--shadow); margin-bottom: 18px; }
.panel h3 { margin: 0 0 12px; font-size: 15px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } .app { grid-template-columns: 1fr; } .sidebar { display: none; } }

/* table */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }
tbody tr:hover { background: var(--bg); }
.right { text-align: right; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; color: #fff; font-weight: 600; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; background: var(--bg); border: 1px solid var(--line); }
.pill.pix { background: #e0f2fe; border-color: #bae6fd; color: #0369a1; }
.pill.boleto { background: #fef3c7; border-color: #fde68a; color: #92400e; }

/* filters */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.filters .f { display: flex; flex-direction: column; gap: 3px; }
.filters label { font-size: 11px; color: var(--muted); }
.filters input, .filters select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }

/* calendar */
.month-block { margin-bottom: 14px; }
.month-head {
  display: flex; justify-content: space-between; align-items: center; cursor: pointer;
  background: var(--green-l); color: var(--green-d); padding: 12px 14px; border-radius: 10px; font-weight: 600;
}
.day-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.day-row:hover { background: var(--bg); }
.days { border: 1px solid var(--line); border-top: none; border-radius: 0 0 10px 10px; }

select.classsel { padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; max-width: 180px; }

/* modal */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: grid; place-items: center; z-index: 50; }
.modal { background: #fff; border-radius: 12px; padding: 22px; width: 100%; max-width: 440px; box-shadow: var(--shadow); }
.modal h3 { margin: 0 0 16px; }
.modal .row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.dropzone { border: 2px dashed var(--green); border-radius: 12px; padding: 40px; text-align: center; color: var(--muted); background: var(--green-l); }
.dropzone.drag { background: #d8efdf; }
.empty { color: var(--muted); text-align: center; padding: 30px; }
.classlist .ci { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.swatch { width: 16px; height: 16px; border-radius: 4px; flex-shrink: 0; }
.spacer { flex: 1; }
