/* =====================================================================
   mobile.css — kit de UI mobile nativo do FLAVOR (Fase 0)
   Base compartilhada das telas mobile. Só é aplicado em telas nativas
   (o desktop segue com o CSS próprio de cada página).
   Escopo: tudo dentro de .m-app (evita colidir com o CSS desktop).
   Paleta e componentes vêm da pegada do app.html.
   ===================================================================== */

:root {
  --m-bg: #f4f5f2;
  --m-card: #ffffff;
  --m-card-2: #f0f1ed;
  --m-ink: #14150e;
  --m-soft: #7c7d72;
  --m-faint: #adaea3;
  --m-line: rgba(0,0,0,0.055);
  --m-line-2: rgba(0,0,0,0.10);
  --m-green: #4ad07f;
  --m-green-bright: #34c46f;
  --m-green-a: #e4f8ea;
  --m-green-b: #8fe6ab;
  --m-green-c: #5bd991;
  --m-dark: #16170f;
  --m-red: #c0503f;
  --m-red-a: #f6e4df;
  --m-amber: #93761f;
  --m-amber-a: #f5efd6;
  --m-green-ink: #2f6b45;
  --m-ui: 'Inter', -apple-system, system-ui, sans-serif;
}
.m-app {
  font-family: var(--m-ui);
  color: var(--m-ink);
  -webkit-font-smoothing: antialiased;
  line-height: 1.4;
}
.m-sheet, .m-sheet-bg { font-family: var(--m-ui); color: var(--m-ink); }
.m-app * { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* quando o layout mobile está ativo, esconde o desktop e pinta o fundo */
html.m-on, html.m-on body { background: #f4f5f2 !important; }
html.m-on body > *:not(.m-app):not(.m-sheet):not(.m-sheet-bg):not(#cloud-gate):not(script):not(style) { display: none !important; }
.m-app { display: none; }
html.m-on .m-app { display: block; max-width: 520px; margin: 0 auto; min-height: 100vh;
  padding: calc(env(safe-area-inset-top) + 14px) 18px calc(env(safe-area-inset-bottom) + 24px); }

/* ---------- header (com voltar) ---------- */
.m-hdr { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.m-back { width: 42px; height: 42px; border-radius: 14px; background: var(--m-card); border: 1px solid var(--m-line);
  display: flex; align-items: center; justify-content: center; color: var(--m-ink); flex-shrink: 0; cursor: pointer; text-decoration: none; }
.m-back:active { transform: scale(.95); }
.m-htitle { min-width: 0; }
.m-eyebrow { font-size: 12px; color: var(--m-soft); margin-bottom: 2px; }
.m-title { font-size: 27px; font-weight: 700; letter-spacing: -1px; line-height: 1.05; }
.m-hdr-actions { margin-left: auto; display: flex; gap: 8px; }
.m-sqbtn { width: 42px; height: 42px; border-radius: 14px; background: var(--m-dark); color: #fff;
  border: none; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
.m-sqbtn.ghost { background: var(--m-card); color: var(--m-ink); border: 1px solid var(--m-line); }
.m-sqbtn:active { transform: scale(.95); }

/* ---------- busca ---------- */
.m-search { display: flex; align-items: center; gap: 10px; background: var(--m-card); border: 1px solid var(--m-line);
  border-radius: 16px; padding: 0 14px; height: 50px; margin-bottom: 14px; }
.m-search svg { color: var(--m-faint); flex-shrink: 0; }
.m-search input { flex: 1; border: none; background: transparent; font-family: inherit; font-size: 15px; color: var(--m-ink); outline: none; }

/* ---------- chips ---------- */
.m-chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin-bottom: 16px; padding-bottom: 2px; }
.m-chips::-webkit-scrollbar { display: none; }
.m-chip { flex-shrink: 0; font-size: 13.5px; font-weight: 500; padding: 10px 16px; border-radius: 14px;
  background: var(--m-card); border: 1px solid var(--m-line); color: var(--m-soft); cursor: pointer; white-space: nowrap; }
.m-chip.on { background: var(--m-dark); color: #fff; border-color: var(--m-dark); }
.m-chip:active { transform: scale(.97); }

/* ---------- cards / rows ---------- */
.m-card { background: var(--m-card); border-radius: 20px; padding: 18px; margin-bottom: 12px; }
.m-sec { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--m-faint); margin: 20px 2px 10px; }
.m-row { display: flex; align-items: center; gap: 14px; background: var(--m-card); border-radius: 18px;
  padding: 15px 16px; margin-bottom: 10px; cursor: pointer; }
.m-row:active { transform: scale(.99); }
.m-av { width: 46px; height: 46px; border-radius: 14px; flex-shrink: 0; overflow: hidden; background: var(--m-card-2);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; color: var(--m-soft); }
.m-av img { width: 100%; height: 100%; object-fit: cover; }
.m-av.green { background: var(--m-green-a); color: var(--m-green-ink); }
.m-mid { flex: 1; min-width: 0; }
.m-name { font-size: 16px; font-weight: 600; letter-spacing: -0.2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-sub { font-size: 13px; color: var(--m-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.m-right { text-align: right; flex-shrink: 0; }
.m-val { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.m-note { font-size: 11.5px; color: var(--m-soft); margin-top: 2px; }
.m-chev { color: var(--m-faint); flex-shrink: 0; font-size: 20px; }

/* badges */
.m-badge { font-size: 10.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; display: inline-block; white-space: nowrap; }
.m-badge.green { background: var(--m-green-a); color: var(--m-green-ink); }
.m-badge.amber { background: var(--m-amber-a); color: var(--m-amber); }
.m-badge.red { background: var(--m-red-a); color: var(--m-red); }
.m-badge.gray { background: var(--m-card-2); color: var(--m-soft); }

/* ---------- stats ---------- */
.m-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.m-stat { background: var(--m-card); border-radius: 20px; padding: 16px 18px; }
.m-stat .k { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--m-faint); }
.m-stat .v { font-size: 24px; font-weight: 700; letter-spacing: -0.6px; margin-top: 6px; font-variant-numeric: tabular-nums; }
.m-stat .s { font-size: 12px; color: var(--m-soft); margin-top: 2px; }

/* ---------- botões ---------- */
.m-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  padding: 15px; border-radius: 999px; border: none; background: var(--m-dark); color: #fff;
  font-family: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
.m-btn.ghost { background: var(--m-card); color: var(--m-ink); border: 1px solid var(--m-line-2); }
.m-btn.danger { background: var(--m-card); color: var(--m-red); border: 1px solid var(--m-red-a); }
.m-btn:active { transform: scale(.98); }

/* ---------- empty ---------- */
.m-empty { text-align: center; padding: 48px 24px; color: var(--m-faint); }
.m-empty svg { width: 42px; height: 42px; color: var(--m-faint); margin-bottom: 10px; }
.m-empty strong { display: block; color: var(--m-ink); font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.m-empty p { font-size: 14px; color: var(--m-soft); max-width: 300px; margin: 0 auto 18px; line-height: 1.5; }

/* ---------- bottom-sheet ---------- */
.m-sheet-bg { position: fixed; inset: 0; background: rgba(20,20,15,0.42); z-index: 200; display: none; }
.m-sheet-bg.on { display: block; }
.m-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 201; max-width: 520px; margin: 0 auto;
  background: var(--m-bg); border-radius: 26px 26px 0 0; padding: 10px 20px calc(env(safe-area-inset-bottom) + 20px);
  transform: translateY(100%); transition: transform .28s cubic-bezier(.2,.8,.2,1); max-height: 92vh; overflow-y: auto; }
.m-sheet.on { transform: none; }
.m-grip { width: 40px; height: 5px; border-radius: 999px; background: var(--m-line-2); margin: 8px auto 18px; }
.m-sheet-title { font-size: 20px; font-weight: 700; letter-spacing: -0.4px; margin-bottom: 16px; }
.m-field { margin-bottom: 14px; }
.m-field label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--m-soft); margin-bottom: 6px; }
.m-input { width: 100%; padding: 13px 14px; border: 1.5px solid var(--m-card-2); border-radius: 12px; background: var(--m-card);
  font-family: inherit; font-size: 15px; color: var(--m-ink); }
.m-input:focus { outline: none; border-color: var(--m-ink); }
textarea.m-input { resize: vertical; min-height: 72px; }
.m-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------- FAB ---------- */
.m-fab { position: fixed; right: 20px; bottom: calc(env(safe-area-inset-bottom) + 22px); z-index: 60;
  width: 58px; height: 58px; border-radius: 20px; background: var(--m-dark); color: #fff; border: none;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 10px 26px rgba(0,0,0,0.22); cursor: pointer; }
.m-fab:active { transform: scale(.94); }

@keyframes m-fade { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
html.m-on .m-screen { animation: m-fade .22s ease; }
@media (prefers-reduced-motion: reduce) { html.m-on .m-screen, .m-sheet { animation: none; transition: none; } }
