/* =====================================================================================
   Mão a Mão — base compartilhada por todas as telas: fontes, tipografia, logo, botões, topo,
   sidebar e carregando. Carregue este arquivo primeiro. Cores, fontes e raios vêm de
   shared/ds/tokens.css (única fonte); aqui não há valor de cor literal.
   Guia: docs/GUIA-DESIGN-VERSAO-B.md
   ===================================================================================== */
@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@400;500;600&display=swap");
@import url("/shared/ds/tokens.css");

*, *::before, *::after { box-sizing: border-box; }
body { font-family: var(--font-sans); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg); }
h1, h2, h3 { font-family: var(--font-sans); font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
/* rótulo de seção e de grupo */
.mm-label { font: 500 12px/1.3 var(--font-mono); text-transform: uppercase; letter-spacing: .1em; color: var(--text-soft); }
/* número, ficha, relógio: sempre mono e tabular */
.mm-num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 2px; }

/* ---------- logo ---------- */
.mm-logo { display: inline-flex; align-items: center; gap: 10px; font: 600 18px/1 var(--font-sans); letter-spacing: -0.02em; color: var(--text); text-decoration: none; white-space: nowrap; }
.mm-chip {
  flex: none; width: 28px; height: 28px;
  background: url('/logo-icon.png') center / contain no-repeat;
  filter: drop-shadow(0 0 8px rgba(79, 134, 247, 0.45));
}

/* ---------- topo (telas sem sidebar: entrar, conta, sistema, home game) ---------- */
.mm-top { position: sticky; top: 0; z-index: 50; background: var(--bg); border-bottom: 1px solid var(--line); font-family: var(--font-sans); }
.mm-top-in { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; height: 64px; display: flex; align-items: center; gap: 24px; }
.mm-nav { display: flex; gap: 2px; padding: 3px; background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r-sm); }
.mm-nav a { white-space: nowrap; display: inline-flex; align-items: center; min-height: 32px; padding: 0 14px; border-radius: 4px; color: var(--text-dim); text-decoration: none; font-weight: 500; font-size: 14px; transition: background-color .15s, color .15s; }
.mm-nav a:hover { color: var(--text); }
.mm-nav a.on { color: var(--text); background: var(--surface-3); }
.mm-account { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--text-dim); min-width: 0; }
.mm-account-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-dim); text-decoration: none; font-weight: 500; }
.mm-account-name:hover { color: var(--text); text-decoration: underline; }
.mm-plan { display: inline-block; text-decoration: none; padding: 2px 10px; border-radius: var(--r-pill); background: var(--surface-3); color: var(--text); font: 500 12px var(--font-sans); white-space: nowrap; }
.mm-plan.none { background: var(--surface-2); color: var(--text-soft); }

/* ---------- botões ---------- */
.mm-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px; border-radius: var(--r-sm); border: 1px solid transparent; cursor: pointer;
  font: 500 14px/1 var(--font-sans); text-decoration: none;
  transition: background-color .15s, border-color .15s, color .15s;
}
/* primário: .mm-btn-gold é o nome antigo */
.mm-btn-primary, .mm-btn-gold { background: var(--accent); color: var(--on-accent); }
.mm-btn-primary:hover, .mm-btn-gold:hover { background: var(--accent-soft); }
.mm-btn-primary:active, .mm-btn-gold:active { background: var(--accent-deep); color: var(--text); }
/* secundário */
.mm-btn-ghost { background: transparent; color: var(--text); border-color: var(--line-strong); }
.mm-btn-ghost:hover { background: var(--surface-3); }
.mm-btn-sm { min-height: 32px; padding: 0 12px; font-size: 13px; }
.mm-btn:disabled { opacity: .5; cursor: not-allowed; }
@media (pointer: coarse), (max-width: 560px) { .mm-btn, .mm-btn-sm { min-height: 44px; } }

/* ---------- carregando (enquanto o login responde) ---------- */
.hidden { display: none !important; }
.mm-loader { display: none; }
body.mm-loading .mm-loader {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  position: fixed; inset: 0; z-index: 40; color: var(--text-dim); font: 400 14px var(--font-sans);
}
body.mm-loading .mm-loader .mm-chip { width: 44px; height: 44px; border-radius: 12px; animation: mm-spin 1.2s linear infinite;
  box-shadow: 0 0 20px rgba(79, 134, 247, 0.5); }
body.mm-loading main, body.mm-loading .app { visibility: hidden; }
@keyframes mm-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { body.mm-loading .mm-loader .mm-chip { animation: none; } }

@media (max-width: 640px) {
  .mm-top-in { gap: 10px; padding: 0 14px; height: 56px; }
  .mm-logo { font-size: 0; gap: 0; }           /* no celular, só a ficha */
  .mm-nav a { padding: 0 10px; }
  .mm-account-name { display: none; }
}
@media (max-width: 420px) { .mm-plan { display: none; } }

/* ---------- sidebar (240px): estudo e áreas logadas ---------- */
.mm-shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.mm-main { min-width: 0; }
.mm-side { position: sticky; top: 0; align-self: start; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 28px; padding: 24px 16px; background: var(--surface-1); border-right: 1px solid var(--line); font-family: var(--font-sans); }
.mm-side .mm-logo { padding: 0 8px; }
.mm-side-group, .mm-side .tabs { position: static; display: flex; flex-direction: column; flex-wrap: nowrap; gap: 2px; padding: 0; background: none; border: 0; }
.mm-side-group .mm-label { padding: 0 12px 8px; }
.mm-side-group .tab-btn, .mm-side-link {
  position: relative; display: flex; align-items: center; width: 100%; min-height: 40px; padding: 0 12px;
  border: 0; border-radius: var(--r-sm); background: none; color: var(--text-dim);
  font: 500 14px var(--font-sans); letter-spacing: 0; text-transform: none; text-align: left; text-decoration: none; cursor: pointer;
  transition: background-color .15s, color .15s;
}
.mm-side-group .tab-btn:hover, .mm-side-link:hover { color: var(--text); background: var(--surface-3); }
.mm-side-group .tab-btn.active, .mm-side-link.on { background: var(--surface-3); color: var(--text); }
.mm-side-group .tab-btn.active::before, .mm-side-link.on::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 2px; border-radius: 2px; background: var(--accent); }
.mm-side .mm-account { margin: auto 0 0; flex-direction: column; align-items: stretch; gap: 10px; padding-top: 16px; border-top: 1px solid var(--line); }
.mm-side .mm-account-name { font-weight: 600; color: var(--text); }
.mm-side .mm-plan { align-self: flex-start; }
@media (max-width: 860px) {
  .mm-shell { display: block; }
  .mm-side { position: sticky; top: 0; z-index: 45; height: auto; flex-direction: row; flex-wrap: nowrap; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--line); background: var(--surface-1); }
  .mm-side .mm-side-group, .mm-side .tabs { display: none; }
  .mm-side-group .mm-label { display: none; }
  .mm-side .mm-account { margin: 0; flex-direction: row; align-items: center; padding: 0; border: 0; }
  
  .mm-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 60;
    background: var(--surface-1);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    height: calc(56px + env(safe-area-inset-bottom, 0px));
    align-items: center;
    justify-content: space-around;
  }
  .mm-bottom-nav a, .mm-bottom-nav button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    flex: 1;
    height: 100%;
    color: var(--text-dim);
    text-decoration: none;
    font: 500 11px/1.1 var(--font-sans);
    background: none;
    border: none;
    padding: 4px 0;
    cursor: pointer;
    min-height: 44px;
    transition: color .15s, background-color .15s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }
  .mm-bottom-nav a:hover, .mm-bottom-nav button:hover {
    color: var(--text);
  }
  .mm-bottom-nav a.active, .mm-bottom-nav a.on,
  .mm-bottom-nav button.active, .mm-bottom-nav button.on {
    color: var(--accent-soft);
  }
  .mm-bottom-nav .mm-bnav-icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .mm-bottom-nav .mm-bnav-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  
  .mm-main, main.wrap, main.ct {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important;
  }
  body.has-tabbar .mm-bottom-nav { display: none !important; }
}
.mm-bottom-nav { display: none; }


