/* ====== Fontes MyCamp (alojadas localmente, funciona offline) ====== */
@font-face {
  font-family: "Jaapokki";
  src: url("/assets/fonts/Jaapokki-Regular.woff") format("woff");
  font-weight: normal; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Raleway";
  src: url("/assets/fonts/Raleway.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
}

:root {
  /* Paleta oficial MyCamp (do Manual de Normas / website) */
  --mc-red: #dd0020;
  --mc-red-dark: #aa0019;
  --mc-green: #61b232;
  --mc-green-dark: #4e9128;
  --mc-yellow: #fbbe11;

  --bg: #f4edee;
  --card: #ffffff;
  --ink: #26201f;
  --muted: #837a79;
  --line: #ece2e3;
  --primary: var(--mc-red);
  --ok: var(--mc-green);
  --ok-bg: #eaf6e1;
  --falta: var(--mc-red);
  --falta-bg: #fdeced;
  --alert: #c0102a;
  --alert-bg: #fdecec;
  --shadow: 0 1px 3px rgba(70,20,25,.08);
  --shadow-lg: 0 14px 44px rgba(120,20,30,.18);

  --display: "Jaapokki", "Raleway", system-ui, sans-serif;
  --body: "Raleway", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--body); background: var(--bg); color: var(--ink); }
h1, h2, .display { font-family: var(--display); letter-spacing: .01em; font-weight: 400; }
.muted { color: var(--muted); font-size: 14px; }
.err { color: var(--alert); font-size: 14px; margin-top: 8px; min-height: 18px; font-weight: 600; }
code { background: #f4e3e5; padding: 1px 6px; border-radius: 5px; font-size: 13px; }

/* ====== Botoes ====== */
.btn-primary, .btn-ghost {
  font-family: var(--body); font-size: 15px; font-weight: 700; padding: 10px 20px;
  border-radius: 999px; cursor: pointer; border: 2px solid transparent; transition: transform .1s, filter .12s;
}
.btn-primary { background: var(--mc-red); color: #fff; }
.btn-primary:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn-ghost { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--mc-red); color: var(--mc-red); }
.btn-primary:disabled { opacity: .55; cursor: default; transform: none; }

/* ====== Login ====== */
.login-page { display: grid; place-items: center; min-height: 100vh; padding: 20px;
  background: radial-gradient(circle at 50% -10%, #fff 0%, var(--bg) 60%); }
.login-card {
  background: var(--card); border-radius: 22px; box-shadow: var(--shadow-lg);
  padding: 14px 34px 34px; width: 100%; max-width: 380px; text-align: center;
}
.login-logo { width: 168px; height: auto; margin: 0 auto 6px; display: block; }
.login-card h1 { font-size: 21px; margin: 14px 0 4px; color: var(--mc-red); }
.login-card form { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }
.login-card input {
  padding: 14px 16px; font-size: 16px; font-family: var(--body); border: 2px solid var(--line);
  border-radius: 14px; text-align: center; transition: border-color .12s;
}
.login-card input:focus { outline: none; border-color: var(--mc-red); }

/* ====== Topbar ====== */
.topbar { background: var(--mc-red); position: sticky; top: 0; z-index: 20; box-shadow: 0 2px 10px rgba(120,10,25,.15); }
.topbar.admin { background: var(--mc-red-dark); }
.topbar-in { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; gap: 18px; padding: 11px 20px; }
.logo-mark { height: 24px; width: auto; display: block; }
.brand { display: flex; align-items: center; gap: 11px; font-size: 17px; color: #fff; }
.brand .sep { width: 1px; height: 22px; background: rgba(255,255,255,.4); }
.brand .cdot { width: 15px; height: 15px; border-radius: 50%; background: #fff; border: 2px solid rgba(255,255,255,.7); }
.brand strong { font-family: var(--display); font-weight: 400; letter-spacing: .02em; }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 14px; color: rgba(255,255,255,.85); }
.crumbs a { color: #fff; text-decoration: none; font-weight: 600; }
.crumbs a:hover { text-decoration: underline; }
.navlink { color: #fff; text-decoration: none; font-weight: 700; font-size: 14.5px; padding: 7px 13px; border-radius: 999px; background: rgba(255,255,255,.16); white-space: nowrap; }
.navlink:hover { background: #fff; color: var(--mc-red); }
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.topbar .btn-ghost { background: rgba(255,255,255,.15); color: #fff; border-color: rgba(255,255,255,.5); }
.topbar .btn-ghost:hover { background: #fff; color: var(--mc-red); border-color: #fff; }
.conn { font-size: 12px; color: rgba(255,255,255,.9); display: flex; align-items: center; gap: 6px; }
.conn .dot { width: 8px; height: 8px; border-radius: 50%; background: #aef0a0; box-shadow: 0 0 0 2px rgba(255,255,255,.25); }
.conn.off .dot { background: var(--mc-yellow); }

/* ====== Layout ====== */
.wrap { max-width: 1100px; margin: 0 auto; padding: 28px 20px 64px; }
.page-title { font-size: 27px; margin: 0 0 4px; }
.count-badge { font-family: var(--body); font-size: 15px; background: var(--mc-red); color: #fff; border-radius: 999px; padding: 2px 12px; vertical-align: middle; margin-left: 8px; font-weight: 700; }
.hero { background: var(--card); border-radius: 20px; padding: 24px 28px; box-shadow: var(--shadow); margin-bottom: 22px; border-top: 5px solid var(--mc-red); }
.hero-title { font-family: var(--display); font-size: 26px; color: var(--mc-red); margin: 0; line-height: 1.15; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.stat { font-size: 15px; font-weight: 700; padding: 7px 15px; border-radius: 999px; }
.stat b { font-weight: 800; }
.stat.total { background: #f3ebec; color: var(--ink); }
.stat.boys { background: #e9f1fd; color: #1d4ed8; }
.stat.girls { background: #fcecf3; color: #be185d; }

/* ====== Dois caminhos ====== */
.paths { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 26px; }
.path {
  position: relative; text-align: left; border: none; cursor: pointer; border-radius: 22px; padding: 30px;
  display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow); overflow: hidden;
  color: var(--ink); transition: transform .12s, box-shadow .12s; font-family: var(--body);
}
.path::after { content: ""; position: absolute; right: -30px; bottom: -30px; width: 120px; height: 120px; border-radius: 50%; opacity: .12; }
.path:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.path.falta { background: var(--falta-bg); box-shadow: inset 0 0 0 2px #f6c9cf, var(--shadow); }
.path.falta::after { background: var(--mc-red); }
.path.feito { background: var(--ok-bg); box-shadow: inset 0 0 0 2px #c2e6ad, var(--shadow); }
.path.feito::after { background: var(--mc-green); }
.path.tardio { background: #fff7e0; box-shadow: inset 0 0 0 2px #fbe09a, var(--shadow); }
.path.tardio::after { background: var(--mc-yellow); }
.path-num { font-family: var(--display); font-size: 54px; line-height: 1; }
.path.falta .path-num { color: var(--mc-red); }
.path.feito .path-num { color: var(--mc-green-dark); }
.path.tardio .path-num { color: #b45309; }
.path-label { font-family: var(--display); font-size: 21px; margin-top: 8px; }
.path-sub { font-size: 14px; color: var(--muted); font-weight: 600; }

/* ====== Lista / grelha ====== */
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.title-row { display: flex; align-items: center; gap: 12px; }
.title-row .page-title { margin: 0; }
.backbtn { width: 42px; height: 42px; flex: 0 0 auto; padding: 0; border-radius: 12px; border: 2px solid var(--line); background: var(--card); color: var(--mc-red); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: border-color .12s, background .12s; }
.backbtn svg { display: block; }
.backbtn:hover { border-color: var(--mc-red); background: var(--falta-bg); }
.list-head #search { padding: 12px 16px; font-size: 15px; font-family: var(--body); border: 2px solid var(--line); border-radius: 999px; min-width: 270px; background: var(--card); }
.list-head #search:focus { outline: none; border-color: var(--mc-red); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 13px; }

/* Duas colunas: Rapazes / Raparigas */
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
.col { border-radius: 18px; padding: 15px 15px 17px; }
.col.boys { background: #e9f1fd; }
.col.girls { background: #fcecf3; }
.col.span2 { grid-column: 1 / -1; background: #f1eeef; }
.col-head { font-family: var(--display); font-weight: 400; font-size: 19px; margin: 0 0 13px; padding: 0 3px 10px;
  border-bottom: 3px solid var(--line); display: flex; justify-content: space-between; align-items: baseline; }
.col-head span { font-family: var(--body); font-weight: 800; font-size: 14px; color: inherit; opacity: .75; }
.col-head.boys { color: #1d4ed8; border-color: #a9caf9; }
.col-head.girls { color: #be185d; border-color: #f4b3d1; }
.col-list { display: flex; flex-direction: column; gap: 11px; }
.empty-col { color: var(--muted); padding: 16px; text-align: center; border: 2px dashed rgba(0,0,0,.13); border-radius: 14px; }
.kid {
  background: var(--card); border: 2px solid var(--line); border-radius: 16px; padding: 15px 17px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 7px;
}
.kid { cursor: pointer; transition: transform .1s, box-shadow .1s, border-color .1s; }
.kid:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.kid.falta:hover { border-color: var(--mc-red); }
.kid.done { background: var(--ok-bg); border-color: #c2e6ad; }
.kid.done:hover { border-color: var(--mc-green); }
.kid.tardio { background: #fff8e8; border-color: #fce3a0; }
.kid.tardio:hover { border-color: var(--mc-yellow); }
.kid-late { font-size: 13px; font-weight: 800; color: #b45309; }
.tardio-nota { margin-top: 9px; }
.tardio-nota.hidden { display: none; }
.tardio-nota input { width: 100%; padding: 8px 10px; font: inherit; font-size: 13.5px; border: 1.5px solid #fbe09a; border-radius: 9px; background: #fffdf6; }
.tardio-nota input:focus { outline: none; border-color: var(--mc-yellow); }
.fld-tarde { background: #fffdf3; border-color: #fbe5a8; }
.kid-name { font-size: 16.5px; font-weight: 700; }
.kid-sub { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { background: #f3ebec; border-radius: 7px; padding: 2px 9px; font-size: 12.5px; font-weight: 700; }
.tag.alert { background: var(--alert-bg); color: var(--alert); }
.tag.tarde { background: #fff7ed; color: #b45309; }
.fld-hint { font-size: 11px; color: var(--muted); margin-top: 6px; }
.kid-go { font-size: 13.5px; font-weight: 800; color: var(--mc-red); margin-top: 2px; }
.kid-ok { font-size: 13px; font-weight: 800; color: var(--mc-green-dark); }
.kid-edit { font-size: 12.5px; font-weight: 800; color: var(--mc-green-dark); opacity: .7; }
.kid.done:hover .kid-edit { opacity: 1; }
.empty { grid-column: 1/-1; text-align: center; color: var(--muted); padding: 54px 20px; font-size: 16px; }

/* ====== Popup de check-in ====== */
dialog { border: none; }
dialog::backdrop { background: rgba(40,8,12,.5); }
.checkin-dialog { border-radius: 22px; padding: 0; width: 860px; max-width: 96vw; max-height: 94vh; box-shadow: var(--shadow-lg); overflow: hidden; }
/* IMPORTANTE: o flex só quando aberto — senão anula o `display:none` que esconde o <dialog> fechado (o popup ficaria visível mesmo depois de fechar). */
.checkin-dialog[open] { display: flex; flex-direction: column; }
.ci-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 15px 24px; background: var(--mc-red); color: #fff; flex-shrink: 0; }
.ci-head h2 { margin: 0; font-size: 28px; color: #fff; line-height: 1.05; }
.ci-sub { font-size: 15.5px; color: #fff; font-weight: 700; margin-top: 7px; letter-spacing: .01em; }
.ci-head .x { background: none; border: none; font-size: 30px; line-height: 1; cursor: pointer; color: rgba(255,255,255,.85);
  display: flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; margin: -6px -10px -6px 0; border-radius: 10px; flex: 0 0 auto; }
.ci-head .x:hover { color: #fff; background: rgba(255,255,255,.15); }
.ci-head .x:active { background: rgba(255,255,255,.25); }

.ci-body { display: grid; grid-template-columns: 1.15fr 1fr; gap: 22px; padding: 18px 24px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.ci-col { display: flex; flex-direction: column; gap: 14px; }
.ci-blocktitle { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; font-weight: 800; color: var(--muted); margin-bottom: 8px; }

#contactos { display: flex; flex-direction: column; gap: 7px; }
.contact-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 7px; }
.contact-row input { padding: 10px 11px; font: inherit; font-size: 14.5px; border: 1.5px solid var(--line); border-radius: 9px; min-width: 0; }
.contact-row input:focus { outline: none; border-color: var(--mc-red); }
.contact-row .c-del { border: none; background: #f3ebec; color: var(--muted); border-radius: 9px; width: 32px; cursor: pointer; font-size: 18px; }
.contact-row .c-del:hover { background: var(--alert-bg); color: var(--alert); }
.contact-row .c-nome-ro { display: flex; align-items: center; padding: 8px 10px; font-size: 14px; font-weight: 700; background: #f3ebec; border: 1.5px solid var(--line); border-radius: 9px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-row .c-spacer { width: 32px; }

.restr-edit { display: flex; flex-direction: column; gap: 8px; }
.restr-edit label { display: flex; flex-direction: column; gap: 3px; font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.restr-edit textarea { font: inherit; font-size: 14px; font-weight: 400; text-transform: none; letter-spacing: normal; color: var(--ink); padding: 9px 11px; border: 1.5px solid var(--line); border-radius: 9px; resize: vertical; min-height: 52px; }
.restr-edit textarea:focus { outline: none; border-color: var(--mc-red); }
.addc { margin-top: 8px; background: none; border: 1.5px dashed var(--line); color: var(--mc-red); font: inherit; font-weight: 700; font-size: 13px; padding: 7px 12px; border-radius: 9px; cursor: pointer; }
.addc:hover { border-color: var(--mc-red); }

.restr { display: flex; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.restr:last-child { border-bottom: none; }
.restr-l { flex: 0 0 108px; color: var(--muted); font-weight: 700; }
.restr-v { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.restr.has .restr-v { color: var(--alert); font-weight: 600; }

textarea#ci-obs { width: 100%; resize: vertical; font: inherit; font-size: 14.5px; padding: 11px 13px; border: 1.5px solid var(--line); border-radius: 10px; min-height: 104px; }
textarea#ci-obs:focus { outline: none; border-color: var(--mc-red); }

.fld { background: #faf6f7; border: 1.5px solid var(--line); border-radius: 12px; padding: 11px 13px; }
.fld-label { font-size: 13px; font-weight: 700; }
.money { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.money-in { display: inline-flex; align-items: center; gap: 4px; background: #fff; border: 1.5px solid var(--line); border-radius: 9px; padding: 4px 10px; font-weight: 700; }
.money-in input { border: none; outline: none; width: 84px; font: inherit; font-weight: 700; text-align: right; }

.swrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; font-weight: 700; cursor: pointer; }
.switch { position: relative; flex: 0 0 auto; display: inline-flex; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { display: block; width: 46px; height: 26px; border-radius: 999px; background: #d8cdce; transition: background .15s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .15s; }
.switch input:checked + .track { background: var(--mc-green); }
.switch input:checked + .track::after { transform: translateX(20px); }
.subsw { margin-top: 9px; padding-top: 9px; border-top: 1px dashed var(--line); }
.subsw.hidden { display: none; }

.ci-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px; border-top: 1px solid var(--line); background: #fbf8f8; flex-shrink: 0; }

/* Ecrã estreito: uma coluna (o corpo faz scroll, por isso nunca corta). */
@media (max-width: 700px) {
  .checkin-dialog { max-width: 100vw; max-height: 96vh; border-radius: 16px; }
  .ci-body { grid-template-columns: 1fr; }
}
/* Ecrã baixo: compactar para reduzir a necessidade de scroll. */
@media (max-height: 760px) {
  .ci-head { padding: 11px 22px; }
  .ci-head h2 { font-size: 22px; }
  .ci-sub { font-size: 14px; margin-top: 4px; }
  .ci-body { padding: 12px 22px; gap: 14px; }
  .ci-col { gap: 10px; }
  .ci-blocktitle { margin-bottom: 5px; }
  .restr-edit textarea { min-height: 40px; }
  textarea#ci-obs { min-height: 64px; }
  .fld { padding: 8px 12px; }
  .ci-actions { padding: 10px 22px; }
}

/* ====== Admin ====== */
.admin-wrap { max-width: 900px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 24px 26px; box-shadow: var(--shadow); margin-bottom: 20px; }
.panel h2 { font-size: 19px; margin: 0 0 6px; color: var(--mc-red-dark); }
.ghost-panel { background: transparent; box-shadow: none; border-style: dashed; border-color: #d9c7c9; }
.row { display: flex; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.panel input[type=text], .panel input[type=password], .panel input[type=file] {
  padding: 10px 13px; font-size: 15px; font-family: var(--body); border: 2px solid var(--line); border-radius: 11px; background: var(--card); }
.panel input:focus { outline: none; border-color: var(--mc-red); }
/* Tabelas largas (passwords, semanas) fazem scroll horizontal dentro do painel em ecrãs estreitos. */
.table-scroll { margin-top: 14px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll .coord-table { margin-top: 0; }
.pass-table { min-width: 640px; }
.coord-table { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 15px; }
.coord-table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 10px; border-bottom: 2px solid var(--line); font-weight: 800; }
.coord-table td { padding: 10px; border-bottom: 1px solid var(--line); }
.coord-table tr.inactive { opacity: .42; }
.coord-table .pw { width: 160px; }
.pass-table { font-size: 14px; }
.pass-table .pw { width: 108px; }
.pass-table th, .pass-table td { padding: 8px 7px; }
.navlink-static { color: rgba(255,255,255,.9); font-size: 13.5px; font-weight: 700; }
.faixa-tag { font-family: var(--body); font-size: 12.5px; font-weight: 700; color: #fff; background: rgba(255,255,255,.18); padding: 2px 10px; border-radius: 999px; }

/* ===== Equipas (monitor) ===== */
.lock-banner { background: #fff7ed; border: 1.5px solid #fed7aa; color: var(--falta); border-radius: 12px; padding: 11px 15px; font-weight: 700; margin-bottom: 16px; }
.teams-bar { display: flex; gap: 9px; flex-wrap: wrap; margin-bottom: 18px; }
.team-chip { font: inherit; font-weight: 700; font-size: 14px; padding: 8px 15px; border-radius: 999px; border: 2px solid var(--line); background: var(--card); cursor: pointer; display: flex; align-items: center; gap: 8px; }
.team-chip span { font-size: 12px; background: #f3ebec; color: var(--muted); border-radius: 999px; padding: 1px 8px; font-weight: 800; }
.team-chip.active { border-color: var(--mc-red); color: var(--mc-red); }
.team-chip.active span { background: var(--mc-red); color: #fff; }

.ecols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.ecol { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 15px 16px; box-shadow: var(--shadow); }
.ecol.target { background: #fbf6f7; border-color: #f0d8dc; }
.ecol-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.ecol-head h2 { font-size: 18px; margin: 0; }
.ecol-head #search { padding: 9px 13px; font-size: 14px; border: 1.5px solid var(--line); border-radius: 999px; min-width: 150px; }
.ekid-list { display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.ekid { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--card); border: 1.5px solid var(--line); border-radius: 12px; padding: 9px 12px; cursor: pointer; transition: border-color .1s, transform .1s; }
.ekid:hover { border-color: var(--mc-red); transform: translateY(-1px); }
.ecol.target .ekid { background: #fff; }
.ekid.sx-f { box-shadow: inset 3px 0 0 #f6a8cd; }
.ekid.sx-m { box-shadow: inset 3px 0 0 #8fb6f0; }
.ekid-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ekid-name { font-weight: 700; font-size: 14.5px; }
.ekid-chips { display: flex; gap: 5px; flex-wrap: wrap; }
.ch { font-size: 11px; font-weight: 800; padding: 1px 7px; border-radius: 6px; }
.ch-pen { background: #e7f6ec; color: #137a3a; }
.ch-sc { background: #fdf0e2; color: #b45309; }
.ch-ip { background: #e8effd; color: #1d4ed8; }
.ch-tardio { background: #fff4d6; color: #9a6a00; }
.ekid-act { flex: 0 0 auto; font-size: 12.5px; font-weight: 800; color: var(--muted); }
.ekid:hover .ekid-act { color: var(--mc-red); }
.mobile-tabs { display: none; }

/* Monitor em telemóvel: 1 coluna + separadores Disponíveis / A minha equipa */
@media (max-width: 700px) {
  .ecols { grid-template-columns: 1fr; }
  .mobile-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
  .mobile-tabs button { flex: 1; font: inherit; font-weight: 800; font-size: 14px; padding: 12px 8px; border-radius: 12px; border: 2px solid var(--line); background: var(--card); color: var(--muted); cursor: pointer; }
  .mobile-tabs button.active { border-color: var(--mc-red); color: var(--mc-red); }
  .mobile-tabs button span { background: #f3ebec; border-radius: 999px; padding: 1px 8px; font-size: 12.5px; }
  .mobile-tabs button.active span { background: var(--mc-red); color: #fff; }
  .ecols.show-pool .ecol.target { display: none; }
  .ecols.show-team .ecol:not(.target) { display: none; }
  .ecol { padding: 12px; }
  .ecol-head { flex-direction: column; align-items: stretch; gap: 10px; }
  .ecol-head #search { width: 100%; min-width: 0; padding: 13px 15px; font-size: 16px; }   /* 16px evita zoom no iOS */
  .ekid { padding: 14px 14px; }
  .ekid-name { font-size: 16px; }
  .ekid-act { font-size: 14px; }
  .team-chip { padding: 11px 16px; font-size: 15px; }
  .teams-bar { gap: 8px; }
  .faixa-tag { display: none; }
  .navlink-static { display: none; }
  .wrap { padding: 16px 12px 50px; }
}

/* ===== Coordenador ===== */
.coord-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 16px; }
.coord-head { min-width: 0; }
.coord-stat { margin: 2px 0 0; font-size: 14px; font-weight: 700; color: var(--muted); }
.coord-stat .late, .team-card-head .mf.late { color: #9a6a00; }
.contacts { position: relative; min-width: 280px; flex: 1; max-width: 420px; }
.contacts #cq { width: 100%; padding: 11px 15px; font-size: 15px; border: 2px solid var(--line); border-radius: 999px; }
.contacts #cq:focus { outline: none; border-color: var(--mc-red); }
.cresults { position: absolute; left: 0; right: 0; top: 46px; z-index: 5; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); max-height: 320px; overflow: auto; }
.cresults:empty { display: none; }
.cres { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 9px 13px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.cres:last-child { border-bottom: none; }
.cres-nome { font-weight: 700; }
.cres-eq { font-size: 12px; color: var(--muted); }
.cres-tel { grid-column: 1/-1; color: var(--muted); }
.cres-tel a { color: var(--mc-red); font-weight: 700; text-decoration: none; }

.gen-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 18px; box-shadow: var(--shadow); margin-bottom: 18px; }
.gen-bar.locked { background: #f4fbf0; border-color: #c2e6ad; }
.gen-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.gen-bar .warn { color: var(--falta); }
.gen-bar .ok { color: var(--mc-green-dark); }
a.btn-primary { text-decoration: none; }

.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.team-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 13px 15px; box-shadow: var(--shadow); }
.team-card.sem-equipa { background: var(--falta-bg); border-color: #f6c9cf; margin-bottom: 16px; }
.team-card-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; border-bottom: 2px solid var(--line); padding-bottom: 8px; }
.team-card-head h3 { margin: 0; font-size: 16px; }
.team-card-head span { font-weight: 800; color: var(--muted); font-size: 13px; }
.team-card-head .mf { font-weight: 600; font-size: 12px; }
.crows { display: flex; flex-direction: column; gap: 6px; }
.crow { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px; border-radius: 9px; background: #faf8f8; }
.crow.sx-f { box-shadow: inset 3px 0 0 #f6a8cd; }
.crow.sx-m { box-shadow: inset 3px 0 0 #8fb6f0; }
.crow-name { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.crow .mover { font: inherit; font-size: 12px; border: 1px solid var(--line); border-radius: 8px; padding: 3px 5px; background: #fff; max-width: 120px; }
.crow .mover:disabled { opacity: .5; }

/* Equipas no admin */
.team-group { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.team-group-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 9px; flex-wrap: wrap; }
.team-items { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.team-item { display: inline-flex; align-items: center; gap: 6px; background: #f7f3f4; border: 1px solid var(--line); border-radius: 999px; padding: 4px 6px 4px 12px; font-weight: 700; font-size: 13.5px; }
.team-item em { font-style: normal; font-weight: 800; color: var(--mc-red); background: #fff; border-radius: 999px; padding: 0 7px; font-size: 12px; }
.team-item button { border: none; background: none; cursor: pointer; font-size: 14px; color: var(--muted); width: 20px; height: 20px; border-radius: 50%; }
.team-item .ti-del:hover { background: var(--alert-bg); color: var(--alert); }
.team-item .ti-ren:hover { background: #e8effd; color: var(--primary); }
.cs-dot, .coord-table .cs-dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; vertical-align: middle; margin-right: 4px; }

/* Estatísticas ao vivo */
.stats-panel { border-top: 5px solid var(--mc-red); }
.stats-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.sem-tag { font-family: var(--body); font-size: 14px; font-weight: 700; background: #f3ebec; color: var(--ink); padding: 3px 12px; border-radius: 999px; vertical-align: middle; }
.big-stat { display: flex; align-items: baseline; gap: 10px; margin: 14px 0 8px; flex-wrap: wrap; }
.big-num { font-family: var(--display); font-size: 46px; color: var(--mc-green-dark); line-height: 1; }
.big-of { font-size: 17px; color: var(--muted); font-weight: 600; }
.big-pct { margin-left: auto; font-family: var(--display); font-size: 30px; color: var(--mc-red); }
.big-late { font-size: 15px; font-weight: 800; color: #b45309; margin-left: 12px; }
.bar-outer { display: flex; height: 14px; background: #efe7e8; border-radius: 999px; overflow: hidden; }
.bar-inner { background: linear-gradient(90deg, var(--mc-green), #8fd861); transition: width .4s ease; }
.bar-late { background: var(--mc-yellow); transition: width .4s ease; }
.coord-stats { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.cs-row { display: grid; grid-template-columns: 130px 1fr 70px; align-items: center; gap: 12px; }
.cs-name { font-weight: 700; font-size: 14px; }
.cs-bar { display: flex; height: 10px; background: #efe7e8; border-radius: 999px; overflow: hidden; }
.cs-fill { transition: width .4s ease; }
.cs-late { background: var(--mc-yellow); transition: width .4s ease; }
.cs-num { font-weight: 800; font-size: 13px; color: var(--muted); text-align: right; }
.t-late { color: #b45309; font-weight: 800; font-size: 12px; }

/* Semanas + ações */
.badge-ativa { font-size: 10.5px; font-weight: 800; background: var(--mc-green); color: #fff; padding: 1px 7px; border-radius: 999px; margin-left: 6px; vertical-align: middle; }
tr.sem-active { background: #f4fbf0; }
.sem-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.mini { font: inherit; font-size: 12.5px; font-weight: 700; padding: 5px 11px; border-radius: 8px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; text-decoration: none; display: inline-block; }
.mini:hover { border-color: var(--mc-red); color: var(--mc-red); }
.mini.danger:hover { border-color: var(--alert); color: var(--alert); }

/* Backups */
.bk-list { list-style: none; padding: 0; margin: 14px 0 0; max-height: 200px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.bk-list li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 13px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.bk-list li:last-child { border-bottom: none; }
.topbar.admin .conn .dot { background: #aef0a0; }
.topbar.admin .conn.off .dot { background: var(--mc-yellow); }

/* Mudar criança de coordenação */
.movekid #mkSearch { width: 100%; max-width: 420px; padding: 11px 15px; font: inherit; font-size: 15px; border: 1.5px solid var(--line); border-radius: 999px; margin-top: 14px; }
.movekid #mkSearch:focus { outline: none; border-color: var(--mc-red); }
.mk-results { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.mk-results:empty { display: none; }
.mk-empty { padding: 8px 2px; }
.mk-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; background: var(--card); }
.mk-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mk-nome { font-weight: 700; font-size: 15px; }
.mk-meta { font-size: 12.5px; color: var(--muted); }
.mk-act { display: flex; align-items: center; gap: 8px; }
.mk-arrow { color: var(--muted); font-weight: 800; }
.mk-dest { font: inherit; font-size: 13.5px; border: 1.5px solid var(--line); border-radius: 8px; padding: 6px 8px; background: #fff; cursor: pointer; }
.mk-go { white-space: nowrap; }

/* ====== Responsivo ====== */
@media (max-width: 640px) {
  .paths { grid-template-columns: 1fr; }
  .cols { grid-template-columns: 1fr; }
  .topbar-in { flex-wrap: wrap; gap: 10px; }
  .ci-grid { grid-template-columns: 1fr; }
  /* Painéis e listas mais compactos no telemóvel/tablet estreito */
  .wrap { padding: 20px 12px 48px; }
  .panel { padding: 18px 16px; border-radius: 14px; }
  .panel h2 { font-size: 17px; }
  .big-num { font-size: 40px; }
  /* Lista do coordenador: equipas numa coluna e barra de contactos a 100% */
  .team-grid { grid-template-columns: 1fr; }
  .coord-top { flex-direction: column; }
  .contacts { max-width: none; width: 100%; min-width: 0; }
}
