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

:root {
  --bg: #0f0f13;
  --surface: #17171e;
  --surface2: #1e1e28;
  --border: rgba(255,255,255,.08);
  --border2: rgba(255,255,255,.13);
  --hover-overlay: rgba(255,255,255,.02);
  --shadow-color: rgba(0,0,0,.5);
  --shadow-color-strong: rgba(0,0,0,.6);

  --primary: #6366f1;
  --primary-hover: #5254cc;
  --accent: #8b5cf6;
  --accent-glow: rgba(99,102,241,.25);
  --primary-glow-08: rgba(99,102,241,.08);
  --primary-glow-12: rgba(99,102,241,.12);
  --primary-glow-15: rgba(99,102,241,.15);
  --primary-glow-18: rgba(99,102,241,.18);
  --primary-glow-25: rgba(99,102,241,.25);
  --primary-glow-30: rgba(99,102,241,.30);
  --primary-glow-45: rgba(99,102,241,.45);
  --accent-glow-10: rgba(139,92,246,.10);

  --text: #f0f0f5;
  --text-muted: #8585a8;
  --text-dim: #4a4a65;
  --text-on-primary: #ffffff;

  --green: #22c55e; --green-bg: rgba(34,197,94,.12); --green-text: #86efac; --green-border: rgba(34,197,94,.25); --green-bg-hover: rgba(34,197,94,.2);
  --red: #ef4444;   --red-bg: rgba(239,68,68,.12);   --red-text: #fca5a5;  --red-border: rgba(239,68,68,.25);   --red-bg-hover: rgba(239,68,68,.2);
  --yellow: #f59e0b; --yellow-bg: rgba(245,158,11,.12); --yellow-text: #fde68a;
  --blue: #3b82f6;  --blue-bg: rgba(59,130,246,.12);  --blue-text: #93c5fd;
  --gray-bg: rgba(255,255,255,.05); --gray-dot: #6b7280;

  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Inter', sans-serif;
  --font-display: 'Inter', sans-serif;
  --mono: 'JetBrains Mono', monospace;

  --spinner-track: rgba(255,255,255,.3);
  --spinner-active: #fff;
  --header-bg: rgba(15,15,19,.85);

  color-scheme: dark;
}

/* ══════════════════════════════════════════════
   MODO CLARO
══════════════════════════════════════════════ */
[data-theme="light"] {
  --bg: #f4f5f9;
  --surface: #ffffff;
  --surface2: #f0f1f6;
  --border: rgba(15,15,30,.09);
  --border2: rgba(15,15,30,.14);
  --hover-overlay: rgba(15,15,30,.025);
  --shadow-color: rgba(30,30,60,.10);
  --shadow-color-strong: rgba(30,30,60,.16);

  --text: #15151f;
  --text-muted: #5c5c72;
  --text-dim: #9494a8;
  --text-on-primary: #ffffff;

  --green-bg: rgba(34,197,94,.12); --green-text: #15803d; --green-border: rgba(34,197,94,.3); --green-bg-hover: rgba(34,197,94,.22);
  --red-bg: rgba(239,68,68,.12);  --red-text: #b91c1c;  --red-border: rgba(239,68,68,.3);   --red-bg-hover: rgba(239,68,68,.22);
  --yellow-bg: rgba(245,158,11,.14); --yellow-text: #92400e;
  --blue-bg: rgba(59,130,246,.12); --blue-text: #1d4ed8;
  --gray-bg: rgba(15,15,30,.05); --gray-dot: #6b7280;

  --header-bg: rgba(244,245,249,.85);

  color-scheme: light;
}

html { font-size: 15px; transition: background-color .2s ease; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color .2s ease, color .2s ease;
}

/* ══════════════════════════════════════════════
   BOTÃO DE TROCAR TEMA (sol / lua)
══════════════════════════════════════════════ */
.btn-theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 9px;
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text-muted); cursor: pointer; flex-shrink: 0;
  transition: color .15s, border-color .15s, background .15s;
}
.btn-theme-toggle:hover { color: var(--text); border-color: var(--primary); }
.btn-theme-toggle svg { width: 18px; height: 18px; }
.btn-theme-toggle .icon-sun { display: none; }
.btn-theme-toggle .icon-moon { display: block; }
[data-theme="light"] .btn-theme-toggle .icon-sun { display: block; }
[data-theme="light"] .btn-theme-toggle .icon-moon { display: none; }

/* ══════════════════════════════════════════════
   LOGIN — TELA DIVIDIDA (marca + formulário)
══════════════════════════════════════════════ */
body.login-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
  padding: 0;
}

.login-brand {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  padding: 48px 52px;
  position: relative;
  overflow: hidden;
}
.login-brand::before {
  content: '';
  position: absolute;
  bottom: -80px; left: -80px;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow-10) 0%, transparent 70%);
  pointer-events: none;
}
.login-brand::after {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--blue-bg) 0%, transparent 70%);
  pointer-events: none;
}

.brand-top { position: relative; z-index: 1; }
.brand-logo { display: flex; align-items: center; gap: 14px; margin-bottom: 56px; }
.brand-mark {
  width: 48px; height: 48px; border-radius: 12px;
  overflow: hidden; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; }
.brand-name { font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; }
.brand-sub  { font-size: .72rem; color: var(--text-muted); margin-top: 1px; }

.brand-headline {
  font-family: var(--font-display);
  font-size: 2rem; font-weight: 700;
  line-height: 1.2; color: var(--text);
  max-width: 320px;
}
.brand-headline span { color: var(--accent); }

.brand-features { margin-top: 36px; display: flex; flex-direction: column; gap: 14px; }
.brand-feature { display: flex; align-items: center; gap: 12px; font-size: .83rem; color: var(--text-muted); }
.brand-feature-icon {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--surface2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent); flex-shrink: 0; font-size: .85rem;
}

.brand-bottom { position: relative; z-index: 1; font-size: .72rem; color: var(--text-dim); }

.login-form-side {
  display: flex; align-items: center; justify-content: center;
  padding: 40px 32px; background: var(--bg);
}

.login-card { width: 100%; max-width: 380px; }

.login-header { margin-bottom: 32px; }
.login-title { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.login-desc { font-size: .85rem; color: var(--text-muted); line-height: 1.5; }

.login-footer {
  margin-top: 28px; padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: .73rem; color: var(--text-dim); text-align: center;
}

.login-mobile-brand { display: none; align-items: center; gap: 12px; margin-bottom: 28px; }
.login-mobile-brand .brand-mark { width: 40px; height: 40px; border-radius: 10px; overflow: hidden; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.login-mobile-brand .brand-mark img { width: 100%; height: 100%; object-fit: contain; }
.login-mobile-brand .brand-name { font-family: var(--font-display); font-size: 1rem; font-weight: 700; }
.login-mobile-brand .brand-sub  { font-size: .70rem; color: var(--text-muted); margin-top: 1px; }

@media (max-width: 820px) {
  body.login-body { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .login-mobile-brand { display: flex; }
  .login-form-side { background: radial-gradient(ellipse at top, var(--surface) 0%, var(--bg) 60%); }
}

/* ══════════════════════════════════════════════
   FORM FIELDS
══════════════════════════════════════════════ */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field label { font-size: .78rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.field-hint { font-size: .72rem; color: var(--text-dim); margin-top: 2px; }

input[type="text"], input[type="password"], input[type="email"],
input[type="number"], input[type="url"], select, textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: .9rem;
  padding: 10px 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
}
textarea { resize: vertical; min-height: 70px; font-family: var(--font); }
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
select {
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238585a8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.input-wrap { position: relative; }
.input-wrap input { padding-right: 44px; }
.btn-eye {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: var(--text-muted);
  display: flex; align-items: center; padding: 4px; transition: color .15s;
}
.btn-eye:hover { color: var(--text); }

/* ══════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════ */
.btn-primary {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--primary); color: var(--text-on-primary);
  font-family: var(--font); font-size: .9rem; font-weight: 600;
  border: none; border-radius: var(--radius-sm);
  padding: 11px 20px; cursor: pointer;
  transition: background .15s, transform .1s, box-shadow .15s;
  box-shadow: 0 4px 16px var(--primary-glow-30);
  white-space: nowrap;
}
.btn-primary:hover { background: var(--primary-hover); box-shadow: 0 4px 20px var(--primary-glow-45); }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary.full { width: 100%; }

.btn-secondary {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--surface2); color: var(--text);
  border: 1px solid var(--border2); border-radius: var(--radius-sm);
  font-family: var(--font); font-size: .85rem; font-weight: 500;
  padding: 9px 16px; cursor: pointer; transition: border-color .15s, background .15s;
}
.btn-secondary:hover { border-color: var(--primary); background: var(--primary-glow-08); }

.btn-danger {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--red-bg); color: var(--red-text);
  border: 1px solid var(--red-border); border-radius: var(--radius-sm);
  font-family: var(--font); font-size: .82rem; font-weight: 500;
  padding: 7px 14px; cursor: pointer; transition: background .15s;
}
.btn-danger:hover { background: var(--red-bg-hover); }

.btn-logout {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-muted); font-family: var(--font); font-size: .82rem; font-weight: 500;
  padding: 7px 14px; cursor: pointer; transition: color .15s, border-color .15s;
}
.btn-logout:hover { color: var(--text); border-color: var(--border2); }

/* ══════════════════════════════════════════════
   ALERTS & SPINNERS
══════════════════════════════════════════════ */
.alert-error {
  background: var(--red-bg); border: 1px solid var(--red-border); color: var(--red-text);
  border-radius: var(--radius-sm); padding: 10px 14px; font-size: .85rem;
}
.alert-success {
  background: var(--green-bg); border: 1px solid var(--green-border); color: var(--green-text);
  border-radius: var(--radius-sm); padding: 10px 14px; font-size: .85rem;
}
.spinner {
  width: 16px; height: 16px; border: 2px solid var(--spinner-track);
  border-top-color: var(--spinner-active); border-radius: 50%; animation: spin .6s linear infinite; display: inline-block;
}
.big-spinner {
  width: 36px; height: 36px; border: 3px solid var(--border2);
  border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════
   HEADER SIMPLES
══════════════════════════════════════════════ */
.header {
  position: sticky; top: 0; z-index: 100;
  background: var(--header-bg); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1200px; margin: 0 auto; padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.header-logo { display: flex; align-items: center; gap: 10px; }
.header-title { font-weight: 600; font-size: .95rem; }
.logo-mark { width: 32px; height: 32px; border-radius: 9px; overflow: hidden; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.logo-mark.small { width: 28px; height: 28px; }
.logo-mark img { width: 100%; height: 100%; object-fit: contain; }

.main { max-width: 1200px; margin: 0 auto; padding: 32px 24px 64px; display: flex; flex-direction: column; gap: 24px; }
.section-label { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--primary); margin-bottom: 12px; }

/* ══════════════════════════════════════════════
   CARDS
══════════════════════════════════════════════ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.resumo-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.card-stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; }
.stat-label { font-size: .75rem; color: var(--text-muted); margin-bottom: 8px; font-weight: 500; text-transform: uppercase; letter-spacing: .06em; }
.stat-value { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }

.banner {
  background: linear-gradient(135deg, var(--primary-glow-15), var(--accent-glow-10));
  border: 1px solid var(--primary-glow-25); border-radius: var(--radius);
  padding: 20px 24px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.banner-titulo { font-size: 1.15rem; font-weight: 700; }
.banner-info { font-size: .82rem; color: var(--text-muted); }

.state-msg {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 24px; text-align: center; color: var(--text-muted); font-size: .9rem; gap: 12px;
}
.state-icon { font-size: 2rem; }
.result-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; min-height: 180px; display: flex; flex-direction: column; }

/* Cards de curso (grade) */
.curso-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; cursor: pointer; transition: border-color .15s, transform .1s, background .15s;
  display: flex; flex-direction: column; gap: 8px;
}
.curso-card:hover { border-color: var(--primary); background: var(--primary-glow-08); }
.curso-card-titulo { font-weight: 600; font-size: .95rem; }
.curso-card-desc { font-size: .8rem; color: var(--text-muted); line-height: 1.5; }
.curso-card-meta { font-size: .72rem; color: var(--text-dim); margin-top: auto; padding-top: 8px; }

/* ══════════════════════════════════════════════
   TABLE
══════════════════════════════════════════════ */
.table-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.table-info { font-size: .82rem; color: var(--text-muted); }
.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table thead th {
  text-align: left; padding: 12px 16px; font-size: .7rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted);
  background: var(--surface2); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table tbody tr { border-bottom: 1px solid var(--border); transition: background .1s; }
.table tbody tr:hover { background: var(--hover-overlay); }
.table tbody tr:last-child { border-bottom: none; }
.table tbody td { padding: 13px 16px; vertical-align: middle; color: var(--text); }
.td-actions { display: flex; gap: 6px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: .72rem; font-weight: 600;
  padding: 3px 10px; border-radius: 99px; white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.badge-green  { background: var(--green-bg);  color: var(--green-text); } .badge-green::before  { background: var(--green); }
.badge-red    { background: var(--red-bg);    color: var(--red-text); }    .badge-red::before    { background: var(--red); }
.badge-blue   { background: var(--blue-bg);   color: var(--blue-text); }   .badge-blue::before   { background: var(--blue); }
.badge-gray   { background: var(--gray-bg);   color: var(--text-muted); } .badge-gray::before { background: var(--gray-dot); }

/* ══════════════════════════════════════════════
   MODAL
══════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(4px);
  z-index: 200; display: flex; align-items: center; justify-content: center; padding: 24px;
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
.modal {
  background: var(--surface); border: 1px solid var(--border2); border-radius: 16px;
  width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto;
  box-shadow: 0 24px 80px var(--shadow-color-strong); animation: slideUp .2s ease;
}
.modal.modal-lg { max-width: 760px; }
@keyframes slideUp { from { transform: translateY(16px); opacity: 0 } to { transform: translateY(0); opacity: 1 } }
.modal-header {
  display: flex; align-items: center; justify-content: space-between; padding: 20px 24px;
  border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface);
}
.modal-title { font-size: 1rem; font-weight: 600; }
.btn-close {
  background: none; border: none; color: var(--text-muted); font-size: 1.1rem; cursor: pointer;
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  border-radius: 6px; transition: color .12s, background .12s;
}
.btn-close:hover { color: var(--text); background: var(--surface2); }
.modal-body { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ══════════════════════════════════════════════
   ADMIN / ALUNO — LAYOUT COM SIDEBAR
══════════════════════════════════════════════ */
.admin-layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 260px; background: var(--surface); border-right: 1px solid var(--border);
  padding: 24px 16px; display: flex; flex-direction: column; gap: 6px; flex-shrink: 0;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; overflow-x: hidden;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.sidebar-logo { display: flex; align-items: center; gap: 10px; padding: 0 8px 24px; }
.sidebar-logo .logo-name { font-size: .95rem; font-weight: 700; flex: 1; }

.nav-section-label { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim); padding: 16px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text-muted); font-size: .875rem; font-weight: 500; cursor: pointer; transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--primary-glow-12); color: var(--primary); }
.nav-item svg { flex-shrink: 0; }
.sidebar-footer { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.sidebar-user { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 4px; }
.sidebar-user-name { font-size: .8rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.admin-content { flex: 1; padding: 32px 36px; max-width: 1200px; }
.admin-page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.admin-page-title { font-size: 1.4rem; font-weight: 700; }
.admin-page-desc { font-size: .82rem; color: var(--text-muted); margin-top: 3px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid .field.full { grid-column: span 2; }

.aula-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 10px 12px; border-radius: var(--radius-sm); background: none; border: none;
  color: var(--text-muted); font-size: .85rem; cursor: pointer; transition: background .12s, color .12s;
}
.aula-item:hover { background: var(--surface2); color: var(--text); }
.aula-item.active { background: var(--primary-glow-12); color: var(--primary); font-weight: 600; }
.aula-item.aula-concluida:not(.active) { color: var(--text-muted); }
.aula-item.aula-concluida:not(.active) span { text-decoration: line-through; text-decoration-color: var(--text-dim); text-decoration-thickness: 1px; }
.curso-nav-item {
  width: 100%; text-align: left; padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--surface2); border: 1px solid transparent; color: var(--text);
  font-size: .85rem; font-weight: 600; cursor: pointer; transition: border-color .12s;
}
.curso-nav-item:hover { border-color: var(--primary); }

.player-wrap { aspect-ratio: 16/9; width: 100%; max-width: 900px; background: #000; border-radius: var(--radius); overflow: hidden; box-shadow: 0 12px 40px var(--shadow-color); }
.player-wrap iframe { width: 100%; height: 100%; border: 0; }

/* ══════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════ */
@media (max-width: 900px) {
  .resumo-cards { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
  .login-card { padding: 0; }
  .resumo-cards { grid-template-columns: repeat(2, 1fr); }
  .main { padding: 20px 16px 48px; }
  .header-inner { padding: 12px 16px; }
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal, .modal.modal-lg { max-width: 100% !important; max-height: 93vh; border-radius: 16px 16px 0 0; }
}

/* ══════════════════════════════════════════════
   DASHBOARD — CARDS DE MÉTRICAS
══════════════════════════════════════════════ */
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.metric-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 22px; display: flex; flex-direction: column; gap: 10px;
}
.metric-card-top { display: flex; align-items: center; justify-content: space-between; }
.metric-icon {
  width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center;
  background: var(--primary-glow-12); color: var(--primary); flex-shrink: 0;
}
.metric-icon.green { background: var(--green-bg); color: var(--green-text); }
.metric-icon.blue  { background: var(--blue-bg); color: var(--blue-text); }
.metric-icon.yellow{ background: var(--yellow-bg); color: var(--yellow-text); }
.metric-value { font-size: 1.7rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.metric-label { font-size: .78rem; color: var(--text-muted); font-weight: 500; }

.dash-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; align-items: start; }
.dash-card-title { font-size: .95rem; font-weight: 700; margin-bottom: 4px; }
.dash-card-desc { font-size: .78rem; color: var(--text-muted); margin-bottom: 16px; }

.ranking-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border);
}
.ranking-row:last-child { border-bottom: none; }
.ranking-pos {
  width: 24px; height: 24px; border-radius: 50%; background: var(--surface2); color: var(--text-muted);
  font-size: .72rem; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.ranking-info { flex: 1; min-width: 0; }
.ranking-name { font-size: .85rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranking-sub { font-size: .72rem; color: var(--text-dim); }
.ranking-pct { font-size: .8rem; font-weight: 700; color: var(--primary); flex-shrink: 0; }

/* ══════════════════════════════════════════════
   BARRA DE PROGRESSO
══════════════════════════════════════════════ */
.progress-bar-track {
  width: 100%; height: 7px; border-radius: 99px; background: var(--surface2);
  border: 1px solid var(--border); overflow: hidden;
}
.progress-bar-fill {
  height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width .3s ease;
}
.progress-row { display: flex; align-items: center; gap: 10px; }
.progress-row .progress-bar-track { flex: 1; }
.progress-pct-label { font-size: .72rem; font-weight: 700; color: var(--text-muted); min-width: 34px; text-align: right; font-variant-numeric: tabular-nums; }

.curso-card-progress { margin-top: 6px; }

/* ══════════════════════════════════════════════
   BUSCA EM TABELAS
══════════════════════════════════════════════ */
.table-search {
  position: relative; width: 260px; max-width: 100%;
}
.table-search svg {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--text-dim); pointer-events: none;
}
.table-search input {
  padding-left: 34px;
}
@media (max-width: 560px) {
  .table-search { width: 100%; }
}

/* ══════════════════════════════════════════════
   AÇÕES EM TABELA (editar/excluir)
══════════════════════════════════════════════ */
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: var(--radius-sm);
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text-muted); cursor: pointer; transition: color .12s, border-color .12s, background .12s;
  flex-shrink: 0;
}
.btn-icon:hover { color: var(--text); border-color: var(--border2); }
.btn-icon.danger:hover { color: var(--red-text); border-color: var(--red-border); background: var(--red-bg); }
.btn-icon.primary:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-glow-08); }

/* ══════════════════════════════════════════════
   TOASTS
══════════════════════════════════════════════ */
.toast-container {
  position: fixed; top: 20px; right: 20px; z-index: 999;
  display: flex; flex-direction: column; gap: 10px; pointer-events: none;
  max-width: min(360px, calc(100vw - 40px));
}
.toast {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--surface); border: 1px solid var(--border2); border-radius: var(--radius-sm);
  box-shadow: 0 12px 36px var(--shadow-color-strong);
  padding: 13px 14px; font-size: .84rem; color: var(--text);
  animation: toastIn .2s ease;
}
.toast.leaving { animation: toastOut .18s ease forwards; }
@keyframes toastIn { from { transform: translateX(24px); opacity: 0 } to { transform: translateX(0); opacity: 1 } }
@keyframes toastOut { to { transform: translateX(24px); opacity: 0 } }
.toast-icon { flex-shrink: 0; width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-top: 1px; }
.toast-icon svg { width: 12px; height: 12px; }
.toast.success .toast-icon { background: var(--green-bg); color: var(--green-text); }
.toast.error   .toast-icon { background: var(--red-bg);   color: var(--red-text); }
.toast.info    .toast-icon { background: var(--blue-bg);  color: var(--blue-text); }
.toast-msg { flex: 1; line-height: 1.4; }
.toast-close { background: none; border: none; color: var(--text-dim); cursor: pointer; padding: 0; flex-shrink: 0; }
.toast-close:hover { color: var(--text-muted); }
@media (max-width: 560px) {
  .toast-container { left: 12px; right: 12px; top: 12px; max-width: none; }
}

/* ══════════════════════════════════════════════
   MENU MOBILE (DRAWER)
══════════════════════════════════════════════ */
.btn-menu-mobile {
  display: none; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 9px;
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); cursor: pointer; flex-shrink: 0;
}
.mobile-topbar { display: none; }
.drawer-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.55);
  z-index: 300; animation: fadeIn .15s ease;
}
.drawer-overlay.open { display: block; }

@media (max-width: 900px) {
  .admin-layout { flex-direction: column; }
  .mobile-topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 60;
  }
  .mobile-topbar .logo-name { font-weight: 700; font-size: .92rem; }
  .btn-menu-mobile { display: inline-flex; }

  .sidebar {
    position: fixed; top: 0; left: 0; height: 100vh; width: 84%; max-width: 300px;
    z-index: 310; transform: translateX(-100%); transition: transform .22s ease;
    flex-direction: column; overflow-x: hidden; box-shadow: 0 0 40px var(--shadow-color-strong);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-logo { padding: 0 8px 24px; }
  .sidebar-user { display: flex; }
  .nav-section-label { display: block; }
  .sidebar-footer { flex-direction: column; margin-left: 0; }
  .admin-content { padding: 20px 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .field.full { grid-column: span 1; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .metric-value { font-size: 1.4rem; }
}

/* ══════════════════════════════════════════════
   MINHA CONTA — avatar e trigger na sidebar
══════════════════════════════════════════════ */
.conta-avatar-row { display: flex; align-items: center; gap: 14px; padding-bottom: 4px; }
.conta-avatar {
  width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.1rem;
}
.sidebar-avatar {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .8rem;
}
.sidebar-user { gap: 10px; }
.btn-minha-conta {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-muted); font-family: var(--font); font-size: .82rem; font-weight: 500;
  padding: 7px 14px; cursor: pointer; transition: color .15s, border-color .15s; width: 100%;
}
.btn-minha-conta:hover { color: var(--text); border-color: var(--primary); }

/* ══════════════════════════════════════════════
   CONFIGURAÇÕES DA PLATAFORMA (admin)
══════════════════════════════════════════════ */
.config-color-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.color-field { display: flex; flex-direction: column; gap: 6px; }
.color-field label { font-size: .78rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.color-picker-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.color-picker-row input[type="color"] {
  width: 38px; height: 38px; border-radius: 8px; border: 1px solid var(--border2);
  padding: 0; cursor: pointer; background: none; flex-shrink: 0;
}
.color-picker-row input[type="text"] {
  border: none; background: none; padding: 4px; font-family: var(--mono); font-size: .85rem; text-transform: uppercase;
}
.config-preview {
  margin-top: 18px; border-radius: var(--radius); border: 1px solid var(--border);
  padding: 20px; display: flex; align-items: center; gap: 14px;
  background: linear-gradient(135deg, var(--primary-glow-15), var(--accent-glow-10));
}
.config-preview-mark {
  width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700;
}
.config-preview-title { font-weight: 700; font-size: 1rem; }
.config-preview-sub { font-size: .78rem; color: var(--text-muted); }
.color-swatches { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.color-swatch {
  width: 26px; height: 26px; border-radius: 50%; cursor: pointer; border: 2px solid var(--border2);
  transition: transform .1s, border-color .1s;
}
.color-swatch:hover { transform: scale(1.12); border-color: var(--text); }

/* ══════════════════════════════════════════════
   CURSOS — capa, categoria e busca (área do aluno)
══════════════════════════════════════════════ */
.curso-search { position: relative; padding: 0 4px 12px; }
.curso-search svg { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--text-dim); pointer-events: none; }
.curso-search input { padding-left: 32px; font-size: .82rem; }

.curso-nav-item-v2 {
  width: 100%; text-align: left; border-radius: var(--radius-sm); cursor: pointer;
  background: var(--surface2); border: 1px solid transparent; overflow: hidden;
  display: flex; align-items: center; gap: 10px; padding: 8px; transition: border-color .12s;
}
.curso-nav-item-v2:hover { border-color: var(--primary); }
.curso-capa-mini {
  width: 40px; height: 40px; border-radius: 7px; flex-shrink: 0; object-fit: cover;
  background: linear-gradient(135deg, var(--primary-glow-25), var(--accent-glow-10));
}
.curso-capa-mini.placeholder { display: flex; align-items: center; justify-content: center; color: var(--primary); }
.curso-nav-info { flex: 1; min-width: 0; }
.curso-nav-titulo { font-size: .85rem; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.curso-nav-categoria { font-size: .68rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: .04em; margin-top: 1px; }

.curso-capa-thumb {
  width: 44px; height: 44px; border-radius: 8px; object-fit: cover; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary-glow-25), var(--accent-glow-10));
}
.curso-capa-thumb.placeholder { display: flex; align-items: center; justify-content: center; color: var(--primary); font-size: 1.1rem; }
.tabela-curso-titulo-row { display: flex; align-items: center; gap: 10px; }

.btn-certificado {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 8px;
  background: var(--yellow-bg); color: var(--yellow-text); border: 1px solid var(--yellow-bg);
  border-radius: var(--radius-sm); font-size: .74rem; font-weight: 700;
  padding: 5px 10px; cursor: pointer; transition: filter .15s;
}
.btn-certificado:hover { filter: brightness(1.1); }

/* ══════════════════════════════════════════════
   CERTIFICADO DE CONCLUSÃO
══════════════════════════════════════════════ */
.cert-actions { display: flex; justify-content: flex-end; gap: 10px; margin-bottom: 14px; }
.certificado {
  background: var(--surface); border-radius: 16px; box-shadow: 0 24px 80px var(--shadow-color-strong);
  padding: 10px;
}
.cert-border {
  border: 2px solid var(--primary); outline: 1px solid var(--border2); outline-offset: -8px;
  border-radius: 12px; padding: 56px 48px; text-align: center;
  background:
    radial-gradient(circle at top left, var(--primary-glow-08), transparent 55%),
    radial-gradient(circle at bottom right, var(--accent-glow-10), transparent 55%);
}
.cert-kicker { font-size: .74rem; letter-spacing: .18em; text-transform: uppercase; color: var(--text-muted); font-weight: 700; }
.cert-mark { margin: 18px auto 6px; width: 44px; }
.cert-texto { font-size: .9rem; color: var(--text-muted); margin-top: 14px; }
.cert-nome { font-family: var(--font-display); font-size: 1.9rem; font-weight: 700; color: var(--primary); margin: 8px 0; }
.cert-curso { font-size: 1.15rem; font-weight: 700; color: var(--text); margin-top: 6px; }
.cert-data { font-size: .78rem; color: var(--text-dim); margin-top: 22px; }
.cert-footer-line { width: 160px; height: 1px; background: var(--border2); margin: 18px auto 10px; }
.cert-assinatura { font-size: .82rem; font-weight: 700; color: var(--text-muted); }

@media print {
  body * { visibility: hidden; }
  .certificado, .certificado * { visibility: visible; }
  .certificado { position: fixed; top: 0; left: 0; width: 100%; box-shadow: none; }
  .no-print { display: none !important; }
}
@media (max-width: 560px) {
  .cert-border { padding: 32px 20px; }
  .cert-nome { font-size: 1.4rem; }
  .config-color-grid { grid-template-columns: 1fr; }
}
