:root {
  --primary: #003595;
  --primary-dark: #002570;
  --primary-light: #0051d4;
  --accent: #FFB81C;
  --success: #1a7a3e;
  --success-bg: #d4edda;
  --warning: #856404;
  --warning-bg: #fff3cd;
  --danger: #721c24;
  --danger-bg: #f8d7da;
  --gray-50: #f8f9fa;
  --gray-100: #f0f2f5;
  --gray-200: #e9ecef;
  --gray-300: #dee2e6;
  --gray-500: #adb5bd;
  --gray-600: #6c757d;
  --gray-700: #495057;
  --gray-800: #343a40;
  --white: #ffffff;
  --shadow: 0 2px 12px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.12);
  --radius: 10px;
  --radius-sm: 6px;
  --transition: .2s ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--gray-100);
  color: var(--gray-800);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── HEADER ── */
.site-header {
  background: var(--primary);
  color: #fff;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.site-header .logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: .3px;
}
.site-header .logo-icon {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.header-user {
  font-size: 13px;
  opacity: .9;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── REGISTER PAGE ── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
  padding: 24px;
}
.auth-card {
  background: var(--white);
  border-radius: 16px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}
.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}
.auth-logo .badge {
  width: 72px;
  height: 72px;
  background: var(--primary);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  margin-bottom: 16px;
}
.auth-logo h1 {
  font-size: 22px;
  color: var(--primary);
  font-weight: 700;
}
.auth-logo p {
  color: var(--gray-600);
  font-size: 14px;
  margin-top: 4px;
}
.form-group {
  margin-bottom: 18px;
}
.form-group label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  color: var(--gray-700);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.form-control {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 15px;
  transition: border-color var(--transition);
  background: var(--white);
  color: var(--gray-800);
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0,53,149,.1);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  width: 100%;
}
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-secondary {
  background: var(--gray-200);
  color: var(--gray-800);
}
.btn-secondary:hover { background: var(--gray-300); }
.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-accent {
  background: var(--accent);
  color: var(--gray-800);
}
.btn-accent:hover { background: #e6a500; }
.btn-lg { padding: 14px 32px; font-size: 16px; }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 500;
}
.alert-danger { background: var(--danger-bg); color: var(--danger); border-left: 4px solid #dc3545; }
.alert-success { background: var(--success-bg); color: var(--success); border-left: 4px solid #28a745; }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-left: 4px solid #ffc107; }

/* ── TRAINING PAGE ── */
.training-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  grid-template-rows: auto 1fr;
  min-height: calc(100vh - 60px);
}
.training-sidebar {
  background: var(--white);
  border-right: 1px solid var(--gray-200);
  padding: 24px 16px;
  grid-row: 1 / 3;
}
.sidebar-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gray-600);
  padding: 0 8px;
  margin-bottom: 12px;
}
.nav-module {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav-module li button {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  color: var(--gray-700);
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background var(--transition);
  line-height: 1.3;
}
.nav-module li button:hover { background: var(--gray-100); }
.nav-module li button.active {
  background: rgba(0,53,149,.08);
  color: var(--primary);
  font-weight: 600;
}
.nav-module li button .num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.nav-module li button.active .num {
  background: var(--primary);
  color: #fff;
}
.sidebar-divider {
  border: none;
  border-top: 1px solid var(--gray-200);
  margin: 16px 0;
}
.sidebar-action {
  margin-top: 8px;
}

.training-main {
  padding: 32px;
  overflow-y: auto;
  max-width: 860px;
}
.module-content { display: none; }
.module-content.active { display: block; }

.module-header {
  margin-bottom: 28px;
}
.module-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0,53,149,.08);
  color: var(--primary);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 10px;
}
.module-header h2 {
  font-size: 24px;
  color: var(--gray-800);
  font-weight: 700;
  line-height: 1.3;
}
.module-header p {
  color: var(--gray-600);
  margin-top: 8px;
  font-size: 15px;
}

.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.criteria-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.criteria-table th {
  background: var(--gray-50);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--gray-600);
  border-bottom: 2px solid var(--gray-200);
}
.criteria-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--gray-200);
  vertical-align: middle;
}
.criteria-table tr:last-child td { border-bottom: none; }

.badge-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: #cfe2ff; color: #084298; }
.badge-gray { background: var(--gray-200); color: var(--gray-700); }

.highlight-box {
  border-left: 4px solid var(--primary);
  background: rgba(0,53,149,.04);
  padding: 14px 18px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 16px;
}
.highlight-box.warning {
  border-color: #ffc107;
  background: var(--warning-bg);
}
.highlight-box.success {
  border-color: #28a745;
  background: var(--success-bg);
}

.steps-list {
  list-style: none;
  counter-reset: steps;
}
.steps-list li {
  counter-increment: steps;
  display: flex;
  gap: 14px;
  margin-bottom: 14px;
  align-items: flex-start;
}
.steps-list li::before {
  content: counter(steps);
  width: 28px;
  height: 28px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.materials-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.material-item {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.material-item::before {
  content: '✓';
  color: var(--success);
  font-weight: 700;
}

.weight-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--accent);
  color: var(--gray-800);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
}

.contestation-flow {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin: 16px 0;
}
.flow-step {
  background: var(--gray-100);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
}
.flow-arrow { color: var(--gray-500); font-size: 18px; }

/* ── CHAT ── */
.chat-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 56px;
  height: 56px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  border: none;
  z-index: 200;
  transition: all var(--transition);
}
.chat-fab:hover { background: var(--primary-dark); transform: scale(1.05); }

.chat-panel {
  position: fixed;
  bottom: 96px;
  right: 28px;
  width: 360px;
  height: 480px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  display: none;
  flex-direction: column;
  z-index: 199;
  overflow: hidden;
  border: 1px solid var(--gray-200);
}
.chat-panel.open { display: flex; }

.chat-header {
  background: var(--primary);
  color: #fff;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 14px;
}
.chat-header button {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  opacity: .8;
}
.chat-header button:hover { opacity: 1; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chat-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-msg.bot {
  background: var(--gray-100);
  color: var(--gray-800);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.chat-msg.user {
  background: var(--primary);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.chat-msg.typing { color: var(--gray-600); font-style: italic; }

.chat-input-row {
  padding: 12px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  gap: 8px;
}
.chat-input {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 14px;
  resize: none;
  font-family: inherit;
}
.chat-input:focus { outline: none; border-color: var(--primary); }
.chat-send {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  cursor: pointer;
  font-size: 16px;
  transition: background var(--transition);
}
.chat-send:hover { background: var(--primary-dark); }

/* ── QUIZ PAGE ── */
.quiz-container {
  max-width: 780px;
  margin: 0 auto;
  padding: 32px 24px;
}
.quiz-header-block {
  background: var(--white);
  border-radius: var(--radius);
  padding: 28px 32px;
  box-shadow: var(--shadow);
  margin-bottom: 28px;
  text-align: center;
}
.quiz-header-block h1 {
  font-size: 26px;
  color: var(--primary);
  font-weight: 700;
}
.quiz-header-block p {
  color: var(--gray-600);
  margin-top: 8px;
}
.progress-bar-wrap {
  background: var(--gray-200);
  border-radius: 20px;
  height: 8px;
  margin-top: 20px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 20px;
  transition: width .4s ease;
}

.question-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px 28px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.question-num {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 10px;
}
.question-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 18px;
  line-height: 1.5;
}
.options-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.option-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 14px;
  line-height: 1.4;
}
.option-label:hover { border-color: var(--primary); background: rgba(0,53,149,.03); }
.option-label input[type="radio"] { display: none; }
.option-label.selected {
  border-color: var(--primary);
  background: rgba(0,53,149,.06);
  font-weight: 500;
}
.option-marker {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--gray-400);
  flex-shrink: 0;
  margin-top: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.option-label.selected .option-marker {
  border-color: var(--primary);
  background: var(--primary);
}
.option-label.selected .option-marker::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  display: block;
}

.quiz-footer {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px 28px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  bottom: 16px;
}
.answered-count { font-size: 14px; color: var(--gray-600); }
.answered-count strong { color: var(--primary); }

/* ── EXEMPLOS PRÁTICOS ── */
.examples-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.example-card {
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px solid var(--gray-200);
  background: var(--white);
}
.example-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
  cursor: pointer;
  transition: opacity .2s;
}
.example-card img:hover { opacity: .88; }
.example-label {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.example-card.ok { border-color: var(--success); }
.example-card.ok .example-label { background: #f0fdf4; color: #166534; }
.example-card.nok { border-color: var(--danger); }
.example-card.nok .example-label { background: #fff1f2; color: #9f1239; }
.example-card.parcial { border-color: #f59e0b; }
.example-card.parcial .example-label { background: #fffbeb; color: #92400e; }
.example-caption { font-size: 12px; font-weight: 400; color: inherit; opacity: .8; }

/* lightbox */
.lightbox { display:none; position:fixed; inset:0; background:rgba(0,0,0,.85); z-index:9999; align-items:center; justify-content:center; }
.lightbox.open { display:flex; }
.lightbox img { max-width:90vw; max-height:90vh; border-radius:8px; }
.lightbox-close { position:fixed; top:20px; right:24px; color:#fff; font-size:32px; cursor:pointer; line-height:1; }

/* ── RESULTADO PAGE ── */
.resultado-container {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 24px;
}
.score-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 40px;
  box-shadow: var(--shadow);
  text-align: center;
  margin-bottom: 24px;
}
.score-circle {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  margin: 0 auto 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 6px solid;
}
.score-circle.approved { border-color: #28a745; background: #d4edda; }
.score-circle.failed { border-color: #dc3545; background: #f8d7da; }
.score-circle .pct {
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
}
.score-circle.approved .pct { color: var(--success); }
.score-circle.failed .pct { color: var(--danger); }
.score-circle .label { font-size: 12px; font-weight: 600; color: var(--gray-600); }
.score-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
}
.score-title.approved { color: var(--success); }
.score-title.failed { color: var(--danger); }
.score-subtitle { color: var(--gray-600); font-size: 15px; }
.score-meta {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--gray-200);
}
.score-meta-item { text-align: center; }
.score-meta-item .val {
  font-size: 24px;
  font-weight: 800;
  color: var(--primary);
}
.score-meta-item .lbl { font-size: 12px; color: var(--gray-600); }

.review-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 24px;
}
.review-card-header {
  background: var(--gray-50);
  padding: 16px 24px;
  font-weight: 700;
  font-size: 15px;
  border-bottom: 1px solid var(--gray-200);
}
.review-item {
  padding: 16px 24px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.review-item:last-child { border-bottom: none; }
.review-icon {
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 2px;
}
.review-item .q { font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.review-item .your { font-size: 13px; color: var(--gray-600); }
.review-item .correct-ans {
  font-size: 13px;
  font-weight: 600;
  color: var(--success);
  margin-top: 3px;
}

/* ── MANAGER PAGE ── */
.manager-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px;
}
.manager-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 16px;
}
.manager-header h1 { font-size: 22px; font-weight: 700; color: var(--gray-800); }
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  text-align: center;
}
.stat-card .val { font-size: 28px; font-weight: 800; color: var(--primary); }
.stat-card .lbl { font-size: 12px; color: var(--gray-600); margin-top: 4px; }

.results-table-wrap {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.results-table th {
  background: var(--primary);
  color: #fff;
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.results-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-200);
  vertical-align: middle;
}
.results-table tr:last-child td { border-bottom: none; }
.results-table tr:hover td { background: var(--gray-50); }
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--gray-600);
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }

/* ── SHARE BOX ── */
.share-box {
  background: rgba(0,53,149,.05);
  border: 1px solid rgba(0,53,149,.2);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.share-box .share-icon { font-size: 32px; }
.share-box .share-info h3 { font-size: 15px; font-weight: 700; color: var(--primary); margin-bottom: 4px; }
.share-box .share-info p { font-size: 13px; color: var(--gray-600); }
.share-box code {
  background: var(--gray-100);
  border: 1px solid var(--gray-300);
  padding: 4px 10px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 13px;
  color: var(--primary-dark);
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .training-layout { grid-template-columns: 1fr; }
  .training-sidebar { display: none; }
  .training-main { padding: 20px 16px; }
  .materials-grid { grid-template-columns: 1fr; }
  .chat-panel { width: calc(100vw - 40px); right: 20px; }
  .auth-card { padding: 32px 24px; }
  .score-meta { gap: 20px; }
  .quiz-footer { flex-direction: column; }
}
