/* Meu Futebol Pro — estilos (mobile-first) */
:root {
  --bg: #04170c; --bg2: #072414; --card: #0b2e1a; --card2: #0f3a22; --line: rgba(255,255,255,.09);
  --green: #3ddc84; --green-d: #0f5a32; --gold: #f5c542; --gold-d: #b8901c; --text: #eef8f1; --muted: #9fb7a8;
  --danger: #ff6b6b; --orange: #ff9f1c; --blue: #4fb3ff; --radius: 16px;
  --nav-h: 66px; --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; min-height: 100vh; overscroll-behavior-y: contain;
  background: radial-gradient(120% 60% at 50% -10%, #0e4a2a 0%, var(--bg) 60%) fixed; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--green); }
svg { stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.field-svg, .goal-svg { stroke: none; fill: none; }
.field-svg *, .goal-svg * { stroke-linecap: butt; }
[hidden] { display: none !important; }

/* Topo */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; padding: calc(10px + var(--safe-t)) 14px 10px;
  background: rgba(4,23,12,.88); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand h1 { font-size: 18px; margin: 0; font-weight: 800; letter-spacing: .2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo svg { width: 28px; height: 28px; color: var(--gold); }
.logo .pent { fill: var(--gold); stroke: none; }
.icon-btn { background: var(--card); border: 1px solid var(--line); border-radius: 12px; width: 40px; height: 40px; display: grid; place-items: center; cursor: pointer; }
.icon-btn svg { width: 22px; height: 22px; }
.banner { background: #1c3b2a; color: var(--text); padding: 8px 14px; font-size: 13px; text-align: center; }
.banner.gold { background: var(--gold); color: #1c1600; }
.link { background: none; border: 0; text-decoration: underline; font-weight: 700; cursor: pointer; }

main { padding: 14px 14px calc(var(--nav-h) + 24px + var(--safe-b)); max-width: 720px; margin: 0 auto; outline: none; }

/* Navegação inferior */
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b); background: rgba(5,26,14,.96); backdrop-filter: blur(10px); border-top: 1px solid var(--line); }
.bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 600; }
.bottom-nav a svg { width: 23px; height: 23px; }
.bottom-nav a.active { color: var(--gold); }
.bottom-nav .nav-main .plus { width: 46px; height: 46px; margin-top: -22px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--green), #17a058); color: #04170c; box-shadow: 0 6px 18px rgba(61,220,132,.35); border: 3px solid var(--bg); }
.bottom-nav .nav-main .plus svg { stroke-width: 3; }

/* Blocos */
h2 { font-size: 17px; margin: 22px 0 10px; display: flex; align-items: center; gap: 8px; }
h2:first-child { margin-top: 4px; }
h3 { font-size: 15px; margin: 14px 0 8px; }
.card { background: linear-gradient(180deg, var(--card2), var(--card)); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.card.gold { border-color: rgba(245,197,66,.45); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.hr { height: 1px; background: var(--line); margin: 12px 0; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.kpis.k2 { grid-template-columns: repeat(2, 1fr); }
.kpi { background: linear-gradient(160deg, #10462a, #0a2c19); border: 1px solid var(--line); border-radius: 14px; padding: 12px 10px; text-align: center; min-width: 0; }
.kpi b { display: block; font-size: 26px; font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi span { display: block; font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.kpi.hl { border-color: rgba(245,197,66,.5); background: linear-gradient(160deg, #3d3410, #1d2a12); }
.kpi.hl b { color: var(--gold); }
.kpi.g b { color: var(--green); }
.kpi.o b { color: var(--orange); }

/* Hero início */
.hero { display: flex; gap: 14px; align-items: center; }
.avatar { width: 64px; height: 64px; border-radius: 18px; background: #134d2e center/cover no-repeat; border: 2px solid var(--gold); flex: none; display: grid; place-items: center; color: var(--gold); font-weight: 900; font-size: 24px; }
.hero h2 { margin: 0; font-size: 20px; }
.chips-line { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; background: rgba(255,255,255,.08); font-size: 12px; color: var(--text); }
.tag.gold { background: rgba(245,197,66,.16); color: var(--gold); }
.tag.green { background: rgba(61,220,132,.15); color: var(--green); }
.tag.red { background: rgba(255,107,107,.15); color: var(--danger); }
.tag.warn { background: rgba(255,159,28,.15); color: var(--orange); }

/* Botões */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 16px; border-radius: 12px; border: 1px solid transparent;
  background: var(--green); color: #04170c; font-weight: 800; cursor: pointer; text-decoration: none; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.block { width: 100%; }
.btn.gold { background: linear-gradient(145deg, #ffd766, var(--gold)); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn.soft { background: var(--card2); color: var(--text); border-color: var(--line); }
.btn.danger { background: var(--danger); color: #2b0000; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn svg { width: 18px; height: 18px; }
.actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.action { display: flex; gap: 10px; align-items: center; padding: 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); text-decoration: none; color: var(--text); font-weight: 700; }
.action svg { width: 24px; height: 24px; color: var(--gold); flex: none; }

/* Formulários */
label.f { display: block; margin-bottom: 12px; }
label.f > span, .flabel { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; font-weight: 600; }
input[type=text], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 12px; border: 1px solid #23573a; background: #06200f; color: var(--text); outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(61,220,132,.18); }
textarea { min-height: 70px; resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
.chips input { position: absolute; opacity: 0; pointer-events: none; }
.chips label { padding: 9px 13px; border-radius: 999px; border: 1px solid #23573a; background: #06200f; font-size: 13.5px; cursor: pointer; user-select: none; min-height: 38px; display: inline-flex; align-items: center; }
.chips input:checked + label { background: var(--green); color: #04170c; border-color: var(--green); font-weight: 800; }
.chips input:focus-visible + label { outline: 2px solid var(--gold); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; }
.switch input { width: 48px; height: 28px; appearance: none; background: #23573a; border-radius: 999px; position: relative; cursor: pointer; flex: none; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked { background: var(--green); }
.switch input:checked::after { left: 23px; }
.score { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: end; }
.score input { text-align: center; font-size: 26px; font-weight: 900; }
.score .x { padding-bottom: 12px; color: var(--muted); font-weight: 800; }
.err { color: var(--danger); font-size: 13px; margin: 6px 0; }
.errbox { background: rgba(255,107,107,.12); border: 1px solid rgba(255,107,107,.4); padding: 10px 12px; border-radius: 12px; color: #ffd1d1; font-size: 13.5px; margin-bottom: 12px; }
.note { background: rgba(245,197,66,.1); border: 1px solid rgba(245,197,66,.3); color: #f6e3a6; padding: 9px 12px; border-radius: 12px; font-size: 12.5px; margin: 8px 0 12px; }
.info { background: rgba(79,179,255,.1); border: 1px solid rgba(79,179,255,.3); color: #cfe9ff; padding: 9px 12px; border-radius: 12px; font-size: 12.5px; margin: 8px 0 12px; }

/* Listas */
.list { display: flex; flex-direction: column; gap: 8px; }
.item { display: flex; gap: 12px; align-items: center; padding: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; text-decoration: none; color: var(--text); cursor: pointer; }
.item .res { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-weight: 900; flex: none; }
.res.V { background: rgba(61,220,132,.18); color: var(--green); }
.res.E { background: rgba(245,197,66,.18); color: var(--gold); }
.res.D { background: rgba(255,107,107,.18); color: var(--danger); }
.res.N { background: rgba(255,255,255,.08); color: var(--muted); }
.item .main { flex: 1; min-width: 0; }
.item .title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .sub { font-size: 12.5px; color: var(--muted); }
.item .side { text-align: right; font-size: 13px; white-space: nowrap; }
.ev { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; background: #082615; border: 1px solid var(--line); border-radius: 12px; }
.ev .ic { flex: none; padding-top: 2px; }
.ev .main { flex: 1; min-width: 0; font-size: 13.5px; }
.ev .btns { display: flex; gap: 6px; }
.empty { text-align: center; padding: 26px 14px; color: var(--muted); }
.empty svg { width: 46px; height: 46px; color: var(--gold); opacity: .8; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th, table.t td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; }
table.t td.n, table.t th.n { text-align: right; font-variant-numeric: tabular-nums; }

/* Barras */
.bar { height: 10px; background: rgba(255,255,255,.08); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--green), var(--gold)); border-radius: 999px; transition: width .5s; }
.hbars .hb { display: grid; grid-template-columns: 110px 1fr 54px; gap: 8px; align-items: center; margin: 6px 0; font-size: 13px; }
.hbars .hb .bar { height: 8px; }

/* Período */
.period { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 12px; background: rgba(245,197,66,.08); border: 1px solid rgba(245,197,66,.25); margin-bottom: 12px; font-size: 13px; }
.period b { color: var(--gold); }
.period .grow { min-width: 0; }

/* Campo */
.field-wrap { background: #062614; border-radius: 14px; padding: 6px; border: 1px solid var(--line); }
.field-svg { width: 100%; height: auto; display: block; touch-action: manipulation; }
.field-svg.picker { cursor: crosshair; }
.field-svg .mk { cursor: pointer; }
.field-svg .mk.sel circle:last-child, .field-svg .mk.sel path, .field-svg .mk.sel rect:last-child { stroke: #fff; stroke-width: .8; }
.goal-svg { width: 100%; max-width: 360px; display: block; margin: 0 auto; cursor: crosshair; touch-action: manipulation; }
.legend { display: flex; flex-wrap: wrap; gap: 10px 14px; font-size: 12.5px; margin: 10px 2px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.seg { display: flex; background: #06200f; border: 1px solid #23573a; border-radius: 12px; padding: 3px; gap: 3px; margin-bottom: 10px; }
.seg button { flex: 1; min-height: 38px; border: 0; background: transparent; border-radius: 9px; font-weight: 700; font-size: 13px; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--green); color: #04170c; }
.detail { margin-top: 10px; }

/* Gráficos */
.chart { position: relative; height: 230px; }
.chart.tall { height: 290px; }

/* Cartão */
.card-preview { display: flex; justify-content: center; }
.card-preview canvas { width: 100%; max-width: 420px; height: auto; border-radius: 18px; box-shadow: 0 16px 40px rgba(0,0,0,.5); }

/* Metas */
.goal-card .top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.goal-card .big { font-size: 22px; font-weight: 900; }
.goal-card .chart { height: 120px; margin-top: 8px; }

/* Sheet / modal */
dialog { border: 0; padding: 0; color: var(--text); }
dialog::backdrop { background: rgba(0,0,0,.6); backdrop-filter: blur(2px); }
.sheet { width: 100%; max-width: 720px; margin: auto auto 0; max-height: 92vh; border-radius: 22px 22px 0 0; background: var(--bg2); border-top: 2px solid var(--gold); }
.sheet-inner { padding: 16px 14px calc(18px + var(--safe-b)); overflow-y: auto; max-height: 92vh; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sheet-head h3 { margin: 0; font-size: 17px; }
.modal { max-width: 360px; width: calc(100% - 32px); border-radius: 18px; background: var(--card2); padding: 18px; border: 1px solid var(--line); }
.modal p { margin: 0 0 16px; white-space: pre-line; }
details.box { background: #082615; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; }
details.box summary { cursor: pointer; font-weight: 700; font-size: 13.5px; }

#toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 18px + var(--safe-b)); transform: translateX(-50%) translateY(20px); opacity: 0; transition: .25s;
  background: #f1fff6; color: #04170c; padding: 11px 16px; border-radius: 12px; font-weight: 700; z-index: 100; max-width: calc(100% - 32px); box-shadow: 0 8px 24px rgba(0,0,0,.4); pointer-events: none; font-size: 14px; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: #ffe1e1; color: #5a0000; }

@media (min-width: 560px) { .kpis { grid-template-columns: repeat(4, 1fr); } .kpis.k3 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 360px) { .kpi b { font-size: 22px; } .grid3 { grid-template-columns: 1fr 1fr; } .hbars .hb { grid-template-columns: 90px 1fr 46px; } }

/* Relatório / impressão */
.report h1 { font-size: 22px; }
@media print {
  body { background: #fff !important; color: #000; }
  .topbar, .bottom-nav, .banner, .no-print, #toast { display: none !important; }
  main { padding: 0; max-width: none; }
  .card, .kpi { background: #fff !important; border-color: #ccc !important; color: #000; break-inside: avoid; }
  .kpi b, .kpi.hl b { color: #000 !important; } .kpi span, .muted { color: #444 !important; }
  table.t th, table.t td { border-color: #ccc; }
}
