/* ── RESET & VARS ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:   #4338CA;
  --primary-h: #3730A3;
  --success:   #059669;
  --danger:    #DC2626;
  --bg:        #F8FAFC;
  --surface:   #FFFFFF;
  --border:    #E2E8F0;
  --text:      #1E293B;
  --text2:     #64748B;
  --sidebar-w: 220px;
  --radius:    8px;
  --shadow:    0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
}

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
       background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }

/* ── LOGIN ────────────────────────────────────────────────── */
.page-login {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #312E81 0%, #4338CA 100%);
}
.login-card {
  background: var(--surface); border-radius: 12px; padding: 2.5rem;
  width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.login-logo { text-align: center; margin-bottom: 2rem; }
.login-logo-icon { font-size: 2.5rem; color: var(--primary); margin-bottom: .5rem; }
.login-logo h2 { font-size: 1.1rem; color: var(--text); }
.login-logo p  { font-size: .85rem; color: var(--text2); margin-top: .25rem; }

/* ── APP LAYOUT ───────────────────────────────────────────── */
#app { display: flex; min-height: 100vh; }

/* ── SIDEBAR ──────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w); background: #1E1B4B; color: #fff;
  display: flex; flex-direction: column; flex-shrink: 0;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
}
.sidebar-logo {
  padding: 1.5rem 1.25rem 1rem; display: flex; align-items: center; gap: .75rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-logo-icon { font-size: 1.4rem; color: #A5B4FC; }
.sidebar-logo-text { font-weight: 700; font-size: .95rem; }
.sidebar-nav { padding: 1rem 0; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .65rem 1.25rem; color: rgba(255,255,255,.7);
  text-decoration: none; font-size: .875rem;
  transition: background .15s, color .15s;
}
.nav-item svg { width: 18px; height: 18px; fill: currentColor; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: rgba(165,180,252,.15); color: #A5B4FC; }
.sidebar-user {
  padding: 1rem 1.25rem; border-top: 1px solid rgba(255,255,255,.1);
  display: flex; flex-direction: column; gap: .5rem;
}
.sidebar-user-info { display: flex; flex-direction: column; gap: .2rem; }
.sidebar-user-info span:first-child { font-size: .875rem; font-weight: 500; color: #fff; }
.badge-perfil {
  font-size: .7rem; padding: .1rem .5rem; border-radius: 20px;
  background: rgba(165,180,252,.2); color: #A5B4FC; width: fit-content;
  text-transform: capitalize;
}
.btn-logout {
  background: transparent; border: 1px solid rgba(255,255,255,.2);
  color: rgba(255,255,255,.6); padding: .4rem .75rem; border-radius: 6px;
  cursor: pointer; font-size: .8rem; transition: all .15s;
}
.btn-logout:hover { border-color: rgba(255,255,255,.4); color: #fff; }

/* ── MAIN CONTENT ─────────────────────────────────────────── */
.main-content { margin-left: var(--sidebar-w); flex: 1; padding: 2rem; min-width: 0; }
.content-page { display: none; }
.content-page.active { display: block; }
.page-header {
  display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.page-header h1 { font-size: 1.4rem; font-weight: 700; flex: 1; }
.page-header-actions { display: flex; gap: .75rem; align-items: center; }

/* ── CARDS ────────────────────────────────────────────────── */
.form-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1rem;
  box-shadow: var(--shadow);
}
.form-card h3 { font-size: 1rem; margin-bottom: 1rem; color: var(--text); }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.estudante-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem; cursor: pointer;
  transition: box-shadow .15s, transform .15s; box-shadow: var(--shadow);
}
.estudante-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.1); transform: translateY(-1px); }
.estudante-card h4 { font-size: .95rem; margin-bottom: .4rem; }
.estudante-card p  { font-size: .8rem; color: var(--text2); }

/* ── FORMS ────────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.field { display: flex; flex-direction: column; gap: .3rem; }
.field.full { grid-column: 1 / -1; }
label { font-size: .8rem; font-weight: 500; color: var(--text2); }
input[type=text], input[type=email], input[type=date], input[type=password],
select, textarea {
  padding: .5rem .75rem; border: 1px solid var(--border); border-radius: 6px;
  font-size: .875rem; color: var(--text); background: var(--surface);
  transition: border-color .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(67,56,202,.1);
}
input[readonly] { background: var(--bg); color: var(--text2); }
textarea { resize: vertical; font-family: inherit; }
.form-hint { font-size: .8rem; color: var(--text2); margin-bottom: .75rem; }
.form-actions { display: flex; gap: .75rem; justify-content: flex-end; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }

/* ── BUTTONS ──────────────────────────────────────────────── */
.btn-primary, .btn-secondary, .btn-success, .btn-danger, .btn-pdf {
  padding: .5rem 1.25rem; border-radius: 6px; border: none; cursor: pointer;
  font-size: .875rem; font-weight: 500; transition: all .15s; display: inline-flex;
  align-items: center; gap: .4rem;
}
.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-h); }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-success   { background: var(--success); color: #fff; }
.btn-success:hover { opacity: .9; }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: .9; }
.btn-pdf       { background: #0369A1; color: #fff; }
.btn-pdf:hover { opacity: .9; }
.btn-full { width: 100%; justify-content: center; }
.btn-back { padding: .4rem .75rem; font-size: .8rem; }
button:disabled { opacity: .5; cursor: not-allowed; }

/* ── STEPS NAV ────────────────────────────────────────────── */
.steps-nav { display: flex; gap: .5rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.step-btn {
  padding: .4rem 1rem; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--text2); cursor: pointer; font-size: .8rem;
  transition: all .15s;
}
.step-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.step-content { display: none; }
.step-content.active { display: block; }

/* ── STATUS BADGES ────────────────────────────────────────── */
.status-badge {
  display: inline-block; padding: .2rem .6rem; border-radius: 20px;
  font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em;
}
.status-rascunho              { background: #FEF9C3; color: #854D0E; }
.status-aguardando_saee       { background: #DBEAFE; color: #1E40AF; }
.status-aguardando_coordenacao{ background: #EDE9FE; color: #4C1D95; }
.status-aprovado              { background: #DCFCE7; color: #14532D; }

/* ── AVALIAÇÃO — STEP 3 ───────────────────────────────────── */
.nivel-selector { margin-bottom: 1rem; }
.faixa-selector { display: grid; grid-template-columns: repeat(3,1fr); gap: .75rem; margin-bottom: 1rem; }
.faixa-btn {
  display: flex; align-items: center; gap: .75rem; padding: .9rem 1rem;
  border: 2px solid var(--border); border-radius: var(--radius);
  background: var(--surface); cursor: pointer; transition: all .15s; text-align: left;
}
.faixa-btn.active { border-color: var(--primary); background: #EEF2FF; }
.faixa-icon { font-size: 1.4rem; }
.faixa-label { display: flex; flex-direction: column; }
.faixa-label strong { font-size: .82rem; }
.faixa-label small  { font-size: .72rem; color: var(--text2); }
.areas-tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.area-tab {
  padding: .35rem .85rem; border: 1px solid var(--border); border-radius: 20px;
  background: var(--surface); cursor: pointer; font-size: .78rem; transition: all .15s;
}
.area-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.area-panel { display: none; }
.area-panel.active { display: block; }
.objetivos-grid { display: flex; flex-direction: column; gap: .75rem; }
.obj-card {
  background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: .9rem 1rem;
}
.obj-card-header { display: flex; align-items: center; gap: .6rem; margin-bottom: .5rem; }
.obj-code {
  font-family: monospace; font-size: .72rem; font-weight: 700;
  background: var(--primary); color: #fff; padding: .15rem .5rem; border-radius: 4px;
}
.obj-card-desc { font-size: .82rem; margin-bottom: .6rem; line-height: 1.5; }
.obj-card-levels { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .5rem; }
.obj-level { cursor: pointer; }
.obj-level input[type=radio] { display: none; }
.lvl {
  display: inline-block; padding: .3rem .8rem; border-radius: 20px;
  border: 1.5px solid transparent; font-size: .75rem; font-weight: 500; cursor: pointer; transition: all .15s;
}
.lvl-green  { background: #F0FDF4; border-color: #86EFAC; color: #166534; }
.lvl-blue   { background: #EFF6FF; border-color: #93C5FD; color: #1E40AF; }
.lvl-orange { background: #FFF7ED; border-color: #FDBA74; color: #9A3412; }
.lvl-gray   { background: #F9FAFB; border-color: #D1D5DB; color: #6B7280; }
.obj-level input:checked + .lvl-green  { background: #DCFCE7; border-color: #16A34A; font-weight: 700; }
.obj-level input:checked + .lvl-blue   { background: #DBEAFE; border-color: #2563EB; font-weight: 700; }
.obj-level input:checked + .lvl-orange { background: #FFEDD5; border-color: #EA580C; font-weight: 700; }
.obj-level input:checked + .lvl-gray   { background: #F3F4F6; border-color: #6B7280; font-weight: 700; }
.obj-card-resp { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.obj-card-resp label { font-size: .75rem; white-space: nowrap; }
.resp-input {
  flex: 1; min-width: 140px; padding: .3rem .6rem;
  font-size: .78rem; border: 1px solid var(--border); border-radius: 5px;
}
.faixa-sep {
  font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--primary); padding: .5rem 0 .25rem;
  border-bottom: 1px solid var(--border); margin-top: .5rem;
}
.socio-grupo { margin-bottom: 1.25rem; }
.socio-grupo-title {
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--primary); background: #EEF2FF; padding: .4rem .75rem;
  border-radius: 5px; margin-bottom: .6rem;
}

/* ── PROPOSTA — STEP 4 ────────────────────────────────────── */
.proposta-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 1rem; margin-bottom: .75rem;
}
.proposta-card-header { display: flex; align-items: flex-start; gap: .75rem; margin-bottom: .75rem; }
.proposta-inv-tag {
  padding: .15rem .6rem; border-radius: 20px; font-size: .7rem;
  font-weight: 600; white-space: nowrap; flex-shrink: 0;
}
.tag-academica      { background: #DBEAFE; color: #1E40AF; }
.tag-socioemocional { background: #EDE9FE; color: #4C1D95; }
.tag-funcional      { background: #DCFCE7; color: #14532D; }
.proposta-hab-texto { font-size: .82rem; line-height: 1.5; flex: 1; }
.proposta-campos { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.proposta-campo { display: flex; flex-direction: column; gap: .2rem; }
.proposta-campo.full { grid-column: 1 / -1; }
.proposta-campo label { font-size: .72rem; font-weight: 500; color: var(--text2); }
.proposta-campo input, .proposta-campo textarea {
  padding: .35rem .6rem; border: 1px solid var(--border); border-radius: 5px;
  font-size: .8rem;
}
.nivel-apoio  { background: #DBEAFE; color: #1E40AF; }
.nivel-nao    { background: #FFEDD5; color: #9A3412; }
.nivel-nobs   { background: #F3F4F6; color: #6B7280; }

/* ── STATS ────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow);
}
.stat-num { font-size: 2rem; font-weight: 700; color: var(--primary); }
.stat-label { font-size: .8rem; color: var(--text2); }
.pendente-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .9rem 1.25rem; margin-bottom: .5rem;
  display: flex; align-items: center; justify-content: space-between; cursor: pointer;
  transition: box-shadow .15s;
}
.pendente-item:hover { box-shadow: 0 2px 8px rgba(0,0,0,.08); }

/* ── MODAIS ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 200;
}
.modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
  background: var(--surface); border-radius: 10px; z-index: 201;
  width: 100%; max-width: 520px; box-shadow: 0 20px 60px rgba(0,0,0,.2);
  max-height: 90vh; overflow-y: auto;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1rem; }
.modal-header button { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--text2); }
.modal-body   { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: .75rem; }
.checkbox-list { display: flex; flex-direction: column; gap: .4rem; max-height: 200px; overflow-y: auto; border: 1px solid var(--border); border-radius: 6px; padding: .5rem; }
.checkbox-list label { display: flex; align-items: center; gap: .5rem; font-size: .82rem; cursor: pointer; }
.checkbox-list input { width: 15px; height: 15px; }

/* ── TABLE ────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.data-table th { background: var(--bg); font-weight: 600; text-align: left; padding: .6rem .75rem; border-bottom: 2px solid var(--border); }
.data-table td { padding: .6rem .75rem; border-bottom: 1px solid var(--border); }
.data-table tr:hover td { background: var(--bg); }

/* ── SEARCH ───────────────────────────────────────────────── */
.search-input { padding: .45rem .75rem; border: 1px solid var(--border); border-radius: 6px; font-size: .875rem; min-width: 200px; }

/* ── TOAST ────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 300;
  padding: .75rem 1.25rem; border-radius: 8px; font-size: .875rem;
  background: #1E293B; color: #fff; box-shadow: 0 4px 20px rgba(0,0,0,.2);
  animation: slideUp .2s ease;
}
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
@keyframes slideUp { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }

/* ── ERRO ─────────────────────────────────────────────────── */
.erro-msg { background: #FEE2E2; color: #991B1B; padding: .6rem .9rem; border-radius: 6px; font-size: .82rem; margin-bottom: .75rem; }
.rejeicao-msg { background: #FFF7ED; border: 1px solid #FED7AA; color: #9A3412; padding: .6rem .9rem; border-radius: 6px; font-size: .82rem; margin-bottom: .75rem; }

/* ── HISTORICO ────────────────────────────────────────────── */
.historico-item { padding: .5rem .75rem; border-left: 3px solid var(--primary); margin-bottom: .5rem; background: var(--bg); border-radius: 0 6px 6px 0; font-size: .8rem; }

/* ── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; padding: 1rem; }
  .form-grid { grid-template-columns: 1fr; }
  .faixa-selector { grid-template-columns: 1fr; }
  .proposta-campos { grid-template-columns: 1fr; }
}

/* Step 2 — campos largos */
#step-2 textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
}
#step-2 .form-card h3 {
  margin-bottom: .4rem;
}
