/* Império Fitness — identidade: preto, dourado e verde */
:root {
  --bg: #0B0B0C;
  --surface: #16161A;
  --surface-2: #1E1E23;
  --line: #2A2A30;
  --gold: #D4AF37;
  --gold-light: #F5D77A;
  --gold-dark: #A8821E;
  --gold-grad: linear-gradient(135deg, #F5D77A 0%, #D4AF37 50%, #A8821E 100%);
  --green: #1FB85F;
  --green-soft: rgba(31, 184, 95, .14);
  --gold-soft: rgba(212, 175, 55, .12);
  --text: #F4F1E8;
  --muted: #A39E92;
  --danger: #E5484D;
  --radius: 16px;
  --nav-h: 68px;
  --font-title: 'Montserrat', system-ui, sans-serif;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.45; }
body { min-height: 100vh; overscroll-behavior-y: none; }
h1, h2, h3, h4 { font-family: var(--font-title); margin: 0; letter-spacing: -.01em; }
h1 { font-size: 1.55rem; font-weight: 800; }
h2 { font-size: 1.2rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }
a { color: var(--gold); }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.gold { color: var(--gold); }
.green { color: var(--green); }
.center { text-align: center; }
.hidden { display: none !important; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }
.gold-text { background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- layout ---------- */
.app { max-width: 720px; margin: 0 auto; padding: 0 16px calc(var(--nav-h) + 28px); }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; margin: 0 -16px 8px; background: rgba(11, 11, 12, .88); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-title); font-weight: 800; font-size: 1.05rem; letter-spacing: .02em; }
.brand img { width: 34px; height: 34px; border-radius: 9px; }
.brand small { display: block; font-size: .62rem; font-weight: 600; letter-spacing: .22em; color: var(--muted); }
.avatar { width: 38px; height: 38px; border-radius: 50%; border: 1.5px solid var(--gold); background: var(--surface); display: grid; place-items: center; font-weight: 700; color: var(--gold); cursor: pointer; }

.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: rgba(14, 14, 16, .96); backdrop-filter: blur(12px); border-top: 1px solid var(--line); display: flex; justify-content: center; }
.nav-inner { display: flex; width: 100%; max-width: 720px; }
.nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); text-decoration: none; font-size: .7rem; font-weight: 600; }
.nav a svg { width: 23px; height: 23px; }
.nav a.active { color: var(--gold); }
.nav a.active svg { filter: drop-shadow(0 0 6px rgba(212, 175, 55, .45)); }

/* ---------- componentes ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card.gold-border { border-color: rgba(212, 175, 55, .45); background: linear-gradient(160deg, rgba(212, 175, 55, .10), rgba(22, 22, 26, 1) 55%); }
.card + .card, .section + .section { margin-top: 14px; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 22px 2px 10px; }
.section-title h2 { font-size: 1.05rem; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); font-weight: 600; cursor: pointer; text-decoration: none; color: var(--text); transition: transform .08s, filter .15s; white-space: nowrap; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--gold-grad); color: #111; border: 0; font-weight: 700; }
.btn.success { background: var(--green); color: #04130A; border: 0; font-weight: 700; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: rgba(229, 72, 77, .35); background: transparent; }
.btn.block { width: 100%; }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: .85rem; border-radius: 10px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); display: inline-grid; place-items: center; cursor: pointer; flex: none; }
.icon-btn svg { width: 18px; height: 18px; }

.field { display: block; }
.field > span { display: block; font-size: .8rem; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.input, select.input, textarea.input { width: 100%; min-height: 46px; padding: 10px 14px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; outline: none; }
.input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

.tabs { display: flex; gap: 6px; padding: 5px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; margin: 6px 0 16px; }
.tabs button { flex: 1; min-height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 700; cursor: pointer; font-size: .9rem; }
.tabs button.active { background: var(--gold-grad); color: #111; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: .74rem; font-weight: 700; background: var(--gold-soft); color: var(--gold); border: 1px solid rgba(212, 175, 55, .3); }
.chip.green { background: var(--green-soft); color: var(--green); border-color: rgba(31, 184, 95, .3); }
.chip.gray { background: var(--surface-2); color: var(--muted); border-color: var(--line); }

.list { display: flex; flex-direction: column; gap: 8px; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.item.click { cursor: pointer; }
.item.click:active { background: var(--surface-2); }
.thumb { width: 54px; height: 54px; border-radius: 10px; object-fit: cover; background: #fff; flex: none; }
.item-title { font-weight: 600; }
.empty { text-align: center; padding: 28px 16px; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty b { color: var(--text); display: block; margin-bottom: 4px; }

/* hero / stats */
.hero h1 { margin: 8px 0 2px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.stat b { display: block; font-family: var(--font-title); font-size: 1.3rem; }
.stat span { font-size: .74rem; color: var(--muted); }
.progress { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 99px; background: var(--gold-grad); transition: width .4s; }
.progress.green > i { background: var(--green); }
.week-dots { display: flex; gap: 6px; }
.week-dots i { flex: 1; height: 10px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); }
.week-dots i.on { background: var(--green); border-color: var(--green); }

/* anel */
.ring { position: relative; width: 112px; height: 112px; flex: none; }
.ring svg { transform: rotate(-90deg); }
.ring .lbl { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; font-family: var(--font-title); font-weight: 800; font-size: 1.05rem; line-height: 1.1; }
.ring .lbl small { display: block; font-family: var(--font); font-weight: 500; font-size: .7rem; color: var(--muted); }

/* grupamentos */
.groups { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.group { padding: 16px 8px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); text-align: center; cursor: pointer; font-weight: 700; font-size: .86rem; }
.group .ic { font-size: 1.6rem; display: block; margin-bottom: 6px; }
.group:active, .group:hover { border-color: var(--gold); }

/* séries */
.sets { display: grid; grid-template-columns: 34px 1fr 1fr 34px; gap: 8px; align-items: center; }
.sets .h { font-size: .72rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.sets .n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold); font-weight: 800; font-size: .85rem; }
.sets .input { min-height: 42px; text-align: center; padding: 8px; }
.set-done { width: 34px; height: 34px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--bg); display: grid; place-items: center; cursor: pointer; color: transparent; }
.set-done.on { background: var(--green); border-color: var(--green); color: #04130A; }
.sets .input.row-done { border-color: rgba(31, 184, 95, .6); background: rgba(31, 184, 95, .06); }

/* modal (sheet) */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .66); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet { width: 100%; max-width: 720px; max-height: 92vh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-bottom: 0; border-radius: 22px 22px 0 0; padding: 8px 16px calc(20px + env(safe-area-inset-bottom)); animation: up .2s ease-out; }
.sheet-head { position: sticky; top: -8px; z-index: 2; display: flex; align-items: center; gap: 10px; padding: 14px 0 12px; background: var(--surface); }
.sheet-head h2 { flex: 1; font-size: 1.1rem; }
.grabber { width: 42px; height: 5px; border-radius: 9px; background: var(--line); margin: 4px auto 0; }
@media (min-width: 760px) { .overlay { align-items: center; } .sheet { border-radius: 22px; border-bottom: 1px solid var(--line); max-height: 86vh; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

/* demonstração do exercício */
.demo { position: relative; aspect-ratio: 4 / 3; border-radius: 14px; overflow: hidden; background: #fff; border: 1px solid var(--line); }
.demo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transition: opacity .35s ease-in-out; }
.demo img.f1 { animation: frame 1.8s infinite; }
@keyframes frame { 0%, 40% { opacity: 0; } 50%, 90% { opacity: 1; } 100% { opacity: 0; } }
.demo .tag { position: absolute; left: 10px; top: 10px; background: rgba(11, 11, 12, .82); color: var(--gold); font-size: .7rem; font-weight: 700; padding: 4px 8px; border-radius: 8px; }

/* diário de dieta */
.kcal-eq { display: flex; align-items: flex-start; justify-content: space-between; gap: 4px; margin-top: 12px; text-align: center; }
.kcal-eq > div { flex: 1; min-width: 0; }
.kcal-eq b { display: block; font-family: var(--font-title); font-size: 1.1rem; }
.kcal-eq span { display: block; font-size: .68rem; color: var(--muted); margin-top: 2px; }
.kcal-eq i { font-style: normal; color: var(--muted); font-weight: 700; padding-top: 2px; }
.kcal-eq .res b { font-size: 1.45rem; color: var(--green); }
.kcal-eq .res.neg b { color: var(--danger); }
.meal { padding: 0; overflow: hidden; }
.meal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.meal-head b { font-family: var(--font-title); }
.meal-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 16px; background: none; border: 0; border-bottom: 1px solid var(--line); text-align: left; cursor: pointer; }
.meal-item:active { background: var(--surface-2); }
.meal-foot { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 6px 16px; }
.link-btn { background: none; border: 0; color: var(--gold); font-weight: 800; font-size: .82rem; letter-spacing: .06em; cursor: pointer; padding: 10px 0; text-decoration: none; }

/* água */
.glass { position: relative; width: 120px; height: 168px; border: 3px solid rgba(244, 241, 232, .25); border-top: 0; border-radius: 0 0 26px 26px; overflow: hidden; flex: none; }
.glass .water { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(180deg, #34d27c, #1FB85F 60%, #148a46); transition: height .6s cubic-bezier(.2, .8, .2, 1); }
.glass .water::before { content: ''; position: absolute; left: -50%; top: -8px; width: 200%; height: 16px; background: radial-gradient(ellipse at center, rgba(255, 255, 255, .35), transparent 70%); animation: wave 3s linear infinite; }
@keyframes wave { to { transform: translateX(25%); } }
.glass .pct { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-title); font-weight: 800; font-size: 1.4rem; text-shadow: 0 1px 6px rgba(0, 0, 0, .6); }

/* gráficos */
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 10px; font-family: var(--font); }

/* timer descanso */
.rest-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 12px + env(safe-area-inset-bottom)); z-index: 40; width: calc(100% - 32px); max-width: 688px; background: var(--surface-2); border: 1px solid var(--gold); border-radius: 16px; padding: 12px 14px; display: flex; align-items: center; gap: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
.rest-bar b { font-family: var(--font-title); font-size: 1.5rem; color: var(--gold); min-width: 64px; }

/* auth */
.auth { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; max-width: 420px; margin: 0 auto; padding: 32px 20px; }
.auth .logo { width: 92px; height: 92px; margin: 0 auto 16px; border-radius: 24px; box-shadow: 0 0 40px rgba(212, 175, 55, .25); }
.auth h1 { text-align: center; font-size: 1.8rem; }
.auth .tag { text-align: center; color: var(--muted); margin: 6px 0 26px; }

/* toast */
.toast { position: fixed; left: 50%; top: 18px; transform: translateX(-50%); z-index: 99; background: var(--surface-2); border: 1px solid var(--line); border-left: 4px solid var(--gold); padding: 12px 16px; border-radius: 12px; font-weight: 600; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); animation: fade .2s; max-width: calc(100% - 32px); }
.toast.ok { border-left-color: var(--green); }
.toast.err { border-left-color: var(--danger); }

/* tabela admin */
.table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.table th, .table td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { color: var(--muted); font-weight: 600; font-size: .75rem; text-transform: uppercase; }
.table-wrap { overflow-x: auto; }

.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--gold); animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 380px) { .groups { grid-template-columns: repeat(2, 1fr); } .stats { grid-template-columns: repeat(3, 1fr); } .stat b { font-size: 1.1rem; } }
