/* ===== Moura Lacerda — Portal do Aluno ===== */
:root {
  --bordeaux: #7a1f2b;
  --bordeaux-dark: #5e1620;
  --bordeaux-light: #9a3341;
  --yellow: #f4c430;
  --yellow-soft: #fdf3d3;
  --navy: #16223c;
  --navy-soft: #24345a;
  --green: #1f9d55;
  --green-soft: #e4f6ec;
  --blue: #2563c9;
  --blue-soft: #e6effb;
  --amber: #b7791f;
  --amber-soft: #fbf0d6;
  --white: #ffffff;
  --bg: #f4f5f8;
  --surface: #ffffff;
  --text: #1e2433;
  --text-muted: #6b7280;
  --border: #e7e9ef;
  --shadow: 0 1px 2px rgba(22, 34, 60, .06), 0 6px 18px rgba(22, 34, 60, .06);
  --shadow-lg: 0 10px 40px rgba(22, 34, 60, .18);
  --radius: 16px;
  --radius-sm: 10px;
  --sidebar-w: 250px;
  --header-h: 60px;
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

/* ===== Tema "calmo" (cromoterapia) =====
   Usado só nas telas de conversão/tensão (inscrição, landing e o modal de
   pagamento) — o portal em si (Início, Financeiro, Carteirinha etc.) segue
   com a identidade institucional (bordô) normalmente.
   Azul acalma e reduz ansiedade, verde traz equilíbrio, violeta ajuda a
   esvaziar pensamentos acelerados — por isso substituem o bordô/dourado
   "sério" nessas telas. Como todo o site já usa variáveis de cor, redeclarar
   só isso aqui re-pinta automaticamente botões, cards, badges etc. */
.calm-theme {
  --bordeaux: #2e7cd6;       /* azul calmante — cor principal (botões, links, foco) */
  --bordeaux-dark: #5b4fa6;  /* violeta — usado nos degradês junto do azul */
  --bordeaux-light: #6fb1e8;
  --yellow: #8d7ee0;         /* violeta claro — selos/destaques (era dourado) */
  --yellow-soft: #efeafc;
  --navy: #33305e;           /* azul-violeta escuro — títulos e valores */
  --navy-soft: #4a4480;
  --green: #2fae72;          /* verde — equilíbrio/harmonia */
  --green-soft: #e5f8ee;
  --blue: #3c8ce0;
  --blue-soft: #e7f2fc;
  --amber: #7a6bc9;          /* violeta — estados de espera (era âmbar) */
  --amber-soft: #efeafc;
  --bg: #f4f8fc;
  --text: #33415a;
  --text-muted: #6b7c93;
  --border: #dce6f2;
  --shadow: 0 1px 2px rgba(46,124,214,.08), 0 6px 18px rgba(46,124,214,.08);
  --shadow-lg: 0 10px 40px rgba(46,124,214,.20);
  --radius: 20px;
  --radius-sm: 14px;
}
.calm-theme .field input:focus,
.calm-theme .field select:focus,
.calm-theme .field textarea:focus { box-shadow: 0 0 0 3px rgba(46,124,214,.15); }
.calm-theme .enroll-head::after { background: rgba(255,255,255,.16); }
.calm-theme .demo-banner,
.calm-theme .payment-status { border-color: #d9d2f5; }
.calm-theme .req { color: #d1567f; }

/* ===== Tema "landing" =====
   Usado em /instalar.php — a mesma identidade visual da landing page
   (azul e menta, fonte arredondada), para a instalação do app parecer
   uma continuação natural da página que trouxe a pessoa até aqui, e não
   uma tela técnica separada. Mesmo mecanismo do .calm-theme acima: como
   os componentes já leem tudo de variável, só redeclarar aqui repinta
   botões, cards e ícones sozinho. */
.lp-install-theme {
  --bordeaux: #1B6FC4;
  --bordeaux-dark: #155A9F;
  --bordeaux-light: #2588E8;
  --yellow-soft: #EEFCF7;
  --navy: #12325B;
  --blue: #2588E8;
  --blue-soft: #EDF7FF;
  --bg: #EDF7FF;
  --text: #21334A;
  --text-muted: #607086;
  --border: #DCE8F1;
  --shadow: 0 2px 6px rgba(18, 50, 91, .05), 0 12px 28px rgba(18, 50, 91, .07);
  --shadow-lg: 0 8px 20px rgba(18, 50, 91, .08), 0 24px 48px rgba(18, 50, 91, .09);
  --radius: 22px;
  --radius-sm: 14px;
  font-family: ui-rounded, "SF Pro Rounded", "Segoe UI Variable Display", "Segoe UI",
               system-ui, -apple-system, "Nunito Sans", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ===== Layout ===== */
.app { display: flex; min-height: 100vh; }

/* ===== Sidebar ===== */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--bordeaux) 0%, var(--bordeaux-dark) 100%);
  color: #fff;
  position: fixed;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
  z-index: 50;
  transition: transform .28s ease;
}
.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.brand-logo {
  width: 42px; height: 42px; flex: none;
  border-radius: 11px;
  background: var(--yellow);
  color: var(--bordeaux-dark);
  display: grid; place-items: center;
  font-weight: 800; font-size: 18px;
  letter-spacing: -1px;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.35);
  overflow: hidden;
}
.brand-logo img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.brand-text b { display: block; font-size: 15px; line-height: 1.15; }
.brand-text span { font-size: 11px; opacity: .8; letter-spacing: .5px; }

.nav { padding: 14px 12px; flex: 1; overflow-y: auto; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; margin-bottom: 4px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.82);
  font-weight: 500; font-size: 14px;
  transition: background .15s, color .15s;
}
.nav a .ic { width: 20px; height: 20px; flex: none; }
.nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav a.active {
  background: #fff; color: var(--bordeaux);
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(0,0,0,.15);
}
.nav a.active .ic { color: var(--bordeaux); }
.sidebar-foot {
  padding: 10px 12px;
  border-top: 1px solid rgba(255,255,255,.12);
}
.sidebar-foot a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.82);
  font-weight: 500; font-size: 14px;
  transition: background .15s, color .15s;
}
.sidebar-foot a .ic { width: 20px; height: 20px; flex: none; }
.sidebar-foot a:hover { background: rgba(255,255,255,.1); color: #fff; }

/* ===== Main ===== */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ===== Header ===== */
.header {
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  gap: 14px; padding: 0 22px;
  position: sticky; top: 0; z-index: 40;
}
.header h1 { font-size: 17px; margin: 0; font-weight: 700; }
.header .spacer { flex: 1; }
.burger {
  display: none;
  background: none; border: none;
  width: 40px; height: 40px;
  border-radius: 10px;
  cursor: pointer; color: var(--bordeaux);
  align-items: center; justify-content: center;
}
.burger:hover { background: var(--bg); }
.header-user {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 6px 5px 12px;
  background: var(--bg);
  border-radius: 999px;
}
.header-user .u-name { font-size: 13px; font-weight: 600; }
.header-user .u-sub { font-size: 11px; color: var(--text-muted); }
.header-user .avatar { width: 34px; height: 34px; font-size: 13px; }
.header-avatar-trigger {
  display: flex; cursor: pointer; border-radius: 50%;
  transition: transform .15s ease;
}
.header-avatar-trigger:hover { transform: scale(1.06); }
.header-avatar-trigger:active { transform: scale(.95); }
.header-avatar-trigger:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(122,31,43,.35); }

/* ===== Content ===== */
.content { padding: 22px; max-width: 1080px; width: 100%; }
.page-head { margin-bottom: 18px; }
.page-head h2 { margin: 0 0 2px; font-size: 22px; }
.page-head p { margin: 0; color: var(--text-muted); font-size: 13px; }

/* ===== Avatar ===== */
.avatar {
  width: 56px; height: 56px; flex: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--bordeaux) 0%, var(--bordeaux-light) 100%);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 20px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.4);
}
.avatar img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; object-position: center;
  border-radius: 50%; display: block;
}

/* Avatar clicável (abre a foto ampliada) */
.avatar-trigger {
  background: none; border: none; padding: 0; margin: 0; cursor: pointer;
  border-radius: 50%;
  transition: transform .15s ease, box-shadow .15s ease;
}
.avatar-trigger:hover { transform: scale(1.04); }
.avatar-trigger:active { transform: scale(.97); }
.avatar-trigger:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(122,31,43,.35); }

/* ===== Cards ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-auto { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

/* Hero / student summary */
.hero {
  background: linear-gradient(120deg, var(--bordeaux) 0%, var(--bordeaux-dark) 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 22px;
  display: flex; align-items: center; gap: 18px;
  box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; right: -40px; top: -40px;
  width: 180px; height: 180px; border-radius: 50%;
  background: rgba(244,196,48,.18);
}
.hero .avatar {
  width: 72px; height: 72px; font-size: 26px;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.5);
}
.hero-info { z-index: 1; }
.hero-info h2 { margin: 0 0 4px; font-size: 22px; }
.hero-info p { margin: 0; opacity: .9; font-size: 13px; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 8px;
  background: rgba(255,255,255,.15);
  padding: 4px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
}
.hero-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--yellow); }

/* Stat cards (Financeiro: só rótulo em cima, valor embaixo — sem ícone) */
.stat {
  display: flex; flex-direction: column; gap: 6px;
  position: relative; min-width: 0;
}
.stat .stat-val {
  font-size: 20px; font-weight: 800; line-height: 1.2; color: var(--navy);
  overflow-wrap: anywhere;
}
.stat .stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }

/* Stat cards com ícone (Início) — ícone + texto lado a lado */
.stat-icon { flex-direction: row; align-items: center; gap: 12px; }
.stat-icon .stat-ic {
  width: 42px; height: 42px; border-radius: 12px; flex: none;
  display: grid; place-items: center;
}
.stat-icon .stat-ic.b1 { background: var(--yellow-soft); color: var(--amber); }
.stat-icon .stat-ic.b2 { background: var(--green-soft); color: var(--green); }
.stat-icon .stat-ic.b3 { background: var(--blue-soft); color: var(--blue); }
.stat-icon .stat-ic.b4 { background: var(--bordeaux); color: #fff; opacity:.92; }
.stat-icon .stat-text { min-width: 0; }
.stat-icon .stat-val { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-icon .stat-label { font-size: 11.5px; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Cartões de estatística clicáveis (levam para a seção correspondente) */
.stat-link {
  cursor: pointer;
  padding-right: 34px; /* espaço reservado pro chevron não sobrepor o texto */
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.stat-link:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: rgba(122,31,43,.18); }
.stat-link:active { transform: translateY(0); }
.stat-link:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(122,31,43,.3); }
.stat-chevron {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); opacity: .55; flex: none;
}
.stat-chevron .ic { width: 16px; height: 16px; display: block; }

.section-title { font-size: 15px; font-weight: 700; margin: 0 0 12px; color: var(--navy); }

/* Info list */
.info-list { display: grid; gap: 0; min-width: 0; }
.info-row {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 14px;
  padding: 11px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 14px;
}
.info-row:last-child { border-bottom: none; }
.info-row .k { color: var(--text-muted); flex: none; }
.info-row .v {
  font-weight: 600; text-align: right;
  min-width: 0; overflow-wrap: anywhere; word-break: break-word;
}

/* Notices */
.notice {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 10px;
  background: var(--white);
}
.notice:last-child { margin-bottom: 0; }
.notice .n-ic { width: 34px; height: 34px; border-radius: 9px; flex: none; display: grid; place-items: center; }
.notice.info .n-ic { background: var(--blue-soft); color: var(--blue); }
.notice.success .n-ic { background: var(--green-soft); color: var(--green); }
/* Vencimento do acesso: 'atencao' a partir de 14 dias, 'alerta' nos
   últimos 7 e depois de vencido. */
/* O disquinho do ícone precisa ser mais forte que o fundo do cartão,
   senão os dois têm a mesma cor e o ícone some. */
.notice.atencao .n-ic { background: #f6e3b4; color: #8a5a12; }
.notice.alerta  .n-ic { background: #f9cfcf; color: #a5301f; }
.notice.atencao { background: var(--amber-soft); border-radius: 12px; padding: 10px; }
.notice.alerta  { background: #fdeaea; border-radius: 12px; padding: 10px; }
.notice.alerta b { color: #a5301f; }
.notice-acao { display: inline-block; margin-top: 8px; }
.info-row .v-alerta { color: #c0392b; font-weight: 700; }

/* Modal de renovação antecipada: dá para fechar, porque a pessoa ainda
   tem acesso e só veio adiantar o pagamento. */
.payment-modal-close {
  position: absolute; top: 10px; right: 12px; z-index: 2;
  /* 40px para dar alvo de toque decente no celular */
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; text-decoration: none;
  background: rgba(255, 255, 255, .22); color: #fff;
  font-size: 15px; line-height: 1;
}
.payment-modal-close:hover { background: rgba(255, 255, 255, .34); }
.payment-overlay.renovacao .modal-head { position: relative; }
.notice b { display: block; font-size: 14px; }
.notice p { margin: 2px 0 0; font-size: 13px; color: var(--text-muted); }
.notice .n-date { font-size: 11px; color: var(--text-muted); margin-left: auto; white-space: nowrap; }

/* ===== Badges ===== */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.gray { background: #eef0f4; color: var(--text-muted); }

/* ===== Table ===== */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; }
table.data th, table.data td { padding: 12px 14px; text-align: left; }
table.data thead th {
  background: var(--navy); color: #fff;
  font-size: 12px; font-weight: 600; letter-spacing: .3px;
  white-space: nowrap;
}
table.data thead th:first-child { border-top-left-radius: var(--radius); }
table.data thead th:last-child { border-top-right-radius: var(--radius); }
table.data tbody tr { border-bottom: 1px solid var(--border); }
table.data tbody tr:last-child { border-bottom: none; }
table.data tbody tr:nth-child(even) { background: #fafbfc; }
table.data td.num { font-variant-numeric: tabular-nums; }
table.data .strike { color: var(--text-muted); text-decoration: line-through; font-size: 12px; }

/* ===== Progress ===== */
.progress { height: 8px; background: #eef0f4; border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--bordeaux), var(--bordeaux-light)); border-radius: 999px; }

/* ===== Subject cards ===== */
.subject-card { display: flex; flex-direction: column; gap: 12px; }
.subject-card .s-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.subject-card .s-code { font-size: 11px; color: var(--text-muted); font-weight: 600; letter-spacing: .5px; }
.subject-card h3 { margin: 2px 0 0; font-size: 16px; }
.subject-card .s-teacher { font-size: 13px; color: var(--text-muted); }
.subject-card .s-meta { display: flex; gap: 18px; flex-wrap: wrap; }
.subject-card .s-meta .m-val { font-size: 18px; font-weight: 700; color: var(--navy); }
.subject-card .s-meta .m-lbl { font-size: 11px; color: var(--text-muted); }

/* ===== Alternância tabela (telas largas) / cartões (telas estreitas) =====
   Evita rolagem horizontal forçada em Notas e Financeiro no celular:
   a tabela completa só aparece a partir de 861px; abaixo disso, cada
   linha vira um cartão com a mesma informação, só que legível sem
   precisar arrastar para o lado. */
.narrow-only { display: none; }

/* ===== Cartões de mensalidade (Financeiro, telas estreitas) =====
   Sem "display: flex" aqui de propósito: a classe .narrow-only já esconde
   isso por padrão (display:none). O único lugar que liga o flex é dentro
   do @media abaixo — assim não há disputa de especificidade/ordem entre
   regras com o mesmo peso. */
.pay-cards { flex-direction: column; gap: 12px; }
.pay-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px;
}
.pay-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.pay-month { font-size: 15px; font-weight: 700; color: var(--navy); }
.pay-amount-row { margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px dashed var(--border); }
.pay-strike { display: block; font-size: 12px; color: var(--text-muted); text-decoration: line-through; margin-bottom: 3px; }
.pay-final { display: block; font-size: 22px; font-weight: 800; color: var(--navy); font-variant-numeric: tabular-nums; }
.pay-meta { display: flex; gap: 16px; }
.pay-meta-item { flex: 1; min-width: 0; }
.pay-meta-item .l { display: block; font-size: 11px; color: var(--text-muted); margin-bottom: 2px; }
.pay-meta-item .v { display: block; font-size: 13.5px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }

/* ===== Cartões de notas (Notas, telas estreitas) ===== */
.grade-cards { flex-direction: column; gap: 12px; }
.grade-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px;
}
.grade-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.grade-card-top .s-code { font-size: 11px; color: var(--text-muted); font-weight: 600; letter-spacing: .5px; }
.grade-name { display: block; font-size: 15px; font-weight: 700; color: var(--navy); line-height: 1.3; margin-top: 1px; }
.grade-scores {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px dashed var(--border);
}
.grade-score { text-align: center; }
.grade-score .v { display: block; font-size: 17px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.grade-score .l { display: block; font-size: 10.5px; color: var(--text-muted); margin-top: 3px; }
.grade-summary { display: flex; gap: 16px; }
.grade-summary > div { flex: 1; min-width: 0; }
.grade-summary .l { display: block; font-size: 11px; color: var(--text-muted); margin-bottom: 2px; }
.grade-summary .v { display: block; font-size: 16px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.grade-summary .v.grade-avg { color: var(--navy); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; background: var(--bordeaux); color: #fff;
  transition: filter .15s, background .15s;
}
.btn:hover { filter: brightness(1.06); }
.btn.ghost { background: var(--white); color: var(--bordeaux); border-color: var(--border); }
.btn.ghost:hover { background: var(--bg); }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn.green { background: var(--green); }
.btn.navy { background: var(--navy); }
.btn.block { width: 100%; }

/* ===== Carteirinha / cartão digital (frente e verso, com efeito de virar) ===== */
.idcard-scene {
  max-width: 420px; margin: 0 auto;
  perspective: 1600px;
}
.idcard-flip {
  position: relative;
  width: 100%;
  aspect-ratio: 1.586 / 1; /* proporção de cartão (CR80), reconhecível de cara */
  cursor: pointer;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  transition: transform .7s cubic-bezier(.4, .1, .2, 1);
  border-radius: 18px;
}
.idcard-flip.flipped { transform: rotateY(180deg); }
.idcard-flip:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(122,31,43,.35); }

/* A visibilidade de face (frente/verso) fica só no elemento posicionado/rotacionado;
   o recorte de cantos (overflow) fica num filho à parte. Colocar as duas coisas no
   mesmo elemento quebra o backface-visibility no Safari/Chrome do celular — é a causa
   do "espelhamento" visto ao virar o cartão no mobile. */
.idcard-face {
  position: absolute; inset: 0;
  border-radius: 18px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: translateZ(0);
  box-shadow: var(--shadow-lg);
}
.idcard-back { transform: rotateY(180deg) translateZ(0); }

/* Prévias sem verso (troca de foto no perfil, prévia da inscrição) não
   têm o .idcard-flip em volta — e é ele que dá tamanho à face, com
   aspect-ratio e position: relative. Sem esse pai a face segue
   `position: absolute` e desaba para altura 0: o cartão some da tela e
   sobra só o aviso. Quando a face é filha DIRETA da cena, ela entra no
   fluxo e carrega a proporção do cartão sozinha.
   (Detalhe: o `perspective` da cena faz dela o bloco de contenção, por
   isso a face encolhia junto em vez de vazar para o modal inteiro.) */
.idcard-scene > .idcard-face {
  position: relative;
  aspect-ratio: 1.586 / 1;
}

.idcard-panel {
  position: relative;
  width: 100%; height: 100%;
  border-radius: 18px;
  overflow: hidden;
  display: flex; flex-direction: column;
}

.idcard-pattern {
  position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.05) 0 2px, transparent 2px 11px);
}

/* --- Frente --- */
.idcard-front .idcard-panel {
  background: linear-gradient(155deg, #8a2331 0%, #5e1620 55%, #16223c 135%);
  color: #fff;
  padding: 6% 6.5%;
}
.idcard-front .idcard-panel::before {
  content: ""; position: absolute; right: -60px; top: -60px;
  width: 180px; height: 180px; border-radius: 50%;
  background: rgba(244,196,48,.14); z-index: 0;
}
.idcard-front .idcard-panel > *:not(.idcard-pattern) { position: relative; z-index: 1; }

.idcard-topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex: none; }
.idcard-brand2 { display: flex; align-items: center; gap: 8px; min-width: 0; }
.idcard-logo {
  width: 24px; height: 24px; border-radius: 6px; object-fit: cover; flex: none;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.4);
}
.idcard-brandtext { min-width: 0; line-height: 1.15; }
.idcard-brandtext b { display: block; font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.idcard-brandtext span { display: block; font-size: 8px; opacity: .75; text-transform: uppercase; letter-spacing: .5px; white-space: nowrap; }
.idcard-ribbon {
  flex: none;
  font-size: 8px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase;
  background: var(--yellow); color: var(--bordeaux-dark);
  padding: 4px 9px; border-radius: 999px; white-space: nowrap;
}

.idcard-body { flex: 1; display: flex; align-items: center; gap: 12px; min-height: 0; margin: 4% 0; }
.idcard-photo {
  flex: none; width: 25%; aspect-ratio: 3 / 4;
  border-radius: 8px;
  background: rgba(255,255,255,.14);
  border: 2px solid rgba(255,255,255,.55);
  display: grid; place-items: center;
  overflow: hidden; position: relative;
  font-size: 20px; font-weight: 700;
}
.idcard-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.idcard-info { min-width: 0; flex: 1; }
.idcard-name {
  display: block; font-size: 15.5px; font-weight: 800; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.idcard-course {
  display: block; font-size: 10.5px; opacity: .85; margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.idcard-ra-row { display: flex; gap: 14px; margin-top: 9px; }
.idcard-ra { min-width: 0; }
.idcard-ra .l { display: block; font-size: 7.5px; text-transform: uppercase; letter-spacing: .6px; opacity: .7; }
.idcard-ra .v { display: block; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.idcard-footbar {
  flex: none;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 8px;
  padding-top: 10px; margin-top: auto; border-top: 1px solid rgba(255,255,255,.2);
}
.idcard-mini .l { display: block; font-size: 7.5px; text-transform: uppercase; letter-spacing: .5px; opacity: .65; }
.idcard-mini .v { display: block; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.idcard-status2 {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 9.5px; font-weight: 700;
  background: rgba(255,255,255,.16); padding: 4px 10px; border-radius: 999px;
  white-space: nowrap;
}
.idcard-status2 .dot { width: 6px; height: 6px; border-radius: 50%; background: #37d982; flex: none; }

/* --- Verso --- */
.idcard-back-strip { height: 14%; background: var(--navy); flex: none; }
.idcard-back-content { flex: 1; min-height: 0; padding: 5% 6.5%; display: flex; flex-direction: column; background: #f4f1ea; }
.idcard-seal-row { display: flex; gap: 10px; align-items: flex-start; flex: none; }
.idcard-seal {
  flex: none; width: 16%; aspect-ratio: 1;
  border-radius: 50%; border: 2px solid var(--bordeaux);
  display: grid; place-items: center; overflow: hidden; background: #fff;
}
.idcard-seal img { width: 80%; height: 80%; object-fit: cover; border-radius: 50%; }
.idcard-legal { font-size: 7.5px; line-height: 1.4; color: var(--text-muted); margin: 0; }
.idcard-barcode {
  margin-top: auto;
  height: 22%; min-height: 34px;
  background-color: #fff;
  background-image: repeating-linear-gradient(90deg,
    #16223c 0px, #16223c 2px, transparent 2px 5px,
    #16223c 5px, #16223c 7px, transparent 7px 9px,
    #16223c 9px, #16223c 14px, transparent 14px 16px,
    #16223c 16px, #16223c 18px, transparent 18px 24px,
    #16223c 24px, #16223c 26px, transparent 26px 27px,
    #16223c 27px, #16223c 32px, transparent 32px 35px);
  background-repeat: repeat-x; background-size: 35px 100%;
  border-radius: 4px;
}
.idcard-barcode-num {
  flex: none; text-align: center; font-size: 10px; letter-spacing: 3px;
  font-variant-numeric: tabular-nums; margin-top: 6px; color: var(--navy); font-weight: 700;
}

@media (max-width: 380px) {
  .idcard-name { font-size: 14px; }
  .idcard-brandtext b { font-size: 11px; }
  .idcard-legal { display: none; }
  .idcard-seal-row { justify-content: center; }
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(22,34,60,.55);
  display: none; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
  backdrop-filter: blur(2px);
}
.modal-overlay.open { display: flex; }
.modal {
  background: #fff; border-radius: var(--radius);
  max-width: 420px; width: 100%;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: pop .18s ease;
}
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-head {
  background: var(--bordeaux); color: #fff;
  padding: 16px 20px; display: flex; justify-content: space-between; align-items: center;
}
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-head button { background: none; border: none; color: #fff; font-size: 22px; cursor: pointer; line-height: 1; }
.modal-body { padding: 20px; }

/* Modal da foto do aluno */
.photo-modal { max-width: 340px; }
.photo-modal-body { text-align: center; }
.photo-modal-frame {
  width: 62%; max-width: 220px; aspect-ratio: 1; margin: 0 auto 18px;
  border-radius: 50%; overflow: hidden;
  background: linear-gradient(135deg, var(--bordeaux) 0%, var(--bordeaux-light) 100%);
  display: grid; place-items: center;
  box-shadow: inset 0 0 0 4px rgba(255,255,255,.55), var(--shadow-lg);
}
.photo-modal-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-modal-frame span { color: #fff; font-weight: 700; font-size: clamp(36px, 12vw, 56px); }
.photo-modal-notice {
  font-size: 12.5px; line-height: 1.55; text-align: left; margin: 0;
  background: var(--blue-soft); color: var(--blue);
  border: 1px solid #c9ddf6; border-radius: var(--radius-sm);
  padding: 12px 14px;
}

/* ===== Bloqueio por pagamento pendente =====
   O conteúdo do portal fica visível ao fundo (levemente borrado e travado,
   só o suficiente pra pessoa reconhecer a própria foto/dados), atrás do
   modal de pagamento — que não tem botão de fechar. */
body.payment-locked .app {
  filter: blur(2.5px);
  pointer-events: none;
  user-select: none;
}
body.payment-locked { overflow: hidden; }

.preview-close-note {
  display: block; padding: 11px 14px; font-size: 11.5px; line-height: 1.4;
  color: rgba(255,255,255,.75);
}

/* O modal fica compacto de propósito: assim sobra bastante espaço em volta
   pra pessoa ver (levemente borrado) o próprio fundo/conta atrás dele. */
#payment-modal.payment-overlay { background: rgba(51,65,110,.24); backdrop-filter: blur(1px); }
.payment-modal { max-width: 360px; max-height: 86vh; display: flex; flex-direction: column; }
/* Rostinho do personagem no topo do modal — deixa o aviso de pagamento
   bem menos "cobrança" e mais conversa. */
.payment-modal .modal-head { justify-content: flex-start; gap: 10px; }
/* Sem recorte circular: o rosto.png é retrato (664x800), então cortar em
   quadrado decapitaria o personagem. Aqui ele aparece inteiro. */
.modal-head-face {
  height: 44px; width: auto; flex: none;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,.25));
  margin-bottom: -6px; /* "apoia" o queixo na barra do título */
}
.payment-modal .modal-body { overflow-y: auto; }
.payment-modal-body { text-align: center; }
.payment-modal-intro { font-size: 13px; color: var(--text-muted); line-height: 1.5; margin: 0 0 16px; text-align: left; }
.payment-step { animation: pop .18s ease; }

/* Seletor de plano — lista vertical de 3 opções, fácil de ler no celular */
.plan-selector { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.plan-option {
  position: relative; width: 100%; text-align: left;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 13px 16px; border-radius: var(--radius-sm);
  border: 2px solid var(--border); background: #fff; cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .1s ease;
  font-family: inherit;
}
.plan-option:hover { border-color: var(--bordeaux-light); transform: translateY(-1px); }
.plan-option:active { transform: translateY(0); }
.plan-option.active { border-color: var(--bordeaux); background: var(--yellow-soft); }
.plan-option .plan-name { font-size: 13.5px; font-weight: 600; color: var(--navy); }
.plan-option .plan-price { font-size: 17px; font-weight: 800; color: var(--bordeaux); font-variant-numeric: tabular-nums; flex: none; }
.plan-option .plan-badge {
  position: absolute; top: -9px; left: 14px;
  background: var(--green); color: #fff; font-size: 9px; font-weight: 700;
  padding: 2px 7px; border-radius: 999px; letter-spacing: .2px; white-space: nowrap;
}
.plan-option .plan-badge.plan-badge-alt { background: var(--blue); }
.plan-option[disabled] { opacity: .6; cursor: wait; }
.plan-hint { font-size: 11.5px; color: var(--text-muted); text-align: left; margin: 0 0 16px; }

.plan-change-link {
  display: inline-block; background: none; border: none; padding: 0; margin: 0 0 14px;
  font-size: 12.5px; font-weight: 600; color: var(--blue); cursor: pointer; font-family: inherit;
}
.plan-change-link:hover { text-decoration: underline; }

.payment-amount { font-size: 30px; font-weight: 800; color: var(--navy); margin-bottom: 14px; font-variant-numeric: tabular-nums; }
.payment-qr {
  width: 76%; max-width: 220px; margin: 0 auto 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px; background: #fff;
}
.payment-qr img { width: 100%; height: auto; display: block; }
.payment-code-label { display: block; text-align: left; font-size: 12px; font-weight: 600; color: var(--navy); margin-bottom: 6px; }
.payment-code-row { display: flex; gap: 8px; margin-bottom: 16px; }
.payment-code-row input {
  flex: 1; min-width: 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 12.5px; font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; background: var(--bg); color: var(--text);
}
.payment-status {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 12.5px; font-weight: 600; color: var(--amber);
  background: var(--amber-soft); border: 1px solid #f0dfa8; border-radius: var(--radius-sm);
  padding: 10px 12px; margin-bottom: 14px;
}
.payment-status-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--amber); flex: none;
  animation: payment-pulse 1.4s ease-in-out infinite;
}
@keyframes payment-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.payment-security-note {
  font-size: 11px; color: var(--text-muted); text-align: center; margin-bottom: 16px;
}

/* ===== Modal: pagamento aprovado =====
   Fica FORA do .modal-body de propósito: assim o personagem comemorando
   (aprovado.png, 1024x812) encosta exatamente no fim do modal, de ponta a
   ponta, sem depender de margem negativa (que criaria barra de rolagem
   horizontal, já que o .modal-body tem overflow-y:auto). Os cantos de
   baixo são recortados pelo overflow:hidden do próprio .modal. */
.payment-approved { text-align: center; overflow: hidden; }
.payment-approved-top { padding: 20px 20px 2px; }
.payment-approved-top .btn {
  background: var(--green); font-size: 15px; padding: 13px 20px; width: 100%;
}
.payment-approved-note { font-size: 11.5px; color: var(--text-muted); margin: 8px 0 0; }
.payment-approved-img { display: block; width: 100%; height: auto; }

/* FAQ (accordion nativo via <details>/<summary>, sem JS) */
.payment-faq { text-align: left; border-top: 1px solid var(--border); padding-top: 12px; }
.payment-faq-toggle {
  cursor: pointer; font-size: 13.5px; font-weight: 700; color: var(--bordeaux);
  list-style: none; display: flex; align-items: center; gap: 6px;
}
.payment-faq-toggle::-webkit-details-marker { display: none; }
.payment-faq-toggle::after { content: "▾"; font-size: 11px; transition: transform .15s ease; }
.payment-faq[open] > .payment-faq-toggle::after { transform: rotate(180deg); }
.payment-faq-list { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }

.faq-item { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 2px 12px; background: var(--bg); }
.faq-item summary {
  cursor: pointer; list-style: none; padding: 9px 0;
  font-size: 12.5px; font-weight: 600; color: var(--text);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-size: 15px; color: var(--text-muted); flex: none; }
.faq-item[open] summary::after { content: "–"; }
.faq-item p { margin: 0 0 10px; font-size: 12px; color: var(--text-muted); line-height: 1.5; }

.faq-preview-cta {
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  background: var(--blue-soft); border: 1px dashed #9cbcec; border-radius: var(--radius-sm);
  padding: 12px;
}
.faq-preview-cta span { font-size: 12px; font-weight: 600; color: var(--blue); }

/* ===== Alerts ===== */
.alert {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; margin-bottom: 16px;
}
.alert.success { background: var(--green-soft); color: var(--green); border: 1px solid #bfe6cd; }
.alert.error { background: #fdecec; color: #c0392b; border: 1px solid #f5c6c6; }
.alert.info { background: var(--blue-soft); color: var(--blue); border: 1px solid #c9ddf6; }
/* Conselho, não erro: usado quando a pessoa PODE seguir mesmo assim
   (dica de fundo/luz na troca de foto). Vermelho ali assusta à toa. */
.alert.dica { background: #fbf0d6; color: #8a5a12; border: 1px solid #eed9a8; }

.demo-banner {
  background: var(--yellow-soft); color: var(--amber);
  border: 1px solid #f0dfa8;
  text-align: center; font-size: 12px; font-weight: 600;
  padding: 8px 14px;
}

/* ===== Forms (admin) ===== */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 13px; font-weight: 600; color: var(--navy); }
.field input, .field select, .field textarea {
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  /* 16px+ evita o zoom automático do Safari/iOS ao focar o campo */
  font-size: 16px; font-family: inherit; background: #fff; color: var(--text);
  width: 100%; max-width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--bordeaux);
  box-shadow: 0 0 0 3px rgba(122,31,43,.12);
}
.field textarea { resize: vertical; min-height: 90px; font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 15px; }
.field .hint { font-size: 11px; color: var(--text-muted); }
fieldset {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; margin: 0 0 20px;
}
fieldset legend { font-weight: 700; color: var(--bordeaux); padding: 0 8px; font-size: 15px; }

.photo-preview {
  width: 90px; height: 90px; border-radius: 12px; overflow: hidden;
  background: var(--bg); border: 1px dashed var(--border);
  display: grid; place-items: center; color: var(--text-muted); font-size: 12px;
}
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }

/* ===== Login (admin) ===== */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: linear-gradient(135deg, var(--bordeaux) 0%, var(--navy) 100%); }
.login-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 380px; padding: 32px; }
.login-card .brand { border: none; justify-content: center; padding: 0 0 20px; }
.login-card h2 { text-align: center; margin: 0 0 4px; font-size: 20px; }
.login-card .sub { text-align: center; color: var(--text-muted); font-size: 13px; margin-bottom: 22px; }
.login-card .field { margin-bottom: 14px; }
.login-hint { text-align: center; font-size: 12px; color: var(--text-muted); margin-top: 16px; }

/* ===== Tela de inscrição ===== */
.enroll-page {
  min-height: 100vh; padding: 40px 16px;
  display: flex; justify-content: center; align-items: flex-start;
  background: linear-gradient(135deg, var(--bordeaux) 0%, var(--navy) 100%);
}
.enroll-card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 780px; padding: 0 0 30px; overflow: hidden;
}
.enroll-head {
  background: linear-gradient(120deg, var(--bordeaux) 0%, var(--bordeaux-dark) 100%);
  color: #fff; padding: 28px 30px; display: flex; align-items: center; gap: 16px;
  position: relative; overflow: hidden;
}
.enroll-head::after {
  content: ""; position: absolute; right: -40px; top: -40px;
  width: 160px; height: 160px; border-radius: 50%;
  background: rgba(244,196,48,.16);
}
.enroll-head .brand-logo { width: 52px; height: 52px; font-size: 20px; z-index: 1; }
.enroll-head-text { z-index: 1; }
.enroll-head-text h1 { margin: 0 0 3px; font-size: 20px; }
.enroll-head-text p { margin: 0; font-size: 13px; opacity: .9; }
.enroll-body { padding: 26px 30px 0; }
/* Espaço reservado para o mascote/personagem-guia (imagem entra depois no
   lugar do emoji — a bolha e o tamanho já ficam prontos). */
.mascot-slot {
  width: 68px; height: 68px; margin: -48px auto 14px; position: relative; z-index: 2;
  border-radius: 50%; background: #fff; box-shadow: var(--shadow-lg);
  display: grid; place-items: center; font-size: 30px;
  border: 3px solid var(--yellow-soft); overflow: hidden;
}
/* contain (não cover) pra não cortar o rostinho, que é retrato */
.mascot-slot img { width: 86%; height: 86%; object-fit: contain; margin-bottom: -6%; }
.enroll-intro { color: var(--text-muted); font-size: 13.5px; margin: 0 0 20px; }
.enroll-body .demo-banner { border-radius: 10px; margin-bottom: 20px; }
.check-row label {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 13px; font-weight: 500; color: var(--text); cursor: pointer;
}
.check-row input[type="checkbox"] {
  width: 18px; height: 18px; flex: none; margin-top: 1px; accent-color: var(--bordeaux);
}
.req { color: #c0392b; margin-left: 2px; }
.honey { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

@media (max-width: 560px) {
  .enroll-head { padding: 22px 20px; }
  .enroll-body { padding: 22px 20px 0; }
}

/* Admin topbar */
.admin-top {
  background: var(--bordeaux); color: #fff;
  padding: 14px 22px; display: flex; align-items: center; gap: 12px;
  position: sticky; top: 0; z-index: 40;
}
.admin-top .brand-logo { width: 36px; height: 36px; font-size: 15px; }
.admin-top b { font-size: 15px; }
.admin-top .spacer { flex: 1; }
.admin-wrap { max-width: 900px; margin: 0 auto; padding: 24px 20px 60px; }

/* ===== Overlay for mobile menu ===== */
.overlay {
  position: fixed; inset: 0; background: rgba(22,34,60,.5);
  z-index: 45; display: none;
}
.overlay.show { display: block; }

/* ===== Responsive ===== */
@media (max-width: 860px) {
  .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid.cols-3 { grid-template-columns: 1fr; }
  .grid.cols-2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .burger { display: flex; }
  .header-user .u-info { display: none; }
  .content { padding: 16px; }
  .hero { flex-direction: column; text-align: center; }
  .wide-only { display: none; }
  .pay-cards.narrow-only, .grade-cards.narrow-only { display: flex; }
}
@media (max-width: 480px) {
  .hero-info h2 { font-size: 19px; }
  .login-wrap, .enroll-page { padding: 12px; }
  .login-card { padding: 22px; }
  .enroll-head { padding: 18px 16px; gap: 12px; }
  .enroll-head-text h1 { font-size: 18px; }
  .enroll-body { padding: 18px 16px 0; }
  table.data { min-width: 480px; }
  .grid.cols-4 { gap: 10px; }
  .grid.cols-4 .card.stat { padding: 12px; gap: 8px; }
  .stat-link { padding-right: 26px; }
  .stat .stat-ic { width: 36px; height: 36px; border-radius: 10px; }
  .stat .stat-val { font-size: 16.5px; }
  .stat .stat-label { font-size: 10.5px; }
  .stat-chevron { right: 10px; }
  .stat-chevron .ic { width: 14px; height: 14px; }
}
@media (max-width: 360px) {
  .login-card { padding: 18px; }
}

/* Safe area for iOS PWA */
@supports (padding: max(0px)) {
  .header { padding-top: env(safe-area-inset-top); height: calc(var(--header-h) + env(safe-area-inset-top)); }
  .sidebar { padding-top: env(safe-area-inset-top); }
}


/* =========================================================
   Chamados — conversa no portal e no /admin
   ========================================================= */

/* Rótulo que só o leitor de tela usa */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

/* ---- Conversa em andamento ---- */
.tk-thread { padding: 18px; margin-bottom: 14px; }
/* Resposta nova que a pessoa ainda não tinha visto */
.tk-thread--novo { border-left: 4px solid var(--bordeaux); }
.tk-thread-top {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--border);
}
.tk-item-subject { font-size: 15.5px; color: var(--navy); }
.tk-item-meta { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

.tk-chat { display: flex; flex-direction: column; gap: 10px; padding: 16px 0 4px; }
.tk-msg { max-width: 82%; padding: 11px 14px; border-radius: 14px; }
/* Falas do aluno à direita, as nossas à esquerda — a leitura fica
   parecida com a de qualquer aplicativo de mensagem. */
.tk-msg--aluno {
  align-self: flex-end;
  background: var(--bordeaux); color: #fff;
  border-bottom-right-radius: 4px;
}
.tk-msg--nos {
  align-self: flex-start;
  background: var(--bg); border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.tk-msg-quem { font-size: 11px; font-weight: 700; opacity: .75; margin-bottom: 3px; }
.tk-msg-texto { font-size: 14.5px; line-height: 1.55; overflow-wrap: anywhere; }
.tk-msg-hora { font-size: 10.5px; opacity: .6; margin-top: 5px; text-align: right; }
.tk-msg--nos .tk-msg-quem { color: var(--bordeaux); opacity: 1; }

.tk-waiting {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--text-muted); padding: 4px 0 2px;
}
.tk-waiting .ic { width: 15px; height: 15px; flex: none; }

/* ---- Campo de resposta dentro da conversa ---- */
.tk-chat-form {
  display: flex; gap: 8px; align-items: flex-end;
  margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border);
}
.tk-chat-form textarea {
  flex: 1; min-width: 0; resize: vertical;
  padding: 11px 13px; border: 1px solid var(--border); border-radius: 12px;
  font-family: inherit; line-height: 1.45;
  /* 16px evita o zoom automático do Safari/iOS ao focar o campo */
  font-size: 16px; background: #fff; color: var(--text);
  min-height: 46px;
}
.tk-chat-form textarea:focus {
  outline: none; border-color: var(--bordeaux);
  box-shadow: 0 0 0 3px rgba(122,31,43,.12);
}
.tk-chat-send { flex: none; min-height: 46px; padding: 10px 16px; }
.tk-chat-send .ic { width: 18px; height: 18px; }

/* ---- Aviso no celular ---- */
.tk-push-card {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px; margin-bottom: 14px; flex-wrap: wrap;
}
.tk-push-card > .ic { width: 24px; height: 24px; flex: none; color: var(--bordeaux); }
.tk-push-texto { flex: 1; min-width: 190px; }
.tk-push-texto b { display: block; font-size: 14.5px; color: var(--navy); }
.tk-push-texto p { margin: 3px 0 0; font-size: 12.5px; color: var(--text-muted); }
.tk-push-msg:empty { display: none; }
.tk-push-msg[data-estado="ok"] { color: var(--green); font-weight: 600; }
.tk-push-msg[data-estado="erro"] { color: #c0392b; font-weight: 600; }

/* ---- Abrir outro chamado (recolhível) ---- */
.tk-novo {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden; margin-bottom: 14px;
}
.tk-novo > summary {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 18px; cursor: pointer; list-style: none;
  font-size: 15px; font-weight: 700; color: var(--navy);
}
.tk-novo > summary::-webkit-details-marker { display: none; }
.tk-novo > summary:hover { background: var(--bg); }
.tk-novo > summary .ic { width: 20px; height: 20px; flex: none; color: var(--bordeaux); }
.tk-novo[open] > summary { border-bottom: 1px solid var(--border); }
.tk-form { padding: 20px 18px 22px; }
/* O textarea padrão é monoespaçado e 15px por causa dos editores de JSON
   do painel. Aqui quem escreve é o aluno, quase sempre pelo celular:
   volta para a fonte do site e sobe para 16px, abaixo disso o Safari do
   iPhone dá zoom sozinho ao focar o campo. */
.tk-form textarea { font-family: inherit; font-size: 16px; min-height: 120px; line-height: 1.5; }
.tk-hint { font-size: 13px; color: var(--text-muted); margin: 0 0 14px; }

/* ---- Escolha do assunto: cartões clicáveis ---- */
.tk-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tk-option { position: relative; display: block; cursor: pointer; }
/* O radio real fica transparente, mas ocupando o cartão inteiro. Com
   width/height zerados ele sai da árvore de acessibilidade e some para
   leitores de tela; do tamanho do cartão continua sendo anunciado
   normalmente e a área de toque fica grande no celular. */
.tk-option input {
  position: absolute; inset: 0; width: 100%; height: 100%;
  margin: 0; opacity: 0; cursor: pointer;
}
.tk-option-box {
  display: flex; align-items: flex-start; gap: 12px; height: 100%;
  padding: 14px; border: 2px solid var(--border); border-radius: 14px;
  background: #fff; transition: border-color .15s, background .15s;
}
.tk-option-box:hover { border-color: var(--bordeaux-light); }
.tk-option input:checked + .tk-option-box {
  border-color: var(--bordeaux); background: var(--yellow-soft);
}
/* foco visível para quem navega por teclado — sem isso o radio some */
.tk-option input:focus-visible + .tk-option-box {
  outline: 3px solid var(--bordeaux-light); outline-offset: 2px;
}
.tk-option-ico {
  width: 38px; height: 38px; flex: none; border-radius: 11px;
  display: grid; place-items: center;
  background: var(--blue-soft); color: var(--blue);
}
.tk-option input:checked + .tk-option-box .tk-option-ico {
  background: var(--bordeaux); color: #fff;
}
.tk-option-text { min-width: 0; }
.tk-option-text b { display: block; font-size: 14.5px; color: var(--navy); line-height: 1.3; }
.tk-option-text small { display: block; font-size: 12.5px; color: var(--text-muted); margin-top: 3px; line-height: 1.4; }

.tk-count { font-size: 11px; color: var(--text-muted); text-align: right; }
.tk-send { margin-top: 18px; min-height: 50px; font-size: 15px; }

.tk-privacy {
  display: flex; gap: 10px; align-items: flex-start;
  margin-top: 16px; padding: 12px 14px; border-radius: 12px;
  background: var(--blue-soft); border: 1px solid #cfe0f7;
  font-size: 12.5px; line-height: 1.5; color: var(--text);
}
.tk-privacy .ic { width: 18px; height: 18px; flex: none; color: var(--blue); }

/* ---- Encerrados: uma linha, sem conteúdo da conversa ---- */
.tk-list { display: grid; gap: 10px; }
.tk-fechado {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 18px;
}
.tk-fechado b { font-size: 14.5px; color: var(--navy); }

.tk-preview-note { display: flex; align-items: flex-start; gap: 14px; padding: 20px; }
.tk-preview-note .ic { width: 26px; height: 26px; flex: none; color: var(--bordeaux); }

/* ---- Chamados no painel administrativo ---- */
.tk-admin-item { padding: 18px; margin-bottom: 12px; }
.tk-admin-head { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.tk-admin-who { min-width: 0; flex: 1; }
.tk-admin-who b { display: block; font-size: 15px; color: var(--navy); }
.tk-admin-who span { display: block; font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
/* No painel os lados invertem: quem responde sou eu, então a minha fala
   é a destacada à direita. */
.tk-admin-item .tk-msg--aluno {
  align-self: flex-start; background: var(--bg); color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px; border-bottom-left-radius: 4px;
}
.tk-admin-item .tk-msg--aluno .tk-msg-quem { color: var(--bordeaux); opacity: 1; }
.tk-admin-item .tk-msg--nos {
  align-self: flex-end; background: var(--bordeaux); color: #fff; border: none;
  border-radius: 14px; border-bottom-right-radius: 4px;
}
.tk-admin-item .tk-msg--nos .tk-msg-quem { color: #fff; opacity: .75; }
.tk-admin-form { margin-top: 14px; display: grid; gap: 10px; }
.tk-admin-form textarea { font-family: inherit; font-size: 16px; min-height: 80px; }
.tk-admin-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tk-empty { padding: 30px; text-align: center; color: var(--text-muted); }

@media (max-width: 720px) {
  .tk-options { grid-template-columns: 1fr; }
  .tk-form { padding: 18px 14px 20px; }
  .tk-thread { padding: 16px 14px; }
  .tk-thread-top { flex-direction: column; gap: 8px; }
  .tk-msg { max-width: 92%; }
  .tk-fechado { flex-direction: column; align-items: flex-start; }
  .tk-admin-actions .btn { flex: 1; }
  /* No celular o botão de enviar vai para baixo do campo, em largura
     inteira: lado a lado sobrava pouco espaço para escrever. */
  .tk-chat-form { flex-direction: column; align-items: stretch; }
  .tk-chat-send { width: 100%; }
}

/* Contador de respostas novas ao lado de "Chamados", no menu lateral */
.nav-badge {
  margin-left: auto; flex: none;
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px; background: var(--yellow); color: var(--bordeaux-dark);
  font-size: 11px; font-weight: 800; line-height: 20px; text-align: center;
}
.nav a.active .nav-badge { background: var(--bordeaux); color: #fff; }

/* =========================================================
   Perfil — troca de foto/dados liberada pelo admin
   ========================================================= */
.pf-liberado {
  display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap;
  padding: 16px 18px; margin-bottom: 18px;
  border: 1px solid #f0dfa8; background: var(--yellow-soft);
}
.pf-liberado > .ic { width: 24px; height: 24px; flex: none; color: var(--bordeaux); margin-top: 2px; }
.pf-liberado-texto { flex: 1; min-width: 200px; }
.pf-liberado-texto b { display: block; font-size: 14.5px; color: var(--navy); }
.pf-liberado-texto p { margin: 3px 0 0; font-size: 12.5px; color: var(--text-muted); }
.pf-liberado-botoes { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---- Modal: trocar foto ---- */
.pf-foto-modal-box { max-width: 440px; max-height: 88vh; display: flex; flex-direction: column; }
.pf-foto-modal-box .modal-body { overflow-y: auto; }

.pf-photo-rules { display: grid; gap: 8px; margin-bottom: 16px; }
/* Depois que a foto foi tirada, as regras já cumpriram o papel e só
   empurram o cartão e o botão "Salvar" para fora da tela no celular.
   Quem quiser relê-las é só tocar em "Tirar outra foto".
   Navegador sem :has() simplesmente mantém tudo — só rola um pouco. */
#pf-foto-form:has(#pf-preview:not([hidden])) .pf-photo-rules { display: none; }
.pf-rule {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px;
  font-size: 13px; color: var(--text);
}
.pf-rule svg { width: 17px; height: 17px; flex: none; }
.pf-rule--sim svg { color: var(--green); }
.pf-rule--nao svg { color: #c0392b; }

.pf-drop {
  position: relative; display: flex; flex-direction: column; align-items: center;
  gap: 8px; text-align: center; cursor: pointer;
  padding: 26px 18px;
  border: 2px dashed #cdd6e6; border-radius: var(--radius);
  background: var(--bg);
  transition: border-color .15s ease, background-color .15s ease;
}
.pf-drop:hover { border-color: var(--bordeaux); background: var(--yellow-soft); }
.pf-drop-ico {
  width: 50px; height: 50px; border-radius: 50%;
  background: #fff; border: 1px solid var(--border);
  display: grid; place-items: center; color: var(--bordeaux);
}
.pf-drop-ico svg { width: 24px; height: 24px; }
.pf-drop b { font-size: 15.5px; color: var(--navy); }
.pf-drop span { font-size: 13px; color: var(--text-muted); max-width: 30ch; }
.pf-drop input[type="file"] {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; cursor: pointer;
}

.pf-preview[hidden] { display: none !important; }
.pf-scene { max-width: 300px; margin: 4px auto 16px; }
.pf-scene .idcard-photo { font-size: 11px; }

.pf-flip-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; margin: 4px 0 0; padding: 10px 12px;
  background: none; border: none; cursor: pointer;
  font-family: inherit; font-size: 13px; font-weight: 600; color: var(--text-muted);
  border-radius: var(--radius-sm);
}
.pf-flip-btn svg { width: 16px; height: 16px; flex: none; color: var(--bordeaux); }
.pf-flip-btn:hover { color: var(--bordeaux); background: var(--bg); }

.pf-nav { display: flex; gap: 10px; margin-top: 14px; }
.pf-nav .btn { flex: 1; }

/* ---- Modal: trocar dados ---- */
.pf-dados-modal-box { max-width: 620px; max-height: 88vh; display: flex; flex-direction: column; }
.pf-dados-modal-box .modal-body { overflow-y: auto; }

@media (max-width: 560px) {
  .pf-nav { flex-direction: column-reverse; }
}

/* =========================================================
   Painel: topo responsivo + chat ao vivo
   ========================================================= */

/* ---------- Topo ---------- */
.admin-top { padding: 0; display: block; }
.admin-top-linha {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px calc(12px) 20px;
}
.admin-top-nome { font-size: 15px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Faixa de abas: rola na horizontal no celular em vez de quebrar em
   várias linhas e empurrar o conteúdo para baixo. */
.admin-nav {
  display: flex; gap: 6px; align-items: center;
  padding: 0 20px 10px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.admin-nav::-webkit-scrollbar { display: none; }
.admin-nav-item {
  position: relative; flex: none;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 15px; border-radius: 999px;
  background: rgba(255, 255, 255, .14); color: #fff;
  font-size: 13.5px; font-weight: 600; white-space: nowrap;
  transition: background-color .15s ease;
}
.admin-nav-item:hover { background: rgba(255, 255, 255, .26); }
.admin-nav-item.is-ativa { background: #fff; color: var(--bordeaux); font-weight: 700; }
.admin-nav-badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--yellow); color: var(--bordeaux-dark);
  font-size: 11.5px; font-weight: 800; line-height: 20px; text-align: center;
}
.admin-nav-item.is-ativa .admin-nav-badge { background: var(--bordeaux); color: #fff; }

/* iOS instalado: respeita o entalhe da tela */
@supports (padding: max(0px)) {
  .admin-top { padding-top: env(safe-area-inset-top); }
}

/* ---------- Chat: duas colunas ---------- */
.chat-admin {
  display: grid; grid-template-columns: 300px 1fr;
  gap: 14px; align-items: stretch;
  height: min(72vh, 640px);
}

.chat-lista {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.chat-lista-topo {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid var(--border); flex: none;
}
.chat-lista-topo b { font-size: 14.5px; color: var(--navy); }
.chat-lista-conta { font-size: 12px; color: var(--text-muted); }
.chat-lista-conta.tem-nova { color: var(--bordeaux); font-weight: 700; }
.chat-lista-itens { flex: 1; min-height: 0; overflow-y: auto; }
.chat-vazio { padding: 24px 18px; font-size: 13px; color: var(--text-muted); text-align: center; }

.chat-item {
  position: relative; display: block; width: 100%; text-align: left;
  padding: 13px 16px; border: none; border-bottom: 1px solid var(--border);
  background: none; cursor: pointer; font-family: inherit;
}
.chat-item:hover { background: var(--bg); }
.chat-item.is-aberta { background: var(--yellow-soft); box-shadow: inset 3px 0 0 var(--bordeaux); }
.chat-item.is-fechada { opacity: .55; }
.chat-item-topo { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.chat-item-topo b { font-size: 14px; color: var(--navy); }
.chat-item-quando { font-size: 11px; color: var(--text-muted); flex: none; }
.chat-item-previa {
  display: block; margin-top: 3px; font-size: 12.5px; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chat-item.tem-nova .chat-item-previa { color: var(--text); font-weight: 600; }
.chat-item-badge {
  position: absolute; right: 14px; bottom: 12px;
  min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px;
  background: var(--bordeaux); color: #fff;
  font-size: 11px; font-weight: 800; line-height: 19px; text-align: center;
}

/* ---------- Chat: conversa ---------- */
.chat-thread {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.chat-thread-vazia {
  flex: 1; display: grid; place-content: center; justify-items: center; gap: 12px;
  color: var(--text-muted); text-align: center; padding: 24px;
}
.chat-thread-vazia[hidden] { display: none; }
.chat-thread-vazia svg { width: 46px; height: 46px; opacity: .4; }
.chat-thread-vazia p { margin: 0; font-size: 14px; }

.chat-thread-conteudo { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat-thread-conteudo[hidden] { display: none; }
.chat-thread-topo {
  display: flex; align-items: center; gap: 10px; flex: none;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.chat-voltar {
  display: none; width: 36px; height: 36px; flex: none;
  border: 1px solid var(--border); border-radius: 10px; background: #fff;
  cursor: pointer; font-size: 17px; color: var(--navy);
}
.chat-thread-quem { flex: 1; min-width: 0; }
.chat-thread-quem b { display: block; font-size: 15px; color: var(--navy); }
.chat-thread-quem span { display: block; font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }
.chat-thread-acoes { display: flex; gap: 6px; flex: none; }

.chat-msgs {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 16px; background: var(--bg);
  display: flex; flex-direction: column; gap: 9px;
}
.chat-msg {
  max-width: 78%; padding: 10px 13px; border-radius: 14px;
  font-size: 14px; line-height: 1.5; overflow-wrap: anywhere;
}
.chat-msg--eu {
  align-self: flex-end; background: var(--bordeaux); color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-msg--ele {
  align-self: flex-start; background: #fff; color: var(--text);
  border: 1px solid var(--border); border-bottom-left-radius: 4px;
}
.chat-msg-hora { display: block; font-size: 10.5px; opacity: .65; margin-top: 4px; text-align: right; }

.chat-responder {
  flex: none; display: flex; gap: 8px; align-items: flex-end;
  padding: 12px 14px; border-top: 1px solid var(--border); background: #fff;
}
.chat-responder textarea {
  flex: 1; min-width: 0; resize: none; max-height: 120px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px;
  font-family: inherit; line-height: 1.4; color: var(--text);
  /* 16px para o Safari do iPhone não dar zoom ao focar */
  font-size: 16px;
}
.chat-responder textarea:focus {
  outline: none; border-color: var(--bordeaux);
  box-shadow: 0 0 0 3px rgba(122, 31, 43, .12);
}
.chat-responder .btn { flex: none; min-height: 42px; }

/* ---------- Celular: uma coluna, thread por cima ---------- */
@media (max-width: 860px) {
  .admin-wrap { padding: 16px 14px 40px; }
  .admin-top-linha { padding: 10px 14px; }
  .admin-nav { padding: 0 14px 10px; }
  .admin-top-nome { font-size: 14px; }

  .chat-admin {
    grid-template-columns: 1fr;
    height: calc(100dvh - 190px); min-height: 420px;
  }
  /* Com uma conversa aberta, ela ocupa a área toda e a lista sai de
     cena — no celular não cabem as duas ao mesmo tempo. */
  .chat-thread[data-aberta="0"] { display: none; }
  .chat-thread[data-aberta="1"] { grid-row: 1; }
  .chat-admin:has(.chat-thread[data-aberta="1"]) .chat-lista { display: none; }
  .chat-voltar { display: grid; place-items: center; }
  .chat-msg { max-width: 86%; }
  .chat-thread-acoes .btn { padding: 7px 10px; font-size: 12px; }
}

/* Navegador sem :has() — a lista fica em cima e a conversa embaixo,
   as duas visíveis. Menos elegante, mas nada some. */
@supports not selector(:has(*)) {
  @media (max-width: 860px) {
    .chat-thread[data-aberta="0"] { display: flex; }
    .chat-admin { height: auto; }
    .chat-lista { max-height: 260px; }
    .chat-thread { min-height: 420px; }
  }
}

/* =========================================================
   Barra flutuante da prévia (/index.php?preview=1)
   ========================================================= */

/* Espaço no rodapé para a barra não cobrir o fim do conteúdo */
body.preview-on .content { padding-bottom: 120px; }

.preview-bar {
  position: fixed; z-index: 90;
  left: 50%; transform: translateX(-50%);
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  display: flex; align-items: center; gap: 8px;
  padding: 8px; border-radius: 999px;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  box-shadow: 0 12px 34px rgba(22, 34, 60, .22);
  max-width: calc(100vw - 20px);
}

.preview-bar-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 11px 20px;
  border-radius: 999px; white-space: nowrap;
  font-size: 14.5px; font-weight: 700; line-height: 1;
  transition: filter .15s ease, background-color .15s ease;
}
.preview-bar-btn .ic { width: 17px; height: 17px; flex: none; }

.preview-bar-btn--voltar {
  background: var(--bg); color: var(--navy); border: 1px solid var(--border);
}
.preview-bar-btn--voltar:hover { background: #e9ecf2; }

.preview-bar-btn--cta {
  background: var(--green); color: #fff;
  /* halo que respira devagar — chama o olho sem piscar na cara */
  animation: preview-pulsa 2.8s ease-in-out infinite;
}
.preview-bar-btn--cta:hover { filter: brightness(1.08); }
@keyframes preview-pulsa {
  0%, 100% { box-shadow: 0 4px 14px rgba(31, 157, 85, .32), 0 0 0 0 rgba(31, 157, 85, .38); }
  50%      { box-shadow: 0 4px 14px rgba(31, 157, 85, .32), 0 0 0 10px rgba(31, 157, 85, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .preview-bar-btn--cta { animation: none; box-shadow: 0 4px 14px rgba(31, 157, 85, .32); }
}

/* No celular os dois rótulos não cabem lado a lado: viram uma coluna,
   ainda centralizada e sem encostar nas bordas. */
@media (max-width: 620px) {
  .preview-bar {
    left: 12px; right: 12px; transform: none;
    max-width: none; flex-direction: column-reverse; gap: 7px;
    border-radius: 20px; padding: 10px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }
  .preview-bar-btn { width: 100%; font-size: 14px; }
  body.preview-on .content { padding-bottom: 150px; }
}

/* Telas bem estreitas: o texto longo do CTA pode quebrar; deixamos */
@media (max-width: 360px) {
  .preview-bar-btn { padding: 11px 12px; font-size: 13.5px; white-space: normal; }
}

/* ---------- Dica apontando para o menu (só na prévia) ---------- */
.preview-dica {
  position: fixed; z-index: 46;
  display: flex; align-items: center; gap: 6px;
  cursor: pointer; pointer-events: auto;
  /* no computador fica colada à direita da barra lateral, na altura
     dos primeiros itens do menu */
  left: calc(var(--sidebar-w) + 10px);
  top: calc(var(--header-h) + 26px);
  animation: dica-vaivem 1.8s ease-in-out infinite;
}
.preview-dica[hidden] { display: none; }

.preview-dica-balao {
  background: var(--navy); color: #fff;
  font-size: 12.5px; font-weight: 700; line-height: 1.2;
  padding: 9px 13px; border-radius: 999px; white-space: nowrap;
  box-shadow: 0 6px 18px rgba(22, 34, 60, .28);
}
/* Seta branca dentro de um disco da cor da marca: assim ela se destaca
   tanto no fundo claro do conteúdo quanto no bordô da barra lateral. */
.preview-dica-seta {
  order: -1;              /* a seta fica antes do balão, apontando ao menu */
  display: grid; place-items: center;
  width: 34px; height: 34px; flex: none;
  border-radius: 50%;
  background: var(--bordeaux); color: #fff;
  box-shadow: 0 4px 12px rgba(122, 31, 43, .35);
}
.preview-dica-seta svg { width: 22px; height: 22px; stroke-width: 3; }

/* Vaivém horizontal: puxa o olho na direção do menu */
@keyframes dica-vaivem {
  0%, 100% { transform: translateX(0); }
  50%      { transform: translateX(-7px); }
}

/* ---------- Celular: aponta para o botão que abre a gaveta ---------- */
@media (max-width: 860px) {
  .preview-dica {
    left: 14px;
    top: calc(var(--header-h) + 10px + env(safe-area-inset-top, 0px));
    flex-direction: column; align-items: flex-start; gap: 2px;
    animation: dica-vaivem-vertical 1.8s ease-in-out infinite;
  }
  .preview-dica-seta {
    order: -1;
    width: 34px; height: 34px;
    transform: rotate(90deg);   /* seta para cima, mirando o botão */
    margin-left: 4px;
  }
  .preview-dica-balao { font-size: 12px; padding: 8px 12px; }
  @keyframes dica-vaivem-vertical {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
  }
}

@media (prefers-reduced-motion: reduce) {
  .preview-dica { animation: none; }
}

/* ---------- Cupom de desconto (modal de pagamento) ---------- */
.cupom { margin-top: 14px; text-align: center; }
.cupom-abrir {
  background: none; border: none; cursor: pointer; font-family: inherit;
  font-size: 13px; font-weight: 600; color: var(--bordeaux);
  text-decoration: underline; padding: 6px;
}
.cupom-campo { display: flex; gap: 8px; margin-top: 4px; }
/* O "display:flex" acima ganha do display:none que o atributo [hidden]
   traz do navegador — sem esta linha o formulário aparecia mesmo
   marcado como escondido, bem ao lado do "Copiar" do Pix. */
.cupom-campo[hidden] { display: none; }
.cupom-abrir[hidden] { display: none; }
.cupom-campo input {
  flex: 1; min-width: 0; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 10px;
  /* 16px evita o zoom automático do Safari do iPhone ao focar */
  font-size: 16px; font-family: inherit; text-transform: uppercase;
  letter-spacing: .06em; text-align: center; color: var(--text);
}
.cupom-campo input:focus {
  outline: none; border-color: var(--bordeaux);
  box-shadow: 0 0 0 3px rgba(122,31,43,.12);
}
.cupom-campo .btn { flex: none; }

/* Botão "Aplicar": VERDE de propósito. Na tela do Pix ele fica logo
   acima do botão "Copiar", e o tema do modal pinta os .btn de azul —
   dois botões azuis lado a lado viravam clique errado. */
.cupom-aplicar {
  flex: none; cursor: pointer; font-family: inherit;
  padding: 10px 18px; border: none; border-radius: 10px;
  background: var(--green); color: #fff;
  font-size: 14px; font-weight: 700; white-space: nowrap;
  transition: filter .15s ease, transform .15s ease;
}
.cupom-aplicar:hover { filter: brightness(1.07); }
.cupom-aplicar:active { transform: translateY(1px); }
.cupom-aplicar:disabled { opacity: .6; cursor: default; transform: none; }

/* Versão da tela dos três planos: já aberta, com cara de cartinho pra
   não se perder no meio dos planos. */
.cupom-aberto {
  margin-top: 16px; padding: 14px;
  border: 1px dashed var(--border); border-radius: 14px;
  background: var(--bg);
}
.cupom-titulo {
  margin: 0 0 8px; font-size: 13.5px; font-weight: 700; color: var(--text-muted);
}

.cupom-aviso { margin: 8px 0 0; font-size: 12.5px; font-weight: 600; }
.cupom-aviso[data-tipo="erro"] { color: #c0392b; }
.cupom-aviso[hidden] { display: none; }
.cupom-aplicado {
  margin: 0; padding: 10px 14px; border-radius: 12px;
  background: var(--green-soft); border: 1px solid #bfe6cd;
  color: var(--green); font-size: 13.5px; font-weight: 700;
}
