/* Academia X2U (Exaclean) — cores da marca Exaclean: azul #0058a8 e azul-claro #00acec */
:root {
  --brand: #0058a8;        /* cor principal */
  --brand-2: #00a3e0;      /* cor secundária */
  --brand-soft: #e6f2fb;
  --ink: #17212b;
  --muted: #637282;
  --line: #e3e8ec;
  --bg: #f5f7f8;
  --card: #fff;
  --ok: #1d8a4e;
  --erro: #c23b32;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 4px 16px rgba(16,24,40,.06);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); line-height: 1.5; font-size: 16px; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.9rem; line-height: 1.2; margin: .2em 0 .5em; letter-spacing: -.01em; }
h2 { font-size: 1.3rem; margin: 1.6em 0 .7em; }
h3 { font-size: 1.05rem; margin: 0 0 .5em; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.main { padding-top: 24px; padding-bottom: 60px; min-height: 70vh; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .erro { color: var(--erro); } .ok { color: var(--ok); }
code { background: #eef1f3; padding: 1px 5px; border-radius: 4px; font-size: .85em; }
code.big { font-size: 1.1rem; padding: 3px 8px; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; width: 100%; }

/* topo */
.topbar { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.is-admin .topbar { background: var(--ink); border-color: var(--ink); }
.is-admin .topbar a, .is-admin .brand { color: #fff; }
.topbar-in { display: flex; align-items: center; gap: 20px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); font-size: 1.05rem; }
.brand:hover { text-decoration: none; }
.brand-logo { height: 44px; width: auto; display: block; border-radius: 6px; }
.is-admin .brand-logo { background: #fff; padding: 3px 6px; height: 46px; }
.brand-tag { font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; opacity: .7; }
.logo { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; font-weight: 800; }
.nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav a { padding: 8px 9px; border-radius: 8px; color: var(--ink); font-size: .93rem; white-space: nowrap; }
.nav a:hover { background: var(--brand-soft); text-decoration: none; }
.is-admin .nav a:hover { background: rgba(255,255,255,.1); }
.nav a.active { color: var(--brand); font-weight: 600; }
.is-admin .nav a.active { color: #9fd3f0; }
.nav .nav-alt { border: 1px solid var(--line); }
.is-admin .nav .nav-alt { border-color: rgba(255,255,255,.25); }
.nav-user { font-weight: 600; }
.nav-out { color: var(--muted) !important; }
.menu-btn { display: none; margin-left: auto; background: none; border: 0; font-size: 1.5rem; cursor: pointer; color: inherit; }
.is-admin .menu-btn { color: #fff; }

/* botões */
.btn { display: inline-block; background: var(--brand); color: #fff; border: 0; border-radius: 9px; padding: 10px 18px; font-size: .95rem; font-weight: 600; cursor: pointer; text-align: center; }
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn-sm { padding: 7px 14px; font-size: .88rem; }
.btn-ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn-ok { background: var(--ok); }
.link, .link-danger { background: none; border: 0; padding: 0 4px; cursor: pointer; font: inherit; color: var(--brand-2); }
.link-danger { color: var(--erro); }
.link:disabled { color: #c5ccd3; cursor: default; }
.pill { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 2px 10px; font-size: .8rem; cursor: pointer; color: var(--muted); }
.pill-ok { background: #e5f6ec; border-color: #bfe6cf; color: var(--ok); }
form.inline { display: inline; }

/* mensagens */
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; background: #e5f6ec; border: 1px solid #bfe6cf; }
.flash-erro { background: #fdecea; border-color: #f5c6c1; color: #8a1f17; }
.flash-info { background: #eaf3fb; border-color: #c6dcf0; }
.flash textarea { margin-top: 8px; }
.empty { padding: 50px 20px; text-align: center; color: var(--muted); background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); }

/* hero */
.hero { display: grid; grid-template-columns: 1.2fr 1fr; gap: 40px; align-items: center; padding: 40px 44px; margin-bottom: 12px; border-radius: 20px; color: #fff;
  background: radial-gradient(circle at 85% 20%, rgba(255,255,255,.15), transparent 40%), linear-gradient(135deg, var(--brand), var(--brand-2)); }
.hero h1 { font-size: 2.6rem; margin: .1em 0 .3em; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; opacity: .85; margin: 0; }
.lead { font-size: 1.1rem; opacity: .95; max-width: 60ch; }
.content-head .lead { opacity: 1; color: var(--muted); }
.hero-cta { display: flex; gap: 10px; margin-top: 20px; }
.hero .btn { background: #fff; color: var(--brand); }
.hero .btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.5); }
.hero-art { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.hero-tile { background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.25); border-radius: 16px; padding: 22px 16px; font-size: 1.8rem; display: flex; flex-direction: column; gap: 6px; backdrop-filter: blur(2px); }
.hero-tile span { font-size: .95rem; font-weight: 600; }
.hero-tile.t2, .hero-tile.t3 { transform: translateY(14px); }

/* grelha e cartões */
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sec-head h1, .sec-head h2 { margin-bottom: .5em; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.card { display: flex; flex-direction: column; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; color: var(--ink); transition: transform .15s; height: 100%; }
.card:hover { transform: translateY(-2px); text-decoration: none; }
.card-capa { aspect-ratio: 16/9; background: var(--brand-soft); }
.card-capa img { width: 100%; height: 100%; object-fit: cover; display: block; }
.capa-ph { width: 100%; height: 100%; display: grid; place-items: center; font-size: 3rem; font-weight: 800; color: rgba(255,255,255,.9); background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
.capa-mini { background: linear-gradient(135deg, #d98a1c, #c4502b); }
.capa-lancamento { background: linear-gradient(135deg, #6b46c1, #b83280); }
.capa-video { background: linear-gradient(135deg, #1f2937, #0b5f8a); }
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card-body h3 { margin: 4px 0 0; }
.card-body p { margin: 0; font-size: .92rem; }
.meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: .9rem; margin-top: 4px; }
.badge { display: inline-block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 2px 8px; border-radius: 6px; background: var(--brand-soft); color: var(--brand); }
.badge-mini { background: #fdf0e1; color: #b0651a; }
.badge-lancamento { background: #f1eafd; color: #6b46c1; }
.badge-video { background: #e6eef6; color: #0b5f8a; }
.badge-draft { background: #f0f1f3; color: var(--muted); }
.bar { height: 6px; background: #edf0f2; border-radius: 9px; overflow: hidden; margin-top: 8px; }
.bar span { display: block; height: 100%; background: var(--brand); border-radius: 9px; }
.bar.big { height: 10px; }

/* páginas de conteúdo */
.crumbs { font-size: .88rem; color: var(--muted); margin: 0 0 6px; }
.content-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin-bottom: 20px; }
.layout-2 { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.panel { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; margin-bottom: 18px; }
.sticky { position: sticky; top: 84px; }
.video { position: relative; aspect-ratio: 16/9; border-radius: var(--radius); overflow: hidden; background: #000; margin-bottom: 18px; box-shadow: var(--shadow); }
.video iframe, .video video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.prose { font-size: 1.02rem; } .prose p:first-child { margin-top: 0; } .prose h3 { margin-top: 1.2em; }
.files { list-style: none; padding: 0; margin: 0; } .files li { padding: 6px 0; border-bottom: 1px solid var(--line); } .files li:last-child { border: 0; }
.lessons { list-style: none; padding: 0; margin: 14px 0 0; border-top: 1px solid var(--line); }
.lessons li a { display: flex; align-items: center; gap: 10px; padding: 9px 0; color: var(--ink); border-bottom: 1px solid var(--line); font-size: .94rem; }
.lessons .chk { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: .75rem; color: #fff; }
.lessons li.done .chk { background: var(--ok); border-color: var(--ok); }
.lesson-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 10px; }

/* quiz */
.quiz fieldset { border: 0; }
.quiz legend { font-weight: 600; padding: 0; margin-bottom: 8px; float: left; width: 100%; }
.opt { display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; margin-bottom: 8px; cursor: pointer; clear: both; }
.opt:hover { border-color: var(--brand); }
.result.ok { border-left: 5px solid var(--ok); } .result.ko { border-left: 5px solid var(--erro); }
.q.ok { border-left: 4px solid var(--ok); } .q.ko { border-left: 4px solid var(--erro); }
.opts li.ok { color: var(--ok); font-weight: 600; }

/* formulários */
.narrow { max-width: 520px; margin: 20px auto; }
.form label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 14px; }
.form input:not([type=checkbox]):not([type=radio]), .form select, .form textarea, .filters input, .filters select, .table input {
  display: block; width: 100%; margin-top: 5px; padding: 9px 11px; border: 1px solid #cfd6dc; border-radius: 8px; font: inherit; font-weight: 400; background: #fff; }
.form textarea { resize: vertical; }
.form input:focus, .form select:focus, .form textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
.hint { display: block; font-weight: 400; color: var(--muted); font-size: .82rem; margin-top: 4px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 16px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-bottom: 14px; align-items: center; }
.checks label, .form label.check { font-weight: 500; display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.form-actions { display: flex; gap: 12px; align-items: center; margin-top: 6px; }
.opt-row { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.opt-row .radio { margin: 0; white-space: nowrap; font-weight: 500; display: inline-flex; gap: 4px; }
.opt-row input:not([type=radio]) { margin-top: 0 !important; }
.row-form { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.row-form label { flex: 1; min-width: 220px; margin-bottom: 0; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; align-items: center; }
.filters input, .filters select { width: auto; margin: 0; min-width: 200px; }
.filters input[type=search] { flex: 1; }
details summary { cursor: pointer; }

/* tabelas */
.table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); margin-bottom: 18px; }
.panel .table { box-shadow: none; }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #fafbfc; }
.table .num { text-align: right; }
.table .actions { white-space: nowrap; text-align: right; }
.table .actions a { margin-left: 8px; }
.table tr.inactive td { opacity: .55; }
.tree-mark { color: #b5c0ca; }
.table .bar { width: 120px; margin: 0 0 2px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: #fff; border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 1.8rem; line-height: 1.1; }
.stat span { color: var(--muted); font-size: .85rem; }
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 6px 0 20px; flex-wrap: wrap; }
.tabs a { padding: 10px 16px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; }
.tabs a.active { color: var(--brand); border-color: var(--brand); }
.tabs .tab-view { margin-left: auto; }

.footer { border-top: 1px solid var(--line); padding: 22px 0; color: var(--muted); font-size: .85rem; background: #fff; }
.footer-in { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.footer-logo { height: 40px; width: auto; display: block; }

/* certificado */
.cert-page { margin: 0; }
.cert-actions { text-align: center; padding: 18px; display: flex; gap: 10px; justify-content: center; }
.cert { width: 297mm; height: 210mm; margin: 0 auto 30px; background: #fff; padding: 14mm; box-shadow: var(--shadow); }
.cert-in { height: 100%; border: 3px solid var(--brand); outline: 1px solid var(--brand); outline-offset: -9px; border-radius: 6px; text-align: center; padding: 14mm 20mm; display: flex; flex-direction: column; justify-content: center; position: relative; }
.cert-brand { position: absolute; top: 10mm; left: 0; right: 0; display: flex; justify-content: center; }
.cert-brand img { height: 22mm; width: auto; }
.cert-small { letter-spacing: .3em; color: var(--brand); font-weight: 700; font-size: .95rem; }
.cert-name { font-size: 2.6rem; margin: .1em 0; font-family: Georgia, "Times New Roman", serif; }
.cert-course { font-size: 1.6rem; margin: .2em 0 .4em; color: var(--brand); }
.cert-meta { color: var(--muted); }
.cert-foot { position: absolute; bottom: 12mm; left: 20mm; right: 20mm; display: flex; justify-content: space-between; align-items: flex-end; font-size: .85rem; }
.cert-sign { text-align: center; } .cert-sign img { height: 11mm; width: auto; display: block; margin: 0 auto; }
.sig { width: 60mm; border-bottom: 1px solid var(--ink); height: 14mm; margin-bottom: 4px; }
.cert-code { text-align: right; color: var(--muted); } .cert-code b { color: var(--ink); font-size: 1rem; letter-spacing: .1em; } .cert-code span { font-size: .7rem; }
@media print {
  .no-print { display: none !important; }
  body, .cert-page { background: #fff !important; }
  .cert { box-shadow: none; margin: 0; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* telemóvel */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding: 28px 24px; } .hero h1 { font-size: 2rem; } .hero-art { display: none; }
  .layout-2, .cols-2 { grid-template-columns: 1fr; }
  .sticky { position: static; }
  .table { display: block; overflow-x: auto; }
  .content-head { flex-direction: column; }
}

/* estatísticas */
.stats-6 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; flex-wrap: wrap; }
.seg a { padding: 6px 12px; font-size: .85rem; color: var(--muted); border-right: 1px solid var(--line); }
.seg a:last-child { border-right: 0; }
.seg a.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.seg a:hover { text-decoration: none; background: #f5f8fa; }
.chart-wrap { position: relative; margin: 8px 0 6px; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: #edf0f2; stroke-width: 1; }
.chart .grid.base { stroke: #c9d1d8; }
.chart .ax { font-size: 12px; fill: var(--muted); }
.chart .bar { fill: var(--brand); }
.chart .hit { fill: transparent; }
.chart .bar-g:hover .bar { fill: #00468a; }
.chart .bar-g:hover .hit { fill: rgba(0, 88, 168, .05); }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: #fff; font-size: .8rem; padding: 5px 9px; border-radius: 6px; white-space: nowrap; transform: translate(-50%, -120%); }
.hbars { display: flex; flex-direction: column; gap: 10px; }
.hbar { display: grid; grid-template-columns: 120px 1fr 44px; align-items: center; gap: 10px; font-size: .9rem; }
.hb-t { height: 12px; background: #edf0f2; border-radius: 4px; overflow: hidden; }
.hb-t span { display: block; height: 100%; background: var(--brand); border-radius: 0 4px 4px 0; }
.hb-v { text-align: right; font-variant-numeric: tabular-nums; }

/* app instalável */
.install-btn { display: none; }
.can-install .install-btn { display: inline-block; }
.ios-hint { position: fixed; left: 12px; right: 12px; bottom: 12px; background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; font-size: .9rem; z-index: 50; box-shadow: var(--shadow); }
.ios-hint button { background: none; border: 0; color: #9fd3f0; float: right; font: inherit; cursor: pointer; }

/* sugestões */
.estado { font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: #f0f1f3; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.estado-analise { background: #eaf3fb; color: var(--brand); }
.estado-planeada { background: #fdf0e1; color: #b0651a; }
.estado-feita { background: #e5f6ec; color: var(--ok); }
.estado-recusada { background: #fdecea; color: #8a1f17; }
.resposta { border-left: 3px solid var(--brand); padding: 6px 12px; background: var(--brand-soft); border-radius: 0 8px 8px 0; margin-top: 8px; font-size: .92rem; }

.sug { padding: 10px 0; border-bottom: 1px solid var(--line); } .sug:last-child { border: 0; } .sug p { margin: 0 0 4px; }
a.stat { color: var(--ink); } a.stat:hover { text-decoration: none; box-shadow: 0 0 0 2px var(--brand-soft), var(--shadow); }

/* menu compacto (telemóvel, tablet e backoffice em ecrãs médios) */
@media (max-width: 1180px) {
  .menu-btn { display: block; }
  .nav { display: none; position: absolute; top: 64px; left: 0; right: 0; background: #fff; flex-direction: column; align-items: stretch; padding: 10px 20px 16px; border-bottom: 1px solid var(--line); box-shadow: var(--shadow); }
  .is-admin .nav { background: var(--ink); }
  .nav-open .nav { display: flex; }
  .topbar-in { position: relative; }
}
