﻿:root {
  --bg: #f3f6ea;
  --bg-accent: #e6efe2;
  --line: #d4decd;
  --text: #18211a;
  --muted: #5b685d;
  --brand: #2c7a4b;
  --brand-dark: #185635;
  --danger: #a72d2d;
  --shadow: 0 20px 45px rgba(24, 33, 26, 0.12);
  --radius: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "DM Sans", "Trebuchet MS", sans-serif;
  color: var(--text);
  background:
    radial-gradient(900px 450px at 15% -20%, rgba(44, 122, 75, 0.2), transparent 70%),
    radial-gradient(900px 450px at 90% -20%, rgba(24, 86, 53, 0.18), transparent 70%),
    linear-gradient(180deg, var(--bg), var(--bg-accent));
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
  background: rgba(243, 246, 234, 0.9);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.brand-badge {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: linear-gradient(135deg, #142754, #0d1837);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 900;
  letter-spacing: 0.4px;
  flex: 0 0 auto;
}

.brand-text {
  display: grid;
  min-width: 0;
}

.brand-text strong {
  font-size: 18px;
  line-height: 1.1;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-text span {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

#user-name-pill {
  white-space: nowrap;
}

.role-badge {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.2px;
}

.role-badge.aluno {
  background: linear-gradient(135deg, #2c7a4b, #185635);
}

.role-badge.admin {
  background: linear-gradient(135deg, #1f3a8a, #0f2152);
}

.page {
  max-width: 1040px;
  margin: 20px auto;
  padding: 0 14px 24px;
}

.panel {
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(255,255,255,0.88));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: slide-in 280ms ease;
}

.section {
  padding: 16px;
  border-top: 1px solid var(--line);
}

.section:first-child { border-top: 0; }

h1, h2, h3 { margin: 0; }

.subtitle {
  margin-top: 6px;
  color: var(--muted);
}

.login-wrap {
  max-width: 460px;
  margin: 0 auto;
}

.login-form {
  margin-top: 14px;
  display: grid;
  gap: 9px;
}

.login-form label {
  font-weight: 800;
  font-size: 13px;
}

.login-form input {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 11px;
  font-size: 14px;
}

.login-form input:focus {
  outline: 2px solid rgba(44, 122, 75, 0.25);
  border-color: rgba(44, 122, 75, 0.7);
}

.remember-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  margin-top: 4px;
}

.remember-row input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.auth-link {
  border: 0;
  background: none;
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 800;
  padding: 0;
  text-align: left;
  cursor: pointer;
}

.auth-link:hover {
  text-decoration: underline;
}

.big-select {
  margin-top: 14px;
  border: 2px solid rgba(44, 122, 75, 0.5);
  border-radius: 14px;
  background: #f8fcf7;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  position: relative;
}

.big-label { font-weight: 800; text-transform: lowercase; }
.big-right { display: flex; align-items: center; gap: 8px; font-weight: 700; }

.pill {
  border: 1px solid rgba(44, 122, 75, 0.35);
  background: rgba(44, 122, 75, 0.1);
  color: var(--brand-dark);
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 14px 30px rgba(24, 33, 26, 0.14);
  display: none;
  overflow: hidden;
  z-index: 4;
}

.menu.show { display: block; }

.menu-item {
  padding: 11px 12px;
  border-top: 1px solid #e9eee5;
  text-transform: lowercase;
  font-weight: 700;
}

.menu-item:first-child { border-top: 0; }
.menu-item:hover { background: #f2f8f0; }

.pane-head,
.result-head {
  margin-top: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

#pane-description {
  margin-top: 4px;
  color: var(--muted);
}

.search-row {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.search-row input {
  flex: 1;
  min-width: 200px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 11px;
  font-size: 14px;
}

.search-row input:focus {
  outline: 2px solid rgba(44, 122, 75, 0.25);
  border-color: rgba(44, 122, 75, 0.7);
}

.tree {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  max-height: 320px;
  overflow: auto;
  background: #fff;
}

.node {
  padding: 11px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border-top: 1px solid #edf1ea;
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
  border-radius: 0;
  cursor: pointer;
  animation: fade-in 220ms ease;
  width: 100%;
  background: transparent;
  text-align: left;
  appearance: none;
}

.node:first-child { border-top: 0; }
.node:hover { background: #f2f8f0; }
.node.active { background: rgba(44, 122, 75, 0.13); }
.dc-badge {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: linear-gradient(135deg, #0b3c5d, #0a2a40);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 900;
  font-size: 10px;
  letter-spacing: 0.4px;
  box-shadow: 0 8px 16px rgba(11, 60, 93, 0.18);
  position: relative;
  flex: 0 0 auto;
}

.dc-badge:before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 9px;
  border: 1px solid rgba(14, 165, 233, 0.35);
  pointer-events: none;
}

.node-title { font-weight: 700; flex: 1; min-width: 0; }
.node-count { color: var(--muted); font-size: 12px; }

.chips {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border: 1px solid var(--line);
  background: #f8fcf7;
  border-radius: 10px;
  padding: 7px 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.chip button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  width: 20px;
  height: 20px;
  line-height: 1;
  cursor: pointer;
}

.actions {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  background: #fff;
  font-weight: 800;
  text-transform: lowercase;
  cursor: pointer;
}

.btn.primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  border-color: rgba(24, 86, 53, 0.6);
}

.btn.danger {
  color: #fff;
  border-color: #7a1f1f;
  background: linear-gradient(135deg, #b83737, var(--danger));
}

.btn.ghost { background: #f8fcf7; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.status,
.note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.status.error {
  border: 1px solid rgba(167, 45, 45, 0.3);
  background: rgba(167, 45, 45, 0.08);
  color: #7b1e1e;
  border-radius: 10px;
  padding: 8px 10px;
}

.question-list {
  margin-top: 12px;
  display: grid;
  gap: 9px;
}

.question-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 10px;
}

.question-card h3 {
  font-size: 15px;
  margin-bottom: 4px;
}

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

.hidden { display: none; }

.question-box {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 12px;
}

.question-meta {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.question-text {
  margin: 12px 0;
  font-size: 16px;
  line-height: 1.45;
}

.alternatives {
  display: grid;
  gap: 8px;
}

.alt-item {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 10px;
  cursor: pointer;
  background: #fcfefb;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 6px;
}

.alt-item:hover { border-color: rgba(44, 122, 75, 0.7); }
.alt-item.selected { border-color: rgba(44, 122, 75, 0.9); background: rgba(44, 122, 75, 0.12); }
.alt-item.correct { border-color: #1f8f55; background: rgba(31, 143, 85, 0.14); }
.alt-item.wrong { border-color: #bf3f3f; background: rgba(191, 63, 63, 0.14); }

.feedback {
  margin-top: 10px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #f8fcf7;
  font-weight: 700;
}

.feedback.ok { border-color: #1f8f55; color: #1f8f55; }
.feedback.no { border-color: #bf3f3f; color: #9e2f2f; }

.performance {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fcf7;
  padding: 12px;
}

.performance h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.performance-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 8px;
}

.performance-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

.performance-item b {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.performance-item span {
  font-size: 18px;
  font-weight: 800;
}

.admin-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 10px;
}

.admin-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 12px;
  text-align: left;
  cursor: pointer;
}

.admin-card:hover {
  background: #f2f8f0;
  border-color: rgba(44, 122, 75, 0.45);
}

.admin-card strong {
  display: block;
  font-size: 15px;
  margin-bottom: 3px;
}

.admin-card span {
  color: var(--muted);
  font-size: 13px;
}

.admin-users-wrap {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fcf7;
  padding: 10px;
}

.admin-users-table-wrap {
  margin-top: 8px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.admin-users-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.admin-users-table th,
.admin-users-table td {
  padding: 10px;
  border-bottom: 1px solid #edf1ea;
  text-align: left;
  font-size: 13px;
}

.admin-users-table th {
  background: #f2f8f0;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.admin-users-table tbody tr:hover {
  background: #fafdf9;
}

.upload-form {
  margin-top: 12px;
  display: grid;
  gap: 8px;
  max-width: 640px;
}

.upload-form label {
  font-size: 13px;
  font-weight: 800;
}

.upload-form input[type="text"],
.upload-form input[type="file"] {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 10px;
  font-size: 14px;
}

.upload-form input[type="text"]:focus {
  outline: 2px solid rgba(44, 122, 75, 0.25);
  border-color: rgba(44, 122, 75, 0.7);
}

.file-field {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.sr-file {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.file-btn {
  padding: 8px 12px;
  white-space: nowrap;
}

.file-name {
  color: var(--muted);
  font-size: 14px;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slide-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 640px) {
  .page { margin-top: 12px; }
  .section { padding: 13px; }
  .actions .btn { flex: 1; }
  .topbar { padding: 8px 10px; gap: 8px; }
  .topbar-right { gap: 6px; }
  .topbar-right .pill { padding: 4px 8px; font-size: 11px; }
  .topbar-right .btn { padding: 8px 10px; font-size: 12px; }
  .role-badge { width: 30px; height: 30px; font-size: 10px; }
  .admin-grid { grid-template-columns: 1fr; }
  .brand-text strong { font-size: 14px; }
  .brand-text span { display: none; }
}

