/* =========================================================
   Competências Musicais — folha de estilo única
   Paleta discreta e harmônica (a mesma da tela de login)
   ========================================================= */
:root {
  --bg-1: #e9eef3;
  --bg-2: #d6e0ea;
  --page: #f4f7fa;         /* fundo das telas internas */
  --card: #ffffff;
  --text: #2f3a45;
  --muted: #6b7885;
  --border: #cfd8e1;
  --readonly: #eef2f6;
  --primary: #3b6e8f;
  --primary-dark: #2f5a76;
  --primary-soft: #e3edf4;
  --error: #b5484b;
  --error-soft: #f7e6e6;
  --success: #3f7d5a;
  --success-soft: #e4f1e9;
  --warn: #8a5a00;
  --warn-soft: #fbf0d9;
  --radius: 10px;
  --shadow: 0 10px 30px rgba(47, 58, 69, 0.08);
}

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

body {
  font-family: "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  line-height: 1.45;
}

/* =================== LOGIN =================== */
body.login-page {
  background: linear-gradient(135deg, var(--bg-1) 0%, var(--bg-2) 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.login-page .container { width: 100%; max-width: 420px; }

.login-card {
  background: var(--card);
  border-radius: 14px;
  padding: 36px 32px 28px;
  box-shadow: var(--shadow);
  border-top: 4px solid var(--primary);
}
.login-card h1 { text-align: center; font-size: 1.75rem; font-weight: 600; }
.login-card .subtitle { text-align: center; color: var(--muted); margin: 4px 0 26px; }

/* =================== TELAS INTERNAS =================== */
body.app { background: var(--page); min-height: 100vh; }

/* ---- Barra de navegação ---- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(47, 58, 69, 0.04);
}
.topbar-inner {
  max-width: 1080px; margin: 0 auto;
  display: flex; align-items: center;
  padding: 0 16px; min-height: 56px; gap: 8px;
}
.brand {
  font-weight: 600; color: var(--primary-dark);
  margin-right: 16px; white-space: nowrap;
}
.brand small { display: block; font-weight: 400; font-size: .75rem; color: var(--muted); }

.menu { display: flex; align-items: stretch; flex: 1; gap: 2px; list-style: none; }
.menu a {
  display: block; padding: 18px 14px;
  color: var(--muted); text-decoration: none; font-size: .95rem;
  border-bottom: 3px solid transparent;
  transition: color .2s, background .2s;
}
.menu a:hover { color: var(--text); background: var(--page); }
.menu a.active { color: var(--primary-dark); font-weight: 600; border-bottom-color: var(--primary); }
.menu .spacer { flex: 1; }
.menu .user { align-self: center; font-size: .85rem; color: var(--muted); padding: 0 8px; }
.menu a.logout { color: var(--error); }
.menu a.logout:hover { background: var(--error-soft); }

.user-mobile, .sair-mobile { display: none; }

/* ---- Menu inferior com ícones (somente celular) ---- */
.bottom-nav { display: none; }

/* ---- Conteúdo ---- */
.content { max-width: 1080px; margin: 0 auto; padding: 32px 16px 48px; }
.panel {
  background: var(--card);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 32px;
}
.panel + .panel { margin-top: 24px; }
.panel h1 { font-size: 1.6rem; font-weight: 600; }
.panel h2 { font-size: 1.15rem; font-weight: 600; margin-bottom: 14px; }
.panel .subtitle + h2 { margin-top: 4px; }
.sep { border: none; border-top: 1px solid var(--border); margin: 26px 0 20px; }
#tabelaWrap + .sep, .table-wrap + .sep { margin-top: 22px; }

/* Lista de atividades finalizadas (tela 3) */
.done-list { list-style: none; margin-bottom: 26px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.done-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; background: var(--page); }
.done-list li + li { border-top: 1px solid var(--border); }
.done-list strong { display: block; font-weight: 600; color: #4a5663; }
.done-list .hint { margin-top: 2px; }
.panel .subtitle { color: var(--muted); margin: 6px 0 26px; }

/* =================== FORMULÁRIOS =================== */
.field { margin-bottom: 20px; }

label, legend {
  display: block; font-size: .9rem; font-weight: 600; margin-bottom: 6px;
}

input[type="email"], input[type="password"], input[type="text"],
input[type="url"], select, textarea {
  width: 100%;
  padding: 12px 14px;
  font: inherit; font-size: 1rem;       /* 16px evita zoom no iOS */
  color: var(--text);
  background: #fbfcfd;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .2s, box-shadow .2s;
}
textarea { min-height: 110px; resize: vertical; }
select {
  appearance: none; cursor: pointer; padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%236b7885' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
input::placeholder, textarea::placeholder { color: #9aa6b2; }

input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 110, 143, .18); background: #fff;
}
input[readonly], textarea[readonly] { background: var(--readonly); color: #4a5663; cursor: default; }
input[readonly]:focus, textarea[readonly]:focus { box-shadow: none; border-color: var(--border); }
.invalid { border-color: var(--error) !important; }

.error { display: block; min-height: 1em; color: var(--error); font-size: .8rem; margin-top: 4px; }
.hint { display: block; color: var(--muted); font-size: .8rem; margin-top: 4px; }

.password-wrap { position: relative; }
.password-wrap input { padding-right: 86px; }
.toggle-pass {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--primary);
  font: inherit; font-size: .85rem; font-weight: 500; cursor: pointer;
  padding: 6px 8px; border-radius: 6px;
}
.toggle-pass:hover { background: var(--primary-soft); }

/* ---- Professor / Estudante ---- */
.perfil { border: none; margin: 4px 0 24px; }
.segmented { display: flex; background: var(--primary-soft); border-radius: var(--radius); padding: 4px; gap: 4px; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label {
  flex: 1; margin: 0; text-align: center; padding: 10px 0; border-radius: 8px;
  font-weight: 500; color: var(--muted); cursor: pointer; transition: background .2s, color .2s;
}
.segmented input:checked + label {
  background: var(--card); color: var(--primary-dark); font-weight: 600;
  box-shadow: 0 1px 4px rgba(47, 58, 69, .15);
}
.segmented input:focus-visible + label { outline: 2px solid var(--primary); }

/* ---- Botões ---- */
.btn {
  display: inline-block; padding: 12px 22px;
  font: inherit; font-size: 1rem; font-weight: 600;
  color: #fff; background: var(--primary);
  border: none; border-radius: var(--radius); cursor: pointer;
  transition: background .2s, transform .05s;
}
.btn:hover { background: var(--primary-dark); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; color: var(--primary); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--primary-soft); }

.forgot { display: block; text-align: center; margin-top: 16px; font-size: .88rem; color: var(--primary); text-decoration: none; }
.forgot:hover { text-decoration: underline; }

/* ---- Mensagens ---- */
.msg { min-height: 1.2em; font-size: .92rem; margin-top: 14px; }
.msg.ok  { color: var(--success); }
.msg.err { color: var(--error); }
.login-card .msg { text-align: center; }

.alert {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-radius: var(--radius); font-size: .95rem; margin-bottom: 18px;
}
.alert-ok { background: var(--success-soft); color: var(--success); }

.empty-state {
  text-align: center; padding: 40px 16px;
  border: 1px dashed var(--border); border-radius: var(--radius);
  color: var(--muted); background: var(--page);
}
.empty-state strong { display: block; color: var(--text); font-size: 1.05rem; margin-bottom: 4px; }

.hidden { display: none !important; }

/* =================== VÍDEO =================== */
.video {
  position: relative; width: 100%; max-width: 640px;
  aspect-ratio: 16 / 9;
  background: #1f262d; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border);
}
.video-inner { position: absolute; inset: 0; }
.video iframe, .video img, .video video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; object-fit: cover; }
.video .play {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  background: rgba(20, 26, 32, .25); border: none; cursor: pointer; color: #fff; font: inherit; font-size: .85rem;
}
.video .play:hover { background: rgba(20, 26, 32, .4); }
.video .play-icon {
  width: 64px; height: 44px; border-radius: 12px; background: rgba(0,0,0,.65);
  display: flex; align-items: center; justify-content: center;
}
.video .play-icon::after {
  content: ""; border-style: solid; border-width: 10px 0 10px 17px;
  border-color: transparent transparent transparent #fff; margin-left: 4px;
}
.video-placeholder {
  display: flex; align-items: center; justify-content: center;
  color: #9aa6b2; font-size: .9rem; text-align: center; padding: 16px;
  background: var(--readonly); border-style: dashed;
}

/* =================== TABELA =================== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.badge-open { background: var(--success-soft); color: var(--success); }
.badge-closed { background: #eceff2; color: var(--muted); }
.badge-prof { background: var(--primary); color: #fff; }
.badge-estudante { background: var(--primary-soft); color: var(--primary-dark); }

/* =================== EVOLUÇÃO (duas linhas) =================== */
.evo-row { border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; background: #fbfcfd; }
.evo-row + .evo-row { margin-top: 18px; }
.evo-row-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.evo-row-head h2 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0; font-size: 1.05rem; }
.evo-row-head .count { font-size: .85rem; font-weight: 400; color: var(--muted); }
.evo-nav { display: flex; gap: 8px; }
.btn-sm { width: auto !important; padding: 8px 14px; font-size: .9rem; }

.prof-fixo { max-width: 560px; }
.prof-fixo .video { border: 2px solid var(--primary); }

.timeline {
  display: flex; gap: 20px;
  overflow-x: auto; overflow-y: hidden;
  padding: 4px 4px 16px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin; scrollbar-color: var(--primary) var(--primary-soft);
}
.timeline::-webkit-scrollbar { height: 10px; }
.timeline::-webkit-scrollbar-track { background: var(--primary-soft); border-radius: 10px; }
.timeline::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 10px; }

.tl-item { flex: 0 0 320px; scroll-snap-align: start; position: relative; }
.tl-item .video { max-width: none; }
.tl-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.tl-date { font-size: .82rem; color: var(--muted); margin-top: 8px; }
.tl-link { font-size: .82rem; color: var(--primary); word-break: break-all; }
.tl-item:not(:last-child)::after {
  content: ""; position: absolute; top: 55%; right: -20px; width: 20px; height: 2px; background: var(--border);
}
.tl-empty { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; text-align: center;
  border: 1px dashed var(--border); border-radius: var(--radius); color: var(--muted); padding: 28px 16px; }

/* =================== COMPONENTES DO SISTEMA PHP =================== */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.panel h3 { font-size: 1rem; font-weight: 600; margin-bottom: 12px; }
.alert-err { background: var(--error-soft); color: var(--error); }
.alert ul { margin: 6px 0 0 18px; }
.alert strong { display: block; }
.badge-cancel { background: var(--error-soft); color: var(--error); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }

.btn-sm { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.btn-danger { background: var(--error); }
.btn-danger:hover { background: #963a3d; }
.btn-danger-ghost { background: transparent; color: var(--error); border: 1px solid #e3c3c4; }
.btn-danger-ghost:hover { background: var(--error-soft); }
.btn.is-disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
a.btn { text-decoration: none; }

/* Campo de vídeo (YouTube | arquivo) */
.video-field { border: none; }
.segmented-sm { margin-bottom: 10px; }
.segmented-sm label { padding: 8px 6px; font-size: .9rem; }
.video-field .origem { margin-bottom: 4px; }
.video-preview:not(:empty) { margin-top: 12px; display: grid; gap: 6px; }
input[type="file"] {
  width: 100%; font: inherit; font-size: .95rem; color: var(--text);
  padding: 10px; border: 1px dashed var(--border); border-radius: var(--radius); background: #fbfcfd; cursor: pointer;
}
input[type="file"]::file-selector-button {
  font: inherit; font-weight: 600; color: var(--primary-dark); background: var(--primary-soft);
  border: none; border-radius: 8px; padding: 8px 14px; margin-right: 12px; cursor: pointer;
}
.video video { background: #000; object-fit: contain; }
.field-prazo input { max-width: 200px; }

/* Tabelas */
td .hint { display: block; margin-top: 2px; }
tr.row-new td { background: var(--success-soft); }
tr.row-new td:first-child { box-shadow: inset 3px 0 0 var(--success); }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
td.acao, td.acoes { text-align: right; white-space: nowrap; }
td.acoes .btn + .btn { margin-left: 8px; }
.btn { text-align: center; }
.info-row { margin: -6px 0 16px; }
.tl-coment { font-size: .85rem; color: var(--text); margin-top: 6px; line-height: 1.4; }

/* Painel (dashboard) — tela 3 */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; background: #fbfcfd; display: grid; gap: 2px; }
.stat-label { font-size: .8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.stat-value { font-size: 1.9rem; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat-hint { font-size: .8rem; color: var(--muted); }

.dash-grid { display: grid; grid-template-columns: 3fr 2fr; gap: 20px; align-items: start; }
.chart { margin: 0; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.chart figcaption { font-weight: 600; margin-bottom: 14px; }
.bars { list-style: none; display: grid; gap: 12px; margin-bottom: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1.3fr) 2fr 44px; align-items: center; gap: 10px; position: relative; border-radius: 6px; outline: none; }
.bar-label { font-size: .85rem; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 12px; background: var(--primary-soft); border-radius: 4px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--primary); border-radius: 0 4px 4px 0; }
.bar-value { font-size: .85rem; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }
.bar-row:hover .bar-fill, .bar-row:focus-visible .bar-fill { background: var(--primary-dark); }
.bar-row:focus-visible { box-shadow: 0 0 0 2px var(--primary); }
.bar-row[data-tip]:hover::after, .bar-row[data-tip]:focus-visible::after {
  content: attr(data-tip); position: absolute; z-index: 5; left: 30%; bottom: calc(100% + 6px);
  background: #26303a; color: #fff; font-size: .78rem; padding: 6px 10px; border-radius: 6px; white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,.18); pointer-events: none;
}
.prazos { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.prazo-list { list-style: none; display: grid; gap: 10px; }
.prazo-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.prazo-list strong { display: block; font-size: .9rem; font-weight: 600; }

/* Janela de confirmação */
.modal {
  border: none; border-radius: 14px; padding: 0; width: min(440px, calc(100vw - 32px));
  box-shadow: 0 20px 50px rgba(20, 26, 32, .3); color: var(--text); margin: auto;
}
.modal::backdrop { background: rgba(20, 26, 32, .45); }
.modal form { padding: 24px; }
.modal h2 { font-size: 1.15rem; margin-bottom: 8px; }
.modal p { color: var(--muted); margin-bottom: 20px; }
.modal-acoes { display: flex; gap: 10px; justify-content: flex-end; }
.modal-acoes .btn { width: auto; }


/* Ajustes: monitoramento, estudante e dashboards */
.acao-pilha { display: inline-flex; flex-direction: column; gap: 6px; align-items: stretch; min-width: 200px; }
.acao-pilha form { display: block; }
.acao-pilha .btn { width: 100%; }
.nao-enviada { display: block; margin-top: 4px; color: var(--error); font-weight: 600; font-size: .85rem; }
.acoes-final { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.voltar { display: inline-block; margin-bottom: 12px; color: var(--primary); text-decoration: none; font-size: .9rem; }
.voltar:hover { text-decoration: underline; }
.link-apoio { margin: -8px 0 16px; }
.stat-alerta { border-color: #e3c3c4; background: var(--error-soft); }
.stat-alerta .stat-value { color: var(--error); }
.modal .field { margin-bottom: 18px; }
.modal p strong { color: var(--text); }

/* =================== AUTOANÁLISE (tela 8) e DASHBOARD DO ESTUDANTE (tela 9) =================== */
:root { --star: #d99a1e; --star-off: #cfd8e1; }
.descricao-atividade { margin-top: 16px; max-width: 760px; }
.descricao-atividade h3 { font-size: .9rem; margin-bottom: 4px; }
.descricao-atividade p { color: var(--text); font-size: .95rem; }

.filtros { display: grid; grid-template-columns: repeat(2, minmax(0, 260px)); gap: 12px; margin-bottom: 8px; }
.filtros .field { margin-bottom: 8px; }
.filtros select { padding: 9px 36px 9px 12px; font-size: .92rem; }

.tl-item { flex-basis: 330px; }
.autoanalise .tl-meta { flex-wrap: wrap; justify-content: flex-start; gap: 10px; }
.tl-item:not(:last-child)::after { top: 132px; }
.estrelas { border: none; display: inline-flex; flex-direction: row-reverse; gap: 2px; }
.estrelas input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.estrelas label { font-size: 1.45rem; line-height: 1; color: var(--star-off); cursor: pointer; padding: 2px 1px; transition: color .15s, transform .1s; }
.estrelas input:checked ~ label,
.estrelas label:hover, .estrelas label:hover ~ label { color: var(--star); }
.estrelas:hover input:checked ~ label:not(:hover):not(:hover ~ label) { color: var(--star-off); }
.estrelas label:active { transform: scale(.9); }
.estrelas input:focus-visible + label { outline: 2px solid var(--primary); border-radius: 4px; }

.tl-coment span { color: var(--muted); font-weight: 600; }
.auto-label { margin-top: 12px; font-size: .82rem; }
.autoanalise textarea { min-height: 72px; font-size: .92rem; padding: 10px 12px; }
.auto-rodape { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.auto-rodape .contador { font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.auto-rodape .contador.limite { color: var(--error); }
.auto-rodape .auto-status { flex: 1; font-size: .8rem; color: var(--success); }
.auto-rodape .auto-status.err,
.auto-rodape .auto-status.pendente { color: var(--error); font-weight: 600; }
.auto-rodape .btn { width: auto !important; }

.cta-auto { display: flex; align-items: center; gap: 20px; justify-content: space-between;
  border: 1px solid #f0d9a8; background: #fdf7ea; border-radius: var(--radius); padding: 18px 20px; margin-bottom: 24px; }
.cta-auto.cta-ok { border-color: #bfdcca; background: var(--success-soft); }
.cta-auto h2 { font-size: 1.1rem; margin-bottom: 4px; }
.cta-auto p { font-size: .92rem; margin-bottom: 10px; }
.cta-texto { flex: 1; }
.progresso { height: 10px; border-radius: 6px; background: rgba(47,58,69,.1); overflow: hidden; margin-bottom: 4px; max-width: 520px; }
.progresso span { display: block; height: 100%; background: var(--primary); border-radius: 0 4px 4px 0; }
.sec-titulo { font-size: 1rem !important; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 8px 0 12px !important; }
.dash-grid + .sec-titulo { margin-top: 28px !important; }
.stat-value small { font-size: 1rem; color: var(--muted); font-weight: 500; }
.estrela-media { color: var(--star); font-size: 1.4rem; }
.stat-destaque { border-color: #f0d9a8; background: #fdf7ea; }
.prazo-list li .btn { flex: none; }

/* =================== VÍDEO EM TELA CHEIA (horizontal) =================== */
.video-btn {
  position: absolute; z-index: 3;
  width: 40px; height: 40px; border-radius: 50%;
  display: none; align-items: center; justify-content: center;
  background: rgba(20, 26, 32, .6); color: #fff; border: none; cursor: pointer;
  backdrop-filter: blur(4px);
}
.video-btn:hover { background: rgba(20, 26, 32, .8); }
.btn-girar { right: 10px; bottom: 10px; }
.btn-fechar { right: 12px; top: 12px; }

.video.wide {
  position: fixed; z-index: 1000; inset: 0;
  width: 100vw; height: 100vh; height: 100dvh;
  max-width: none; aspect-ratio: auto;
  border: none; border-radius: 0; background: #000;
}
/* Aparelho em pé e sem travamento de orientação: gira o conteúdo 90° via CSS */
.video.wide.rotated .video-inner {
  inset: auto; top: 50%; left: 50%;
  width: 100vh; width: 100dvh; height: 100vw;
  transform: translate(-50%, -50%) rotate(90deg);
}
.video.wide .btn-girar { display: none !important; }
.video.wide .btn-fechar { display: flex; }
.video.wide img { object-fit: contain; }
body.no-scroll { overflow: hidden; }
body.no-scroll .bottom-nav, body.no-scroll .topbar { visibility: hidden; }

/* =================== RESPONSIVIDADE =================== */
@media (max-width: 760px) {
  /* Menu superior vira só cabeçalho; navegação vai para a barra inferior */
  .topbar-inner { min-height: 48px; justify-content: space-between; gap: 12px; }
  .brand, .menu { display: none; }
  .user-mobile {
    display: flex; align-items: center; gap: 8px; min-width: 0;
    font-size: .9rem; font-weight: 500; color: var(--text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .user-mobile::before {                       /* bolinha de "logado" */
    content: ""; flex: 0 0 8px; height: 8px; border-radius: 50%; background: var(--success);
  }
  .sair-mobile {
    display: block; flex: none; color: var(--error); font-weight: 600; font-size: .92rem;
    text-decoration: none; padding: 8px 4px 8px 12px;
  }
  .sair-mobile:active { opacity: .7; }

  /* Menu inferior: ícone + legenda */
  .bottom-nav {
    display: flex; gap: 2px;
    position: fixed; z-index: 20;
    left: 50%; transform: translateX(-50%);
    bottom: calc(10px + env(safe-area-inset-bottom));
    padding: 5px;
    background: rgba(255, 255, 255, .94);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: 0 8px 24px rgba(47, 58, 69, .18);
    max-width: calc(100vw - 16px);
  }
  .bottom-nav a {
    width: 64px; height: 54px; border-radius: 17px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    color: var(--muted); text-decoration: none;
    transition: background .2s, color .2s;
  }
  .bottom-nav a svg { width: 22px; height: 22px; }
  .nav-legenda { font-size: .66rem; font-weight: 600; line-height: 1; letter-spacing: .01em; white-space: nowrap; }
  .bottom-nav a.active { background: var(--primary); color: #fff; }
  @media (max-width: 360px) { .bottom-nav a { width: 56px; } .nav-legenda { font-size: .6rem; } }
  .bottom-nav a:not(.active):active { background: var(--primary-soft); }

  body.app { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
  .content { padding: 18px 12px 24px; }
  .panel { padding: 22px 18px; border-radius: 12px; }
  .panel h1 { font-size: 1.35rem; }
  .btn { width: 100%; }
  .evo-row { padding: 14px 12px; }
  .evo-nav { width: 100%; }
  .evo-nav .btn-sm { flex: 1; }
  .hide-mobile { display: none; }
  /* Tabelas viram cartões no celular */
  table.table-cards thead { display: none; }
  table.table-cards, table.table-cards tbody, table.table-cards tr, table.table-cards td { display: block; width: 100%; }
  table.table-cards tr { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px; margin-bottom: 10px; background: #fbfcfd; }
  table.table-cards td { border: none; padding: 6px 0; display: grid; grid-template-columns: 96px 1fr; gap: 8px; align-items: start; text-align: left; }
  table.table-cards td > .hint { grid-column: 2; margin-top: -4px; }
  table.table-cards td::before { content: attr(data-label); font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); padding-top: 2px; }
  table.table-cards td.acao, table.table-cards td.acoes { display: flex; gap: 8px; padding-top: 10px; justify-content: stretch; }
  table.table-cards td.acao::before, table.table-cards td.acoes::before { display: none; }
  table.table-cards td.acao form, table.table-cards td.acoes .btn { flex: 1; }
  table.table-cards td.acoes .btn + .btn { margin-left: 0; }
  table.table-cards td.acao .btn { width: 100% !important; }
  tr.row-new td:first-child { box-shadow: none; }
  .dash-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat-value { font-size: 1.5rem; }
  .bar-row { grid-template-columns: 1fr 44px; }
  .bar-label { grid-column: 1 / -1; }
  .bar-row[data-tip]:hover::after { left: 0; white-space: normal; }
  .field-prazo input { max-width: none; }
  .modal-acoes .btn { flex: 1; }
  .filtros { grid-template-columns: 1fr 1fr; }
  .cta-auto { flex-direction: column; align-items: stretch; }
  .tl-item { flex-basis: 72vw; }
  .acao-pilha { display: flex; width: 100%; min-width: 0; }
  table.table-cards td.acao .acao-pilha form { flex: none; }
  .acoes-final .btn { width: 100%; }
}

/* Botão de girar aparece no celular (tela estreita ou toque) */
@media (max-width: 760px), (pointer: coarse) {
  .video:not(.video-placeholder) .btn-girar { display: flex; }
}

@media (max-width: 480px) {
  body.login-page { align-items: flex-start; padding: 24px 16px; }
  .login-card { padding: 28px 20px 22px; border-radius: 12px; }
  .login-card h1 { font-size: 1.5rem; }
}

.msg a { color: var(--primary); font-weight: 600; }
