:root{
  --bg: #f6f8fc;
  --panel: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --border: rgba(15,23,42,.12);
  --primary: #2563eb;
  --primary-2:#1d4ed8;
  --danger:#dc2626;
  --ok:#16a34a;
  --shadow: 0 10px 30px rgba(2,8,23,.08);
  --radius: 16px;
  --radius-sm: 12px;
  --focus: 0 0 0 4px rgba(37,99,235,.18);
  --font: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

[data-theme="dark"]{
  --bg: #0b1220;
  --panel: #0f172a;
  --text: #e5e7eb;
  --muted: #a7b0c0;
  --border: rgba(226,232,240,.14);
  --primary: #60a5fa;
  --primary-2:#3b82f6;
  --danger:#fb7185;
  --ok:#34d399;
  --shadow: 0 18px 50px rgba(0,0,0,.35);
  --focus: 0 0 0 4px rgba(96,165,250,.20);
}

*{ box-sizing:border-box; }

body{
  margin:0;
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 15% 0%, rgba(37,99,235,.08), transparent 60%),
              radial-gradient(900px 600px at 85% 20%, rgba(14,165,233,.10), transparent 60%),
              var(--bg);
  color: var(--text);
}

/* ---------- shared ---------- */
a{ color:inherit; }
.container{
  max-width: 980px;
  width: min(980px, 92vw);
  margin: 32px auto;
}
.card{
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card.pad{ padding: 22px; }

.grid{
  display:grid;
  gap: 16px;
}
.grid.cols-2{ grid-template-columns: 1.25fr .75fr; }
@media (max-width: 920px){
  .grid.cols-2{ grid-template-columns: 1fr; }
}

h1,h2,h3{ margin:0 0 8px; }
h1{ font-size: 26px; letter-spacing: -.02em; }
h2{ font-size: 20px; }
p{ margin: 8px 0; color: var(--muted); line-height: 1.45; }

.badge{
  display:inline-flex;
  gap:8px;
  align-items:center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(148,163,184,.08);
  font-size: 13px;
  color: var(--muted);
}

.row{
  display:flex;
  gap: 12px;
  align-items:center;
  flex-wrap: wrap;
}

.input, select, input[type="text"], input[type="email"], input[type="date"], input[type="password"], input[type="tel"]{
  width: 100%;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  outline: none;
  transition: box-shadow .18s ease, border-color .18s ease, transform .05s ease;
}

input::placeholder{ color: rgba(100,116,139,.9); }

input:focus, select:focus{
  border-color: rgba(37,99,235,.6);
  box-shadow: var(--focus);
}

label{
  font-weight: 650;
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px;
}

.help{
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

.error{
  margin-top: 6px;
  font-size: 13px;
  color: var(--danger);
}
.success{
  margin-top: 10px;
  font-size: 13px;
  color: var(--ok);
  font-weight: 700;
}

.btn{
  display:inline-flex;
  gap: 10px;
  align-items:center;
  justify-content:center;
  border: 1px solid var(--border);
  background: rgba(148,163,184,.08);
  color: var(--text);
  padding: 11px 14px;
  border-radius: 12px;
  cursor:pointer;
  font-weight: 650;
  transition: transform .06s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease;
  user-select: none;
}
.btn:hover{ background: rgba(148,163,184,.14); }
.btn:active{ transform: scale(.98); }
.btn:disabled{ opacity:.6; cursor:not-allowed; transform:none; }

.btn.primary{
  background: var(--primary);
  border-color: rgba(37,99,235,.0);
  color: #fff;
}
[data-theme="dark"] .btn.primary{ color:#081122; }
.btn.primary:hover{ background: var(--primary-2); }

.btn.danger{
  background: rgba(220,38,38,.12);
  color: var(--danger);
  border-color: rgba(220,38,38,.25);
}
.btn.danger:hover{ background: rgba(220,38,38,.18); }

.btn.link{
  border: none;
  background: none;
  padding: 0;
  color: var(--primary);
}
.btn.link:hover{ text-decoration: underline; }

.sep{
  height:1px;
  background: var(--border);
  margin: 14px 0;
}

/* ---------- logo header ---------- */
.brand{
  display:flex;
  align-items:center;
  gap: 14px;
}
.brand .logos{
  display:flex;
  gap: 10px;
  align-items:center;
}
.brand img{
  width: 64px;
  height: 64px;
  object-fit: contain;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(148,163,184,.06);
  padding: 6px;
}
.brand .title h1{ margin:0; }
.brand .title p{ margin:2px 0 0; }

/* ---------- form layout ---------- */
.form-grid{
  display:grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.form-grid .full{ grid-column: 1 / -1; }
@media (max-width: 720px){
  .form-grid{ grid-template-columns: 1fr; }
}

/* ---------- admin accordion ---------- */
.accordion{
  border-radius: var(--radius);
  overflow:hidden;
  border: 1px solid var(--border);
}
.accordion .head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 14px 16px;
  cursor:pointer;
  background: rgba(148,163,184,.06);
}
.accordion .head strong{ font-size: 14px; }
.accordion .head .chev{
  transition: transform .22s ease;
  opacity:.85;
}
.accordion.open .head .chev{ transform: rotate(180deg); }
.accordion .body{
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  padding: 0 16px;
  transition: max-height .35s ease, opacity .25s ease, padding .2s ease;
}
.accordion.open .body{
  max-height: 1200px;
  opacity: 1;
  padding: 16px;
}

/* ---------- toast ---------- */
.toast-wrap{
  position: fixed;
  right: 16px;
  bottom: 16px;
  display:flex;
  flex-direction:column;
  gap: 10px;
  z-index: 9999;
}
.toast{
  min-width: 260px;
  max-width: 360px;
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 12px 12px;
  display:flex;
  gap: 12px;
  align-items:flex-start;
}
.toast .dot{
  width: 10px; height: 10px; border-radius: 99px;
  background: var(--primary);
  margin-top: 5px;
}
.toast.ok .dot{ background: var(--ok); }
.toast.bad .dot{ background: var(--danger); }
.toast strong{ display:block; font-size: 13px; }
.toast p{ margin: 4px 0 0; font-size: 12px; }
.toast .x{
  margin-left:auto;
  border:none; background:none; cursor:pointer;
  color: var(--muted);
  font-size: 18px; line-height: 1;
}

/* ---------- modal ---------- */
.modal{
  position: fixed;
  inset: 0;
  display:none;
  place-items: center;
  padding: 16px;
  background: rgba(2,8,23,.6);
  z-index: 9998;
}
.modal.open{ display:grid; }
.modal .panel{
  width: min(860px, 96vw);
  max-height: min(84vh, 760px);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.modal .panel .bar{
  position: sticky;
  top: 0;
  background: linear-gradient(to bottom, var(--panel), rgba(255,255,255,0));
  padding: 14px 16px;
  display:flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}
[data-theme="dark"] .modal .panel .bar{
  background: linear-gradient(to bottom, var(--panel), rgba(15,23,42,0));
}
.modal .panel .content{ padding: 16px; }

/* ---------- admin layout ---------- */
.admin-shell{
  height: 100vh;
  display:flex;
  flex-direction: column;
}
.topbar{
  height: 62px;
  display:flex;
  align-items:center;
  justify-content: space-between;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.6);
  backdrop-filter: blur(10px);
}
[data-theme="dark"] .topbar{ background: rgba(15,23,42,.55); }
.topbar .left{
  display:flex;
  align-items:center;
  gap: 12px;
}
.topbar .left strong{ font-size: 14px; }
.topbar .right{
  display:flex;
  gap: 10px;
  align-items:center;
}

.shell{
  flex:1;
  display:flex;
  min-height: 0;
}
.sidebar{
  width: 270px;
  border-right: 1px solid var(--border);
  background: rgba(148,163,184,.05);
  padding: 14px;
  display:flex;
  flex-direction: column;
  gap: 10px;
}
.navbtn{
  display:flex;
  gap: 10px;
  align-items:center;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: transparent;
  cursor:pointer;
  font-weight: 700;
  color: var(--text);
}
.navbtn small{ color: var(--muted); font-weight: 600; }
.navbtn:hover{ background: rgba(148,163,184,.10); }
.navbtn.active{
  background: rgba(37,99,235,.12);
  border-color: rgba(37,99,235,.25);
}

.main{
  flex: 1;
  min-width: 0;
  padding: 18px;
  overflow: auto;
}

.kpis{
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}
@media (max-width: 1020px){
  .kpis{ grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px){
  .kpis{ grid-template-columns: 1fr; }
}
.kpi{
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(148,163,184,.06);
}
.kpi strong{ font-size: 12px; color: var(--muted); display:block; }
.kpi span{ font-size: 22px; font-weight: 800; letter-spacing: -.02em; }

.toolbar{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.toolbar .search{
  width: min(420px, 100%);
}
.toolbar .btns{
  display:flex;
  gap: 10px;
  align-items:center;
  flex-wrap: wrap;
}

.table{
  width: 100%;
  border-collapse: collapse;
  overflow:hidden;
  border-radius: 16px;
  border: 1px solid var(--border);
}
.table th, .table td{
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 13px;
}
.table th{
  font-size: 12px;
  color: var(--muted);
  background: rgba(148,163,184,.07);
}
.table tr:hover td{ background: rgba(148,163,184,.05); }

.pills{
  display:flex;
  gap: 8px;
  flex-wrap: wrap;
}
.pill{
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  background: rgba(148,163,184,.06);
}

.actions{
  display:flex;
  gap: 8px;
  align-items:center;
}
.iconbtn{
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(148,163,184,.06);
  cursor: pointer;
  display:grid;
  place-items:center;
}
.iconbtn:hover{ background: rgba(148,163,184,.12); }
.iconbtn.danger{
  border-color: rgba(220,38,38,.25);
  color: var(--danger);
  background: rgba(220,38,38,.08);
}
.iconbtn.danger:hover{ background: rgba(220,38,38,.14); }

@media (max-width: 880px){
  .sidebar{
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .shell{ flex-direction: column; }
}

/* ---------- avatar (foto do aluno) ---------- */
.avatar{
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(148,163,184,.12);
  display:grid;
  place-items:center;
  font-weight: 800;
  color: var(--muted);
  position: relative;
  overflow:hidden;
}
.avatar .cam{
  font-size: 16px;
  opacity: .9;
}
.avatar img{
  width:100%;
  height:100%;
  object-fit: cover;
  display:block;
}

/* ---------- pagination ---------- */
.pager{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.pager .left, .pager .right{
  display:flex;
  align-items:center;
  gap: 10px;
  flex-wrap: wrap;
}
.pager .meta{
  font-size: 12px;
  color: var(--muted);
}
.pager select{
  width: auto;
  padding: 10px 10px;
}

/* ---------- dashboard extras ---------- */
.dash-grid{
  display:grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 12px;
  margin-top: 12px;
}
@media (max-width: 980px){ .dash-grid{ grid-template-columns: 1fr; } }

.spark{
  height: 46px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(37,99,235,.14), rgba(14,165,233,.10));
  position: relative;
  overflow:hidden;
}
[data-theme="dark"] .spark{
  background: linear-gradient(135deg, rgba(96,165,250,.20), rgba(14,165,233,.12));
}
.spark:before{
  content:"";
  position:absolute;
  inset:-60% -30%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.55), transparent 55%);
  transform: rotate(18deg);
  opacity:.35;
}

/* ---------- mobile responsive (gestão) ---------- */
/* ---------- mobile responsive (gestão) ---------- */
/* Objetivo: dashboard 100% usável no celular (topbar compacta, navegação confortável, tabelas legíveis) */

@media (max-width: 880px){
  /* sidebar vira faixa superior de navegação mais “tocável” */
  .sidebar{
    padding: 10px;
    gap: 8px;
  }
  .navbtn{
    flex: 1 1 auto;
    justify-content: center;
    border: 1px solid var(--border);
    background: rgba(148,163,184,.06);
  }
  .navbtn small{ display:none; }
}

@media (max-width: 720px){
  /* topbar fica mais compacta e quebra em duas linhas quando precisar */
  .topbar{
    height: auto;
    padding: 10px 12px;
    gap: 10px;
    flex-wrap: wrap;
  }
  .topbar .left{
    width: 100%;
    justify-content: space-between;
  }
  .topbar .right{
    width: 100%;
    justify-content: space-between;
  }

  /* navegação fixa embaixo (estilo app) */
  .shell{
    flex-direction: column;
  }
  .sidebar{
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9997;
    width: 100%;
    border-right: none;
    border-top: 1px solid var(--border);
    background: rgba(255,255,255,.85);
    backdrop-filter: blur(10px);
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px;
    gap: 8px;
  }
  [data-theme="dark"] .sidebar{
    background: rgba(15,23,42,.80);
  }
  .navbtn{
    flex: 0 0 auto;
    padding: 10px 12px;
    border-radius: 14px;
    min-width: 120px;
    white-space: nowrap;
  }

  /* conteúdo precisa “respirar” para não ficar atrás do menu fixo */
  .main{
    padding: 14px;
    padding-bottom: 92px;
  }

  /* cards/painéis e tipografia um pouco menores */
  .card.pad{ padding: 16px; }
  h1{ font-size: 22px; }
  h2{ font-size: 18px; }
  p{ font-size: 14px; }

  /* toolbar: tudo empilha bem */
  .toolbar{
    flex-direction: column;
    align-items: stretch;
  }
  .toolbar .search{
    width: 100%;
  }
  .toolbar .btns{
    width: 100%;
    justify-content: stretch;
  }
  .toolbar .btns .btn{
    flex: 1 1 auto;
    margin-bottom: 8px;
  }

  /* tabelas: rolagem horizontal suave e sem quebrar layout */
  .table{
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 14px;
  }
  .table thead, .table tbody, .table tr{
    width: 100%;
  }
  .table th, .table td{
    white-space: nowrap;
    padding: 10px 10px;
    font-size: 12.5px;
  }

  /* ações: botões menores para caber melhor */
  .iconbtn{
    width: 34px;
    height: 34px;
    border-radius: 12px;
  }

  /* paginação: botões e texto mais compactos */
  .pager{
    gap: 8px;
  }
  .pager .right{
    width: 100%;
    justify-content: space-between;
  }
  .pager select{
    padding: 10px 10px;
  }
}

@media (max-width: 420px){
  /* celular bem pequeno */
  .main{ padding: 12px; padding-bottom: 92px; }
  .navbtn{ min-width: 108px; padding: 10px 10px; }
  .btn{ padding: 10px 12px; }
  .badge{ font-size: 12px; }
  .kpi span{ font-size: 20px; }
  .avatar{ width: 36px; height: 36px; }
}

/* Para telas grandes (TV/4K): dá mais “respiro” sem quebrar */
@media (min-width: 1400px){
  .sidebar{ width: 300px; }
  .main{ padding: 22px; }
  .container{ max-width: 1140px; width: min(1140px, 92vw); }
}
