:root {
  --navy: #1e2761;
  --navy-dark: #14193f;
  --ice: #cadcfc;
  --white: #ffffff;
  --bg: #f4f6fb;
  --text: #1f2430;
  --muted: #6b7280;
  --border: #e3e7f1;

  --ok: #1a9e6b;
  --ok-bg: #e4f7ee;
  --warn: #b8860b;
  --warn-bg: #fdf3dc;
  --info: #2f6fed;
  --info-bg: #e8f0fe;
  --danger: #c23b3b;
  --danger-bg: #fbe9e9;
  --grey: #6b7280;
  --grey-bg: #eef0f4;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--navy); }

/* ---------- Auth pages ---------- */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-dark) 100%);
  padding: 20px;
}

.auth-box {
  background: var(--white);
  border-radius: 12px;
  padding: 36px 32px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}

.auth-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 18px;
}
.auth-logo img {
  max-height: 48px;
  max-width: 220px;
  object-fit: contain;
}

.auth-footer-logo {
  display: flex;
  justify-content: center;
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.auth-footer-logo img {
  max-height: 26px;
  max-width: 150px;
  object-fit: contain;
  opacity: 0.85;
}

.auth-box h1 {
  font-size: 20px;
  margin: 0 0 8px;
  color: var(--navy);
  text-align: center;
}

.auth-box .subtitle {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 20px;
}

.auth-box form label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.auth-box input[type=email] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
}

.auth-box button {
  width: 100%;
  padding: 11px;
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.auth-box button:hover { background: var(--navy-dark); }

/* ---------- Alerts ---------- */
.alert {
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
}
.alert-ok { background: var(--ok-bg); color: var(--ok); }
.alert-erro { background: var(--danger-bg); color: var(--danger); }
.alert-dev { background: var(--info-bg); color: var(--info); word-break: break-all; }

/* ---------- Topbar ---------- */
.topbar {
  background: var(--navy);
  color: var(--white);
}
.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.brand {
  color: var(--white) !important;
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  margin-right: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-logo {
  background: var(--white);
  border-radius: 6px;
  padding: 5px 9px;
  display: flex;
  align-items: center;
  line-height: 0;
}
.brand-logo img {
  max-height: 22px;
  max-width: 110px;
  object-fit: contain;
  display: block;
}
.brand-logo.logo-fallback { display: none; }
.brand-text { white-space: nowrap; }
.topnav a {
  color: var(--ice) !important;
  text-decoration: none;
  font-size: 13px;
  margin-right: 18px;
  font-weight: 600;
}
.topnav a:hover { color: var(--white) !important; }
.topbar-user {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
}
.topbar-user .logout {
  color: var(--ice) !important;
  text-decoration: none;
  font-weight: 600;
}

.content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

.footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 28px 20px 20px;
  border-top: 1px solid var(--border);
  margin-top: 20px;
}
.footer-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
}
.footer-logo img {
  max-height: 28px;
  max-width: 150px;
  object-fit: contain;
  opacity: 0.9;
}
.footer-logo.logo-fallback { display: none; }

/* ---------- Page headers ---------- */
.page-title { font-size: 22px; margin: 0 0 4px; color: var(--navy); }
.page-subtitle { color: var(--muted); font-size: 13px; margin: 0 0 20px; }
.page-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

/* ---------- Dashboard summary ---------- */
.dash-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
.summary-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.summary-number {
  font-size: 30px;
  font-weight: 700;
  color: var(--navy);
}
.summary-label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}
.summary-progress { justify-content: center; }

.progress-bar-wrap {
  background: var(--grey-bg);
  border-radius: 999px;
  height: 10px;
  width: 100%;
  overflow: hidden;
  margin-bottom: 6px;
}
.progress-bar-wrap.small { height: 7px; width: 140px; }
.progress-bar {
  background: linear-gradient(90deg, var(--info), var(--ok));
  height: 100%;
  border-radius: 999px;
  transition: width .3s ease;
}

/* Cores do progresso conforme percentual concluído */
.progress-bar.perc-low  { background: var(--danger); }
.progress-bar.perc-mid  { background: var(--warn); }
.progress-bar.perc-high { background: var(--info); }
.progress-bar.perc-done { background: var(--ok); }

/* ---------- Grade visual "Progresso por Tópico" ---------- */
.section-title {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0 0 14px;
}

.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 32px;
}

.topic-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  text-decoration: none;
  color: var(--text);
  display: block;
  transition: box-shadow .15s ease, transform .15s ease;
}
.topic-card:hover {
  box-shadow: 0 6px 18px rgba(30,39,97,0.12);
  transform: translateY(-2px);
}

.topic-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.topic-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.3;
}
.topic-warning {
  color: var(--warn);
  font-size: 14px;
  flex-shrink: 0;
}

.topic-perc {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 8px;
}
.topic-perc.perc-low  { color: var(--danger); }
.topic-perc.perc-mid  { color: var(--warn); }
.topic-perc.perc-high { color: var(--info); }
.topic-perc.perc-done { color: var(--ok); }

.topic-bar { height: 8px; margin-bottom: 8px; }

.topic-count {
  font-size: 11px;
  color: var(--muted);
}

/* ---------- Trilha cards ---------- */
.trilha-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 20px;
  overflow: hidden;
}
.trilha-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.trilha-header h2 {
  font-size: 15px;
  margin: 0;
  color: var(--navy);
}
.trilha-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}

/* ---------- Table ---------- */
.task-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.task-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.task-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.task-table tr:last-child td { border-bottom: none; }
.col-check { width: 32px; }
.col-actions { white-space: nowrap; }
.col-actions a { margin-right: 12px; font-size: 12px; }

.task-title { font-weight: 600; }
.task-desc { color: var(--muted); font-size: 12px; margin-top: 3px; max-width: 420px; }
.task-row.task-done .task-title { text-decoration: line-through; color: var(--muted); }
.task-row.task-overdue td { background: #fff8f2; }
.tag-atrasado {
  display: inline-block;
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 6px;
  margin-left: 6px;
  font-weight: 600;
  vertical-align: middle;
}

.task-checkbox {
  width: 17px;
  height: 17px;
  cursor: pointer;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.badge-pendente     { background: var(--grey-bg); color: var(--grey); }
.badge-planejado    { background: var(--info-bg); color: var(--info); }
.badge-agendado     { background: var(--warn-bg); color: var(--warn); }
.badge-andamento    { background: #eee6fb; color: #6b3fd4; }
.badge-concluido    { background: var(--ok-bg); color: var(--ok); }

.prio {
  font-size: 11px;
  font-weight: 700;
}
.prio-baixa   { color: var(--grey); }
.prio-media   { color: var(--info); }
.prio-alta    { color: var(--warn); }
.prio-critica { color: var(--danger); }

/* ---------- Panels & forms ---------- */
.panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
}
.panel h2 { font-size: 15px; margin: 0 0 14px; color: var(--navy); }

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.inline-form input, .inline-form select {
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
}
.inline-form button {
  padding: 9px 16px;
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.stack-form { display: flex; flex-direction: column; gap: 14px; max-width: 640px; }
.stack-form label { font-size: 13px; font-weight: 600; display: flex; flex-direction: column; gap: 6px; }
.stack-form input, .stack-form select, .stack-form textarea {
  font-weight: 400;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
}
.form-row { display: flex; gap: 14px; flex-wrap: wrap; }
.form-row label { flex: 1; min-width: 140px; }
.form-actions { display: flex; gap: 10px; margin-top: 6px; }

.btn {
  display: inline-block;
  background: var(--navy);
  color: var(--white) !important;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
}
.btn-secondary {
  display: inline-block;
  background: var(--grey-bg);
  color: var(--text) !important;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.inline-action { display: inline; }
.link-btn {
  background: none;
  border: none;
  color: var(--info);
  cursor: pointer;
  font-size: 12px;
  padding: 0;
  text-decoration: underline;
}
.link-danger { color: var(--danger); }

@media (max-width: 720px) {
  .dash-summary { grid-template-columns: repeat(2, 1fr); }
  .task-table { font-size: 12px; }
}
