:root {
  --black: #0C0C0C;
  --teal: #16D5D0;
  --teal-dark: #0E9B97;
  --bg: #F7F7F5;
  --surface: #FFFFFF;
  --border: #E5E5E0;
  --muted: #6B6B66;
  --text: #18181A;
  --green: #1D9E75;
  --green-light: #E1F5EE;
  --red: #C0432A;
  --red-light: #FAECE7;
  --amber: #B37412;
  --amber-light: #FAEEDA;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

h1, h2, h3 { font-family: 'Syne', sans-serif; font-weight: 700; margin: 0; }

button {
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  padding: 10px 18px;
  background: var(--black);
  color: #fff;
  transition: opacity .15s;
}
button:hover { opacity: .85; }
button.secondary { background: transparent; color: var(--text); border: 1px solid var(--border); }
button.danger { background: var(--red); }
button:disabled { opacity: .4; cursor: not-allowed; }

input, textarea, select {
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 100%;
  background: #fff;
  color: var(--text);
}
textarea { resize: vertical; min-height: 80px; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; margin-top: 12px; }

.hidden { display: none !important; }

/* ---------- Login ---------- */
#view-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 32px;
}
.login-logo { display: flex; align-items: center; gap: 8px; margin-bottom: 28px; }
.login-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--teal); }
.login-logo span { font-family: 'Syne', sans-serif; font-weight: 700; letter-spacing: .5px; }
.login-error { color: var(--red); font-size: 13px; margin-top: 12px; min-height: 16px; }

/* ---------- Shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px;
  background: var(--black);
  color: #fff;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
}
.sidebar .login-logo span { color: #fff; }
.sidebar nav { margin-top: 32px; display: flex; flex-direction: column; gap: 4px; }
.sidebar nav a {
  color: #B8B8B5;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}
.sidebar nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar nav a.active { background: var(--teal); color: var(--black); font-weight: 700; }
.sidebar .user-box { margin-top: auto; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.1); font-size: 13px; color: #B8B8B5; }
.sidebar .user-box button { width: 100%; margin-top: 10px; }

.main { flex: 1; padding: 32px 40px; max-width: 1000px; }
.page-title { margin-bottom: 24px; }
.page-title h1 { font-size: 22px; }
.page-title p { color: var(--muted); margin-top: 4px; }

/* ---------- Cards ---------- */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
}
.card:hover { border-color: var(--teal); }
.card .module-code { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.card h3 { font-size: 16px; margin-bottom: 10px; }

.badge { display: inline-block; font-size: 12px; padding: 3px 10px; border-radius: 999px; font-weight: 700; }
.badge.aprovado { background: var(--green-light); color: var(--green); }
.badge.reprovado { background: var(--red-light); color: var(--red); }
.badge.em_andamento { background: var(--amber-light); color: var(--amber); }
.badge.nao_iniciado, .badge.sem_exercicio { background: #EDEDEA; color: var(--muted); }

.stats-row { display: flex; gap: 16px; margin-bottom: 28px; }
.stat-card { flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.stat-card .num { font-family: 'Syne', sans-serif; font-size: 28px; font-weight: 700; }
.stat-card .label { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* ---------- Lists ---------- */
.list-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 12px;
}
.list-item-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.list-item-meta { font-size: 12px; color: var(--muted); margin-top: 4px; }

.tutorial-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.tutorial-row:last-child { border-bottom: none; }
.tutorial-row a { color: var(--teal-dark); text-decoration: none; flex: 1; }

.exercise-box { border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; background: var(--surface); }
.exercise-box .question { font-weight: 700; margin-bottom: 10px; }
.option-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.comment-box { margin-top: 10px; padding: 10px 12px; background: var(--bg); border-radius: 8px; font-size: 13px; }

.back-link { color: var(--muted); cursor: pointer; font-size: 13px; margin-bottom: 16px; display: inline-block; }
.back-link:hover { color: var(--text); }

.empty-state { color: var(--muted); padding: 40px 0; text-align: center; }

.tag { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--bg); color: var(--muted); margin-left: 8px; }

.form-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.form-actions { display: flex; gap: 10px; margin-top: 16px; }
.inline-fields { display: flex; gap: 10px; }
.inline-fields > div { flex: 1; }
