/* =============================================
   FILHAS DA GRAÇA — Layout responsivo
   Mobile-first, sidebar no desktop
   ============================================= */

:root {
  --rosa:        #d4607a;
  --rosa-md:     #e8899a;
  --rosa-lt:     #f7d0d8;
  --rosa-pale:   #fff5f7;
  --creme:       #fffaf8;
  --branco:      #ffffff;
  --texto:       #2d1a20;
  --texto-md:    #7a4f5a;
  --texto-lt:    #b08a93;
  --borda:       #f0d8dc;
  --verde:       #5a9e6f;
  --verde-lt:    #e8f5ec;
  --vermelho:    #d45060;
  --vermelho-lt: #fdecea;
  --amarelo:     #e8a840;
  --amarelo-lt:  #fff8e8;
  --sombra-sm:   0 2px 8px rgba(212,96,122,.10);
  --sombra:      0 4px 20px rgba(212,96,122,.15);
  --sombra-lg:   0 8px 40px rgba(212,96,122,.22);
  --r-sm: 10px;
  --r:    16px;
  --r-lg: 22px;
  --sidebar-w: 230px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; }
body { font-family: 'Nunito', sans-serif; background: var(--creme); color: var(--texto); min-height: 100vh; }

/* ─────────────────────────────────────
   LAYOUT BASE (desktop: sidebar + main)
───────────────────────────────────── */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ─── SIDEBAR ─── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--branco);
  border-right: 1px solid var(--borda);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}
.sidebar-logo {
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--borda);
  text-align: center;
}
.sidebar-logo img { max-width: 130px; max-height: 70px; object-fit: contain; }
.logo-txt-mini { font-size: .62rem; text-transform: uppercase; letter-spacing: .12em; color: var(--texto-lt); }
.logo-txt-main { font-family: 'Playfair Display', serif; font-size: 1.1rem; color: var(--rosa); font-style: italic; margin-top: 2px; }
.sidebar-nav { flex: 1; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }
.s-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: var(--r-sm);
  text-decoration: none; font-size: .87rem; font-weight: 700;
  color: var(--texto-md); transition: all .15s;
}
.s-link:hover   { background: var(--rosa-pale); color: var(--rosa); }
.s-link.active  { background: var(--rosa); color: #fff; }
.s-link .ico    { font-size: 1rem; width: 20px; text-align: center; }
.sidebar-foot {
  padding: 12px 16px; border-top: 1px solid var(--borda);
  display: flex; align-items: center; gap: 10px;
}
.sf-name { font-weight: 800; font-size: .85rem; color: var(--texto); }
.sf-role { font-size: .72rem; color: var(--texto-lt); text-transform: capitalize; }
.btn-sair {
  margin-left: auto; background: none; border: none;
  color: var(--texto-lt); font-size: 1rem; cursor: pointer;
  padding: 6px 8px; border-radius: 8px; text-decoration: none;
  transition: all .15s;
}
.btn-sair:hover { background: var(--rosa-pale); color: var(--rosa); }

/* ─── MAIN ─── */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ─── TOPBAR ─── */
.topbar {
  background: var(--branco);
  border-bottom: 1px solid var(--borda);
  padding: 12px 24px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--sombra-sm);
}
.topbar-brand { font-family: 'Playfair Display', serif; font-size: .95rem; color: var(--rosa); font-style: italic; }
.topbar-sub   { font-size: .62rem; font-family: 'Nunito', sans-serif; font-style: normal; color: var(--texto-lt); font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-chip  { background: var(--rosa-lt); color: var(--rosa); font-size: .75rem; font-weight: 700; padding: 4px 12px; border-radius: 20px; }
.btn-topbar-sair {
  background: none; border: 1px solid var(--borda); color: var(--texto-md);
  font-size: .8rem; font-weight: 700; padding: 5px 12px; border-radius: 8px;
  cursor: pointer; text-decoration: none; font-family: 'Nunito', sans-serif;
  transition: all .15s;
}
.btn-topbar-sair:hover { background: var(--rosa-pale); color: var(--rosa); border-color: var(--rosa-lt); }
.btn-hamburger {
  display: none;
  background: none; border: none; font-size: 1.25rem;
  color: var(--rosa); cursor: pointer; padding: 4px 6px; border-radius: 6px;
}

/* ─── PAGE CONTENT ─── */
.page { padding: 24px 26px 48px; max-width: 860px; }

/* ─── OVERLAY mobile ─── */
.overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(45,26,32,.4);
  z-index: 99;
}

/* ─────────────────────────────────────
   COMPONENTES
───────────────────────────────────── */

/* Títulos */
.page-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.55rem; color: var(--rosa); font-style: italic;
  margin-bottom: 20px;
}
.page-hdr {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px; margin-bottom: 20px;
}
.page-hdr .page-title { margin: 0; }

/* Cards */
.card {
  background: var(--branco); border-radius: var(--r);
  box-shadow: var(--sombra-sm); padding: 18px 20px;
  border: 1px solid var(--borda); margin-bottom: 14px;
}
.card-t {
  font-family: 'Playfair Display', serif;
  font-size: 1rem; color: var(--rosa); margin-bottom: 14px;
  display: flex; align-items: center; gap: 7px;
}

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin-bottom: 16px; }
.stat {
  background: var(--branco); border: 1px solid var(--borda);
  border-radius: var(--r); padding: 14px 12px;
  position: relative; overflow: hidden;
}
.stat::before { content: attr(data-i); position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-size: 1.8rem; opacity: .1; }
.stat-v { font-size: 1.7rem; font-weight: 800; color: var(--rosa); font-family: 'Playfair Display', serif; line-height: 1; }
.stat-v.sm { font-size: 1.15rem; }
.stat-l { font-size: .68rem; color: var(--texto-lt); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin-top: 3px; }

/* Botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border: none; border-radius: var(--r-sm);
  font-family: 'Nunito', sans-serif; font-size: .88rem; font-weight: 700;
  cursor: pointer; transition: all .15s; text-decoration: none; white-space: nowrap;
}
.btn:active { opacity: .85; transform: scale(.97); }
.btn-p  { background: var(--rosa); color: #fff; box-shadow: 0 2px 8px rgba(212,96,122,.3); }
.btn-p:hover  { background: #bf5570; }
.btn-o  { background: transparent; color: var(--rosa); border: 2px solid var(--rosa); }
.btn-o:hover  { background: var(--rosa-lt); }
.btn-g  { background: var(--rosa-pale); color: var(--rosa); }
.btn-g:hover  { background: var(--rosa-lt); }
.btn-ok { background: var(--verde); color: #fff; }
.btn-ok:hover { background: #4a8a5f; }
.btn-del{ background: var(--vermelho); color: #fff; }
.btn-del:hover{ background: #c0404f; }
.btn-sm { padding: 6px 13px; font-size: .8rem; }
.btn-xs { padding: 4px 9px;  font-size: .74rem; border-radius: 7px; }
.btn-bl { width: 100%; }

/* Formulários */
.fg { margin-bottom: 14px; }
.fl { display: block; font-size: .8rem; font-weight: 700; color: var(--texto-md); margin-bottom: 5px; }
.fc {
  width: 100%; padding: 9px 12px;
  border: 1.5px solid var(--borda); border-radius: var(--r-sm);
  font-family: 'Nunito', sans-serif; font-size: .9rem; color: var(--texto);
  background: var(--branco); transition: border .15s, box-shadow .15s; -webkit-appearance: none;
}
.fc:focus { outline: none; border-color: var(--rosa-md); box-shadow: 0 0 0 3px rgba(212,96,122,.11); }
.fr2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fr3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* Modal */
.modal-bd {
  display: none; position: fixed; inset: 0;
  background: rgba(45,26,32,.5); backdrop-filter: blur(3px);
  z-index: 300; align-items: center; justify-content: center; padding: 20px;
}
.modal-bd.open { display: flex; }
.modal {
  background: var(--branco); border-radius: var(--r-lg);
  padding: 26px; width: 100%; max-width: 500px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--sombra-lg);
  animation: mIn .2s ease;
  position: relative;
}
@keyframes mIn { from { transform: translateY(16px) scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-t { font-family: 'Playfair Display', serif; font-size: 1.25rem; color: var(--rosa); margin-bottom: 18px; }
.modal-x { position: absolute; top: 14px; right: 16px; background: none; border: none; font-size: 1.1rem; cursor: pointer; color: var(--texto-lt); }
.modal-x:hover { color: var(--rosa); }
.modal-handle { display: none; }

/* Membros / chamada */
.mlist { display: flex; flex-direction: column; gap: 6px; }
.mrow {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 13px; background: var(--branco);
  border: 2px solid var(--borda); border-radius: var(--r-sm);
  cursor: pointer; transition: all .15s; user-select: none;
}
.mrow.presente { border-color: var(--verde); background: var(--verde-lt); }
.mrow:hover { border-color: var(--rosa-md); }
.mrow-nome { font-size: .88rem; font-weight: 700; flex: 1; }
.mrow-chk  { font-size: 1.2rem; min-width: 24px; text-align: center; }

/* Avatar */
.av    { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 2px solid var(--rosa-lt); flex-shrink: 0; cursor: pointer; }
.av-sm { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; border: 2px solid var(--rosa-lt); flex-shrink: 0; }
.av-ph { border-radius: 50%; background: var(--rosa-lt); display: flex; align-items: center; justify-content: center; flex-shrink: 0; border: 2px solid var(--borda); }

.foto-area { text-align: center; margin-bottom: 16px; }
.foto-circle {
  width: 90px; height: 90px; border-radius: 50%;
  background: var(--rosa-pale); border: 3px dashed var(--rosa-md);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 6px; font-size: 2rem; cursor: pointer; overflow: hidden;
}
.foto-circle img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.foto-circle:hover { border-color: var(--rosa); }

/* Badges / tags */
.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 20px; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.b-pres { background: var(--verde-lt);    color: var(--verde); }
.b-ause { background: var(--rosa-lt);     color: var(--rosa); }
.b-entr { background: var(--verde-lt);    color: var(--verde); }
.b-said { background: var(--vermelho-lt); color: var(--vermelho); }
.tag  { display: inline-flex; align-items: center; gap: 4px; padding: 3px 11px; background: var(--rosa-lt); color: var(--rosa); border-radius: 20px; font-size: .78rem; font-weight: 700; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 11px; background: var(--rosa-pale); border: 1px solid var(--rosa-lt); color: var(--rosa); border-radius: 20px; font-size: .78rem; font-weight: 700; }

/* Lista */
.li { display: flex; align-items: center; gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--borda); }
.li:last-child { border-bottom: none; }
.li-body { flex: 1; min-width: 0; }
.li-t { font-size: .88rem; font-weight: 700; color: var(--texto); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-s { font-size: .76rem; color: var(--texto-lt); margin-top: 1px; }
.li-end { text-align: right; flex-shrink: 0; }

/* Financeiro */
.v-entr { color: var(--verde);    font-weight: 800; }
.v-said { color: var(--vermelho); font-weight: 800; }
.v-pos  { color: var(--verde); }
.v-neg  { color: var(--vermelho); }

/* Tabela */
.tw { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--r-sm); }
table { width: 100%; border-collapse: collapse; }
th { background: var(--rosa-lt); color: var(--rosa); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 9px 12px; text-align: left; white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--borda); font-size: .87rem; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--rosa-pale); }

/* Toast */
.toast-wrap { position: fixed; top: 76px; right: 18px; z-index: 9999; display: flex; flex-direction: column; gap: 7px; max-width: 300px; }
.toast { padding: 11px 16px; border-radius: var(--r-sm); font-size: .86rem; font-weight: 700; color: #fff; box-shadow: var(--sombra); animation: tIn .22s ease; }
@keyframes tIn { from { transform: translateX(14px); opacity: 0; } to { transform: none; opacity: 1; } }
.t-ok   { background: var(--verde); }
.t-err  { background: var(--vermelho); }
.t-info { background: var(--rosa); }

/* Lightbox */
.lightbox { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.88); z-index: 999; align-items: center; justify-content: center; flex-direction: column; gap: 12px; padding: 20px; }
.lightbox.open { display: flex; }
.lightbox img { max-width: 100%; max-height: 82vh; border-radius: var(--r); }
.lb-nome { color: #fff; font-family: 'Playfair Display', serif; font-size: 1.05rem; font-style: italic; }

/* Login */
.login-bg { min-height: 100vh; background: linear-gradient(150deg,#fce8ed 0%,#f9d0d8 50%,#f4b8c2 100%); display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { background: var(--branco); border-radius: var(--r-lg); padding: 34px 30px 30px; width: 100%; max-width: 390px; box-shadow: var(--sombra-lg); text-align: center; }
.login-logo { max-width: 155px; max-height: 85px; object-fit: contain; margin-bottom: 16px; }
.login-t { font-family: 'Playfair Display', serif; font-size: 1.45rem; color: var(--rosa); font-style: italic; margin-bottom: 3px; }
.login-s { font-size: .8rem; color: var(--texto-lt); margin-bottom: 24px; }

/* Alertas */
.alert { padding: 11px 14px; border-radius: var(--r-sm); font-size: .86rem; margin-bottom: 12px; font-weight: 600; }
.a-err  { background: var(--vermelho-lt); color: var(--vermelho); border-left: 4px solid var(--vermelho); }
.a-warn { background: var(--amarelo-lt);  color: var(--amarelo);  border-left: 4px solid var(--amarelo); }
.a-info { background: var(--rosa-pale);   color: var(--rosa);     border-left: 4px solid var(--rosa); }

/* Empty */
.empty { text-align: center; padding: 36px 16px; color: var(--texto-lt); }
.empty-i { font-size: 2.8rem; margin-bottom: 8px; }
.empty p { font-size: .88rem; }

/* Util */
.mt1{margin-top:7px} .mt2{margin-top:14px} .mt3{margin-top:22px}
.mb1{margin-bottom:7px} .mb2{margin-bottom:14px}
.w100{width:100%} .tc{text-align:center}
.muted{color:var(--texto-lt);font-size:.8rem}
.bold{font-weight:700}
.hr{border:none;border-top:1px solid var(--borda);margin:13px 0}
::-webkit-scrollbar{width:5px;height:5px}
::-webkit-scrollbar-thumb{background:var(--rosa-lt);border-radius:10px}

/* ─────────────────────────────────────
   MOBILE  ≤ 768px
───────────────────────────────────── */
@media (max-width: 768px) {

  /* Sidebar vira drawer que abre/fecha */
  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 200;
    width: 250px;
  }
  .sidebar.aberta {
    transform: translateX(0);
    box-shadow: var(--sombra-lg);
  }

  /* Main ocupa 100% */
  .main { margin-left: 0; }

  /* Hamburger aparece */
  .btn-hamburger { display: inline-flex; align-items: center; }

  /* Overlay */
  .overlay { cursor: pointer; }
  .overlay.show { display: block; position: fixed; inset: 0; background: rgba(45,26,32,.4); z-index: 150; }

  /* Page padding menor */
  .page { padding: 14px 14px 90px; }

  /* Stats 2 colunas */
  .stats { grid-template-columns: 1fr 1fr; gap: 9px; }

  /* Formulários 1 coluna */
  .fr2, .fr3 { grid-template-columns: 1fr; }

  /* Modal vira bottom sheet */
  .modal-bd { align-items: flex-end; padding: 0; }
  .modal {
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    max-width: 100%;
    padding: 4px 18px 28px;
    animation: shUp .25s ease;
  }
  @keyframes shUp { from{transform:translateY(40px);opacity:0} to{transform:none;opacity:1} }
  .modal-handle { display: block; width: 36px; height: 4px; background: var(--borda); border-radius: 4px; margin: 10px auto 14px; }
  .modal-x { display: none; }

  /* Toasts centrados */
  .toast-wrap { top: 68px; right: 10px; left: 10px; max-width: 100%; }

  /* Bottom nav */
  .bnav {
    display: flex !important;
    position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--branco); border-top: 1px solid var(--borda);
    height: 60px; z-index: 100;
    box-shadow: 0 -2px 12px rgba(212,96,122,.10);
  }
  .bnav a {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 2px;
    text-decoration: none; color: var(--texto-lt);
    font-size: .63rem; font-weight: 700; text-transform: uppercase; letter-spacing: .02em;
    padding: 6px 2px; position: relative; transition: color .15s;
  }
  .bnav a .ni { font-size: 1.3rem; line-height: 1; transition: transform .15s; }
  .bnav a.active { color: var(--rosa); }
  .bnav a.active .ni { transform: translateY(-2px) scale(1.1); }
  .bnav a.active::after { content:''; position:absolute; top:0; left:22%; right:22%; height:3px; background:var(--rosa); border-radius:0 0 4px 4px; }

  /* FAB */
  .fab {
    display: flex !important;
    position: fixed; bottom: 70px; right: 16px;
    width: 50px; height: 50px; border-radius: 50%;
    background: var(--rosa); color: #fff; font-size: 1.5rem;
    border: none; cursor: pointer;
    box-shadow: var(--sombra-lg);
    align-items: center; justify-content: center; z-index: 110;
  }
}
