/* ============================================================
   Ground Hub — MAv3 (Members Area v3)
   Shell global + componentes partilhados.
   Identidade: Black/Lime, Clash Display + Satoshi.
   Extraído dos mockups .dc.html (_mockups/). CSS por página em assets/css/pages/*.css
   ============================================================ */

@import url('https://api.fontshare.com/v2/css?f[]=clash-display@500,600,700&f[]=satoshi@400,500,700&display=swap');

:root {
  --bg: #F4F5F8;
  --card: #FFFFFF;
  --surface: #F3F4F7;
  --border: #ECEDF1;
  --ink: #14161C;
  --muted: #6B7280;
  --black: #0F1115;
  --lime: #C6FF33;
  --on-lime: #0A0A0A;
  --shadow: 0 10px 30px rgba(17,19,25,.05), 0 1px 2px rgba(17,19,25,.04);
  --shadow-hover: 0 18px 44px rgba(17,19,25,.10), 0 2px 6px rgba(17,19,25,.06);
  --r-card: 30px;
  --r-mid: 20px;
  --r-sm: 14px;
  --display: 'Clash Display', system-ui, sans-serif;
  --body: 'Satoshi', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

svg.ic {
  width: 20px; height: 20px; stroke: currentColor; stroke-width: 2;
  fill: none; stroke-linecap: round; stroke-linejoin: round; display: block;
}

:focus-visible { outline: 2px solid var(--black); outline-offset: 3px; border-radius: 8px; }

/* ---------- Shell ---------- */
.app {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 1720px;
  margin: 0 auto;
  padding: 18px;
  min-height: 100vh;
}
.app-body {
  display: grid;
  grid-template-columns: 76px 1fr 88px;
  gap: 24px;
  align-items: stretch;
}
.app-body[data-people="off"] { grid-template-columns: 76px 1fr; }
.app-body[data-people="off"] .people { display: none; }

/* ---------- Sidebar (escura, estreita, só ícones) ---------- */
.sidebar {
  background: var(--black);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}
.brand-avatar {
  width: 46px; height: 46px; border-radius: 50%;
  background: #fff; color: var(--black);
  display: grid; place-items: center;
  font-family: var(--display); font-weight: 700; font-size: 18px;
  box-shadow: 0 0 0 2px var(--black), 0 0 0 4px var(--lime);
  margin-bottom: 10px; flex-shrink: 0; align-self: center;
  text-decoration: none;
}
.side-nav { display: flex; flex-direction: column; align-items: stretch; gap: 6px; flex: 1; }
.s-item {
  position: relative;
  height: 46px; border-radius: 15px;
  display: grid; place-items: center;
  color: #9CA3AF; cursor: pointer; text-decoration: none;
  background: transparent; border: none; transition: background .18s, color .18s;
}
.s-item .ic { width: 21px; height: 21px; }
.s-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.s-item .s-new {
  position: absolute; top: 9px; right: 9px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--lime); box-shadow: 0 0 0 2px var(--black);
}
/* item ativo: o fundo da página "entra" no menu, curvas côncavas */
.s-item.active {
  background: var(--bg); color: var(--black);
  width: calc(100% + 14px); align-self: flex-start;
  border-radius: 16px 0 0 16px;
}
.s-item.active .ic { transform: translateX(-7px); }
.s-item.active::before, .s-item.active::after {
  content: ""; position: absolute; right: 0; width: 13px; height: 13px;
  background: var(--bg);
}
.s-item.active::before {
  top: -13px;
  -webkit-mask: radial-gradient(circle 13px at top left, #0000 98%, #000);
          mask: radial-gradient(circle 13px at top left, #0000 98%, #000);
}
.s-item.active::after {
  bottom: -13px;
  -webkit-mask: radial-gradient(circle 13px at bottom left, #0000 98%, #000);
          mask: radial-gradient(circle 13px at bottom left, #0000 98%, #000);
}
.s-div { width: 26px; height: 1px; background: rgba(255,255,255,.10); margin: 8px 0; align-self: center; }
.side-foot { display: flex; }
.side-foot .s-item { flex: 1; }

/* ---------- Main ---------- */
.main { display: flex; flex-direction: column; gap: 24px; min-width: 0; }

/* ---------- Topbar ---------- */
.topbar { display: flex; align-items: center; gap: 16px; padding: 4px 2px; margin-left: calc(76px + 24px); }
.topbar h1 { font-family: var(--display); font-weight: 600; font-size: 23px; letter-spacing: -.01em; }
.topbar .sub { color: var(--muted); font-size: 13px; margin-top: 1px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 14px; background: var(--card);
  border: 1px solid var(--border); color: var(--ink); cursor: pointer;
  display: grid; place-items: center; position: relative; transition: .18s; box-shadow: var(--shadow);
  text-decoration: none;
}
.icon-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-hover); }
.lang-btn { font-weight: 800; font-size: 13px; letter-spacing: .04em; }
.icon-btn .dot {
  position: absolute; top: 11px; right: 12px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 2px var(--card);
}
.icon-btn .dot.warn { background: #F59E0B; }
.user-cap {
  display: flex; align-items: center; gap: 11px; padding: 7px 8px 7px 16px;
  background: var(--card); border: 1px solid var(--border); border-radius: 999px;
  box-shadow: var(--shadow); cursor: pointer; transition: .18s; text-decoration: none;
}
.user-cap:hover { transform: translateY(-1px); box-shadow: var(--shadow-hover); }
.user-cap .nm { line-height: 1.15; text-align: right; }
.user-cap .nm b { font-size: 13.5px; }
.user-cap .nm span { font-size: 11.5px; color: var(--muted); display: block; }
.user-cap .pic {
  width: 36px; height: 36px; border-radius: 50%; background: var(--black);
  color: #fff; display: grid; place-items: center; font-family: var(--display); font-weight: 600;
  object-fit: cover;
}

/* ticker / barra de destaques */
.ticker { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.ticker-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--lime); flex-shrink: 0;
  animation: tickPulse 2.2s infinite;
}
@keyframes tickPulse {
  0%   { box-shadow: 0 0 0 0 rgba(198,255,51,.55); }
  70%  { box-shadow: 0 0 0 7px rgba(198,255,51,0); }
  100% { box-shadow: 0 0 0 0 rgba(198,255,51,0); }
}
.ticker-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); flex-shrink: 0;
}
.ticker-rot { position: relative; height: 24px; flex: 1; min-width: 0; }
.ticker-rot .ti {
  position: absolute; inset: 0; line-height: 24px; font-size: 14px; font-weight: 500;
  color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  opacity: 0; transform: translateY(7px); transition: opacity .5s, transform .5s;
}
.ticker-rot .ti b { color: var(--ink); font-weight: 700; }
.ticker-rot .ti.is-active { opacity: 1; transform: translateY(0); }

/* ---------- Card genérico ---------- */
.card {
  background: var(--card); border-radius: var(--r-card);
  box-shadow: var(--shadow); padding: 24px;
}

/* ---------- CTA / botões comuns ---------- */
.cta {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 9px;
  background: var(--lime); color: var(--on-lime); font-weight: 700; font-size: 14.5px;
  padding: 13px 22px; border-radius: 999px; border: none; cursor: pointer;
  text-decoration: none; transition: transform .18s, box-shadow .18s;
}
.cta:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(198,255,51,.32); }
.ghost {
  background: transparent; border: none; color: var(--muted); font-weight: 600; font-size: 13px;
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: color .18s;
  text-decoration: none;
}
.ghost:hover { color: var(--ink); }
.ghost svg { width: 16px; height: 16px; }

/* ---------- Chips ---------- */
.chip {
  font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  display: inline-block;
}
.chip.open, .chip.due { background: var(--black); color: #fff; }
.chip.done, .chip.paid { background: var(--surface); color: var(--muted); }

/* ---------- Week strip / calendário ---------- */
.week { background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow); padding: 12px 18px; }
.week-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.week-head .wh-title { font-family: var(--display); font-weight: 600; font-size: 14px; }
.week-nav { display: flex; gap: 8px; }
.week-nav button {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--card); color: var(--ink); cursor: pointer;
  display: grid; place-items: center; transition: background .18s;
}
.week-nav button:hover { background: var(--surface); }
.week-nav button svg { width: 16px; height: 16px; }
.week-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.day {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 7px 0; border-radius: 13px; cursor: pointer; transition: background .18s;
}
.day:hover { background: var(--surface); }
.day .dow { font-size: 10px; font-weight: 600; color: var(--muted); }
.day .dnum { font-family: var(--display); font-weight: 600; font-size: 14px; }
.day.today { background: var(--black); }
.day.today .dow { color: rgba(255,255,255,.6); }
.day.today .dnum { color: #fff; }
.day.has-ev::after {
  content: ""; position: absolute; bottom: 4px;
  width: 4px; height: 4px; border-radius: 50%; background: var(--lime);
}

/* ---------- Wallet (carteira Grounds) ---------- */
.wallet {
  background: var(--lime); color: var(--on-lime); border-radius: var(--r-card);
  padding: 24px; box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.wallet .top { display: flex; align-items: center; justify-content: space-between; }
.wallet .wchip {
  background: rgba(10,10,10,.08); color: var(--on-lime);
  font-size: 11.5px; font-weight: 700; padding: 6px 12px; border-radius: 999px;
}
.wallet .add {
  width: 38px; height: 38px; border-radius: 12px; background: var(--black); color: var(--lime);
  border: none; cursor: pointer; display: grid; place-items: center; transition: .18s;
}
.wallet .add:hover { transform: rotate(90deg); }
.wallet .bal {
  font-family: var(--display); font-weight: 600; font-size: 46px; letter-spacing: -.02em;
  margin-top: auto; padding-top: 28px; line-height: 1;
}
.wallet .leg { font-size: 12.5px; font-weight: 500; margin-top: 10px; color: rgba(10,10,10,.66); }

/* ---------- KPI ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.kpi {
  background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow);
  padding: 22px; transition: transform .18s, box-shadow .18s;
}
.kpi:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.kpi .box {
  width: 40px; height: 40px; border-radius: 13px; background: var(--surface);
  display: grid; place-items: center; color: var(--ink); margin-bottom: 18px;
}
.kpi .num { font-family: var(--display); font-weight: 600; font-size: 26px; letter-spacing: -.01em; line-height: 1.1; }
.kpi .cap { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.kpi .cap b { color: var(--ink); font-weight: 700; }

/* ---------- People rail (coluna de membros) ---------- */
.people {
  background: var(--card);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.people-head { text-align: center; padding-top: 4px; }
.people-head .n { font-family: var(--display); font-weight: 600; font-size: 22px; line-height: 1; }
.people-head .l { font-size: 10.5px; color: var(--muted); font-weight: 600; margin-top: 3px; }
.people-stack {
  display: flex; flex-direction: column; align-items: center; gap: 11px;
  flex: 1; overflow-y: auto; width: 100%; padding: 2px 0;
  scrollbar-width: none;
}
.people-stack::-webkit-scrollbar { display: none; }
.people-sec {
  font-size: 9px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; margin-top: 2px;
}
.people-div { width: 26px; height: 1px; background: var(--border); margin: 5px 0 1px; }
.person { position: relative; cursor: pointer; }
.person .pa {
  position: relative;
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--display); font-weight: 600; font-size: 15px;
  transition: transform .18s, box-shadow .18s;
}
.person:hover .pa { transform: scale(1.06); box-shadow: var(--shadow-hover); }
.person .pa.t1 { background: #14161C; color: #fff; }
.person .pa.t2 { background: #2B2E36; color: #fff; }
.person .pa.t3 { background: #E6E8EE; color: #14161C; }
.person .pa.t4 { background: #3A3E48; color: #fff; }
.person .pa img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.person .pres {
  position: absolute; right: -1px; bottom: -1px;
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--lime); box-shadow: 0 0 0 3px var(--card);
}
.person .tip {
  position: absolute; right: calc(100% + 12px); top: 50%; transform: translateY(-50%);
  background: var(--black); color: #fff; white-space: nowrap;
  padding: 7px 12px; border-radius: 10px; font-size: 12.5px; font-weight: 500;
  box-shadow: var(--shadow-hover); opacity: 0; pointer-events: none;
  transition: opacity .15s, transform .15s; z-index: 20;
}
.person .tip span { display: block; font-size: 11px; color: rgba(255,255,255,.55); font-weight: 500; }
.person:hover .tip, .person:focus-within .tip { opacity: 1; transform: translateY(-50%) translateX(0); }
.people[data-pres="off"] .pres { display: none; }
.people-cta {
  width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0;
  background: var(--black); color: #fff; border: none; cursor: pointer;
  display: grid; place-items: center; transition: transform .18s, box-shadow .18s;
  text-decoration: none;
}
.people-cta:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }

/* ---------- Ground Pass (modal global) ---------- */
.pass-overlay { position: fixed; inset: 0; background: rgba(8,9,12,.6); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); display: grid; place-items: center; z-index: 200; padding: 24px; opacity: 0; pointer-events: none; transition: opacity .2s; }
.pass-overlay.open { opacity: 1; pointer-events: auto; }
.pass-card { position: relative; width: 404px; max-width: 100%; background: radial-gradient(120% 90% at 80% 0%, #23262e 0%, #14161c 55%, #0c0d11 100%); border: 1px solid rgba(255,255,255,.08); border-radius: 30px; padding: 24px; box-shadow: 0 40px 90px rgba(0,0,0,.55); transform: translateY(12px) scale(.97); transition: transform .24s cubic-bezier(.2,.9,.3,1); }
.pass-overlay.open .pass-card { transform: none; }
.pass-title { font-family: var(--display); font-weight: 700; font-size: 13px; letter-spacing: .15em; color: var(--lime); text-transform: uppercase; }
.pass-close { position: absolute; top: 16px; right: 16px; width: 32px; height: 32px; border-radius: 50%; border: none; background: rgba(255,255,255,.08); color: #fff; cursor: pointer; display: grid; place-items: center; transition: background .18s; }
.pass-close:hover { background: rgba(255,255,255,.16); }
.pass-close svg { width: 16px; height: 16px; }
.pass-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 18px 0 20px; }
.pass-id { display: flex; align-items: center; gap: 13px; min-width: 0; }
.pass-photo { width: 58px; height: 58px; border-radius: 50%; object-fit: cover; background: var(--lime); color: var(--black); display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 21px; flex-shrink: 0; }
.pass-name { font-family: var(--display); font-weight: 600; font-size: 18px; color: #fff; line-height: 1.15; }
.pass-role { font-size: 13.5px; color: #9CA3AF; margin-top: 3px; }
.pass-role b { color: var(--lime); font-weight: 700; }
.pass-qr { width: 124px; height: 124px; border-radius: 18px; background: #fff; padding: 10px; position: relative; flex-shrink: 0; }
.pass-qr img { width: 100%; height: 100%; display: block; }
.pass-list { background: rgba(0,0,0,.32); border-radius: 18px; overflow: hidden; }
.pass-row { display: flex; align-items: center; gap: 14px; padding: 15px 16px; border-bottom: 1px solid rgba(255,255,255,.06); }
.pass-row:last-child { border-bottom: none; }
.pass-row .pr-ic { color: #fff; display: grid; place-items: center; flex-shrink: 0; }
.pass-row .pr-ic svg { width: 20px; height: 20px; }
.pass-row .pr-label { color: #fff; font-weight: 600; font-size: 15px; flex: 1; }
.pass-row .pr-val { color: var(--lime); font-weight: 700; font-size: 14px; white-space: nowrap; }
.pass-row .pr-val.warn { color: #F59E0B; }

/* ---------- Bottom-nav (mobile only) ---------- */
.bottomnav { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .app-body { grid-template-columns: 76px 1fr; }
  .people { display: none; }
}
@media (max-width: 1080px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .app { padding: 14px; padding-bottom: 92px; }
  .app-body { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { margin-left: 0; }
  .top-actions .user-cap .nm { display: none; }

  .bottomnav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--card); border-top: 1px solid var(--border);
    padding: 10px 8px calc(10px + env(safe-area-inset-bottom));
    justify-content: space-around; z-index: 50;
    box-shadow: 0 -8px 24px rgba(17,19,25,.06);
  }
  .bottomnav a {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    color: var(--muted); text-decoration: none; font-size: 10.5px; font-weight: 600;
    padding: 4px 10px; border-radius: 12px; transition: .18s;
  }
  .bottomnav a.active { color: var(--ink); }
  .bottomnav a.active .box { background: var(--black); color: var(--lime); }
  .bottomnav a .box {
    width: 40px; height: 30px; border-radius: 10px; display: grid; place-items: center;
    color: inherit; transition: .18s;
  }
}
@media (max-width: 480px) {
  .kpi-row { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
