/* Painel no celular: visual de aplicativo. Carregado só em telas estreitas (index.html, media);
   no computador nada daqui vale. */
:root {
  --m-bg: #0d0f14; --m-card: #171a22; --m-card-2: #1d212b; --m-line: #232733; --m-text: #eef0f4; --m-muted: #8d93a1;
  --m-green: #2fcf74; --m-green-ink: #06210f;
  --m-ok-bg: #173d2a; --m-ok: #5fe39a; --m-warn-bg: #3d3214; --m-warn: #f5c84a;
  --m-bad-bg: #40191b; --m-bad: #ff7b7f; --m-info-bg: #1b2a40; --m-info: #7fb2ff;
  --accent: var(--m-green); --accent-text: var(--m-green-ink); --surface: var(--m-card); --surface-2: var(--m-card-2);
  --border: var(--m-line); --bg: var(--m-bg); --muted: var(--m-muted); --text: var(--m-text);
  --ok: var(--m-ok); --warn: var(--m-warn); --bad: var(--m-bad);
}
body { background: var(--m-bg); font-size: 15px; -webkit-tap-highlight-color: transparent; }

/* Estrutura: barra no topo, conteúdo e abas embaixo (fora da área do gesto do sistema). */
.m-app { min-height: 100vh; padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
.m-top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top));
  background: rgba(13, 15, 20, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--m-line);
}
.m-logo { width: 112px; height: auto; display: block; }
.m-conn-label { color: var(--m-muted); font-size: 11px; }
main.m-main { padding: 14px 14px 8px; max-width: none; }
.m-main h2 { font-size: 22px; font-weight: 600; margin: 4px 2px 12px; }
.m-tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(18, 20, 27, .96); backdrop-filter: blur(10px); border-top: 1px solid var(--m-line);
  padding-bottom: env(safe-area-inset-bottom);
}
.m-tabs a {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 0 10px;
  color: #7d8391; font-size: 11px;
}
.m-tabs a svg { width: 24px; height: 24px; }
.m-tabs a.on { color: var(--m-green); }
.m-badge {
  position: absolute; top: 4px; left: calc(50% + 6px); min-width: 18px; padding: 0 5px; border-radius: 999px;
  background: #ff5a5f; color: #fff; font-size: 11px; line-height: 18px; text-align: center;
}
.m-badge.zero { display: none; }

/* Peças */
.m-sub { color: var(--m-muted); font-size: 12.5px; }
.m-center { text-align: center; }
.m-card, .panel { background: var(--m-card); border: 0; border-radius: 18px; padding: 14px; margin-bottom: 12px; }
.m-card h3, .panel h3 { font-size: 15px; font-weight: 600; margin: 0 0 6px; }
.m-hello { margin: 2px 2px 12px; }
.m-hello h2 { margin: 2px 0 0; }
.m-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.m-stat { background: var(--m-card); border-radius: 16px; padding: 12px 14px; color: var(--m-text); }
.m-stat b { display: block; font-size: 24px; font-weight: 600; margin-top: 2px; }
.m-stat b.bad, .bad { color: var(--m-bad); }
.m-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 2px; border-top: 1px solid var(--m-line);
  color: var(--m-text); width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; border-radius: 0; text-align: left;
}
.m-card h3 + .m-row, .m-list > .m-row:first-child { border-top: 0; }
.m-list { padding: 2px 14px; }
.m-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.m-row-title { color: var(--m-text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-ic { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: var(--m-card-2); color: #c9cdd6; flex: none; }
.m-ic svg { width: 20px; height: 20px; }
.m-ic.ok { background: var(--m-ok-bg); color: var(--m-ok); }
.m-ic.warn { background: var(--m-warn-bg); color: var(--m-warn); }
.m-ic.bad { background: var(--m-bad-bg); color: var(--m-bad); }
.m-ic.info { background: var(--m-info-bg); color: var(--m-info); }
.m-chev { color: #5d6372; display: inline-flex; }
.m-chev svg { width: 20px; height: 20px; }
.m-avatar {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; flex: none;
  background: var(--m-ok-bg); color: var(--m-ok);
}
.m-avatar.violet { background: #2c2440; color: #b9a5ff; }
.m-avatar.blue { background: var(--m-info-bg); color: var(--m-info); }
.m-avatar.amber { background: var(--m-warn-bg); color: var(--m-warn); }
.m-avatar.pink { background: #3d1a2c; color: #ff8cc6; }
.m-chip { display: inline-block; white-space: nowrap; border-radius: 999px; padding: 3px 10px; font-size: 12px; background: var(--m-card-2); color: #dfe2ea; }
.m-chip.ok { background: var(--m-ok-bg); color: var(--m-ok); }
.m-chip.warn { background: var(--m-warn-bg); color: var(--m-warn); }
.m-chip.bad { background: var(--m-bad-bg); color: var(--m-bad); }
.m-chip.big { padding: 7px 14px; font-size: 13.5px; }
.m-chip.on { background: var(--m-green); color: var(--m-green-ink); font-weight: 600; }
.m-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 8px; }
.m-chips:empty { display: none; }
.m-chips-scroll { display: flex; gap: 8px; overflow-x: auto; margin: 0 -14px 12px; padding: 0 14px 2px; scrollbar-width: none; }
.m-chips-scroll::-webkit-scrollbar { display: none; }
.m-empty { text-align: center; color: var(--m-muted); padding: 40px 0; }
.m-empty svg { width: 40px; height: 40px; opacity: .5; }
.m-back { display: inline-flex; align-items: center; gap: 2px; color: var(--m-muted); margin: 0 0 10px; }
.m-back svg { width: 22px; height: 22px; }

/* Botões grandes, para o polegar */
button, a.button { border-radius: 12px; min-height: 42px; padding: 9px 14px; }
button.primary, a.button.primary { background: var(--m-green); border-color: var(--m-green); color: var(--m-green-ink); }
.m-actions { display: flex; gap: 10px; align-items: center; margin-top: 12px; }
.m-btn { flex: 1; min-height: 46px; border-radius: 14px; border: 0; background: var(--m-card-2); color: #dfe2ea; font-weight: 500; }
.m-btn.primary { background: var(--m-green); color: var(--m-green-ink); font-weight: 600; }
.m-btn.danger { color: var(--m-bad); }
.m-link { display: block; margin: 10px auto 0; background: none; border: 0; min-height: 0; padding: 4px; color: var(--m-muted); font-size: 13px; }
.m-link.danger { color: var(--m-bad); }

/* Pedido */
.m-req-head { display: flex; gap: 12px; align-items: center; }
.m-req .m-row-title { font-size: 16px; }

/* Assinantes */
.m-search { margin-bottom: 10px; }
.m-search input { border-radius: 14px; padding: 12px 14px; background: var(--m-card); border-color: var(--m-line); font-size: 16px; }

/* Assinante */
.m-profile { text-align: center; display: flex; flex-direction: column; align-items: center; }
.m-profile .m-avatar { width: 56px; height: 56px; font-size: 22px; margin-bottom: 6px; }
.m-profile h2 { margin: 0; font-size: 20px; }
.m-profile .m-chips { justify-content: center; }
.m-profile-stats { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; margin-top: 6px; }
.m-profile-stats b { display: block; font-size: 17px; font-weight: 600; }
details.m-sec { background: var(--m-card); border-radius: 18px; margin-bottom: 10px; overflow: hidden; }
details.m-sec > summary {
  list-style: none; display: flex; justify-content: space-between; align-items: center; padding: 15px 16px; font-weight: 500; cursor: pointer;
}
details.m-sec > summary::-webkit-details-marker { display: none; }
details.m-sec[open] > summary .m-chev { transform: rotate(90deg); }
details.m-sec .panel { margin: 0; padding: 0 16px 14px; border-radius: 0; }
details.m-sec .panel > h3 { display: none; }
.kv { grid-template-columns: 120px minmax(0, 1fr); }

/* Tabelas que continuam (aparelhos, histórico, outras páginas): cartões sem borda */
tr { background: var(--m-card-2); border: 0; border-radius: 14px; }
.panel tr { background: var(--m-card-2); }

/* Janelas viram painéis que sobem de baixo, com a alça no topo */
dialog {
  margin: auto 0 0; width: 100%; max-width: none; max-height: 88vh; overflow-y: auto;
  border: 0; border-radius: 22px 22px 0 0; padding: 26px 18px calc(18px + env(safe-area-inset-bottom));
  background: #1a1d26; animation: m-sheet .22s ease-out;
}
dialog::before {
  content: ""; position: absolute; top: 9px; left: 50%; width: 38px; height: 4px; margin-left: -19px;
  border-radius: 2px; background: #3a3f4d;
}
dialog .toolbar { flex-wrap: nowrap; }
dialog .toolbar button { flex: 1; min-height: 46px; }
@keyframes m-sheet { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }

/* Avisos acima das abas */
#toasts { left: 14px; right: 14px; bottom: calc(76px + env(safe-area-inset-bottom)); }
.toast { max-width: none; border-radius: 14px; background: #232733; border-color: var(--m-green); }

/* Tela de login */
.center .box { border: 0; border-radius: 22px; background: var(--m-card); }
.center input { border-radius: 12px; padding: 12px; font-size: 16px; }
.m-list-title { padding-top: 12px; }
.m-dev .m-row-title { white-space: normal; }
.m-btn.small { flex: none; min-height: 36px; padding: 6px 14px; font-size: 13px; }

/* Formulários de editar/adicionar no painel que sobe de baixo */
dialog.m-form-sheet .panel { background: none; padding: 0; margin: 0; border-radius: 0; }
dialog.m-form-sheet .actions, dialog.m-form-sheet .toolbar { display: flex; gap: 10px; margin-top: 14px; }
dialog.m-form-sheet .actions button, dialog.m-form-sheet .toolbar button { flex: 1; min-height: 46px; }
