/* ============================================================
   MINISTÉRIO DE LOUVOR IBF — estilos
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

:root {
  --navy: #3E2316;
  --navy-2: #57331F;
  --primary: #8B5A3C;
  --primary-dark: #6E4429;
  --primary-soft: #F7EDE5;
  --accent: #D9A441;

  --bg: #FAF6F1;
  --surface: #FFFFFF;
  --surface-2: #FBF7F2;
  --line: #EFE3D7;
  --line-strong: #DCC8B6;

  --ink: #2C1C12;
  --ink-soft: #6C5645;
  --ink-mute: #9C8574;

  --ok: #2F7D5D;
  --ok-soft: #E6F2EC;
  --warn: #A85B12;
  --warn-soft: #FBEDDC;
  --info: #2F5FA8;
  --info-soft: #E8EFF9;
  --danger: #B03A34;
  --danger-soft: #FAE8E5;

  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 12px;

  --shadow-sm: 0 1px 2px rgba(62, 35, 22, .05);
  --shadow-md: 0 6px 20px rgba(62, 35, 22, .07);
  --shadow-lg: 0 18px 40px rgba(62, 35, 22, .16);

  --font: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, "Noto Serif", serif;

  --topbar-h: 116px;
  --tabbar-space: 96px;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #0F0F1E;
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

body { display: flex; justify-content: center; }

.hidden { display: none !important; }

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}
button { cursor: pointer; border: 0; background: none; padding: 0; }
input, select, textarea { -webkit-appearance: none; appearance: none; }
h1, h2, h3, h4, p, ul, ol { margin: 0; padding: 0; }
ul, ol { list-style: none; }
a { color: inherit; }

/* ---------------- Estrutura ---------------- */

.device {
  width: 100%;
  max-width: 520px;
  height: 100vh;
  height: 100dvh;
  position: relative;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.shell {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
}

@media (min-width: 700px) {
  body { background: radial-gradient(1200px 600px at 50% -10%, #5A3520 0%, #24140C 60%); align-items: center; }
  .device {
    height: calc(100vh - 48px);
    height: calc(100dvh - 48px);
    max-height: 940px;
    border-radius: 34px;
    box-shadow: 0 40px 90px rgba(0, 0, 0, .55), 0 0 0 10px #2A170E, 0 0 0 11px #55331F;
  }
}

/* ---------------- Topbar ---------------- */

.topbar {
  flex: 0 0 auto;
  padding: calc(14px + env(safe-area-inset-top)) 20px 22px;
  background: linear-gradient(160deg, #352014 0%, #4A2A19 45%, #6B4126 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: relative;
  z-index: 5;
  border-radius: 0 0 26px 26px;
  box-shadow: 0 10px 30px rgba(62, 35, 22, .28);
}

.topbar::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(220px 120px at 88% 0%, rgba(217, 164, 65, .34), transparent 70%),
    radial-gradient(180px 120px at 8% 110%, rgba(139, 90, 60, .55), transparent 70%);
  pointer-events: none;
}

.brand { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }

.brand-mark {
  width: 46px; height: 46px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .22);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .25);
  flex: 0 0 auto;
  overflow: hidden;
}
.brand-mark img { width: 100%; height: 100%; object-fit: cover; display: block; }

.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text small {
  font-size: 10px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .62);
  font-weight: 600;
}
.brand-text strong {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: .02em;
  color: #fff;
}
.brand-text span {
  font-size: 10px;
  letter-spacing: .32em;
  color: var(--accent);
  font-weight: 700;
  margin-top: 3px;
}

.top-actions { display: flex; align-items: center; gap: 10px; position: relative; z-index: 1; }

.icon-btn {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 13px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .14);
  transition: transform .16s ease, background .16s ease;
}
.icon-btn:active { transform: scale(.92); }
.icon-btn svg { width: 20px; height: 20px; }

.avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .04em;
  color: #2B1A0E;
  background: linear-gradient(145deg, #F1CE8A, #D9A441);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .22);
  flex: 0 0 auto;
}

/* ---------------- View ---------------- */

.view {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px 16px calc(var(--tabbar-space) + env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  outline: none;
}

.view > * { animation: rise .32s cubic-bezier(.22, .9, .3, 1) both; }
.view > *:nth-child(2) { animation-delay: .04s; }
.view > *:nth-child(3) { animation-delay: .07s; }
.view > *:nth-child(4) { animation-delay: .1s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.screen-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin: 2px 4px 14px;
}
.screen-head h1 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.01em;
}
.screen-head p { font-size: 12.5px; color: var(--ink-mute); margin-top: 4px; }

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 22px 4px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

/* ---------------- Hero (próximo encontro) ---------------- */

.hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-lg);
  padding: 18px;
  color: #fff;
  background: linear-gradient(145deg, #4A2B1A 0%, #7A4A2E 55%, #A06B45 130%);
  box-shadow: 0 14px 32px rgba(90, 52, 30, .32);
  margin-bottom: 18px;
}
.hero::before {
  content: "";
  position: absolute;
  width: 210px; height: 210px;
  right: -70px; top: -110px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(217, 164, 65, .55), transparent 62%);
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28'%3E%3Cpath d='M3 14h6M19 14h6M14 3v6M14 19v6' stroke='rgba(255,255,255,0.05)' stroke-width='2'/%3E%3C/svg%3E");
  pointer-events: none;
}

.hero-label {
  position: relative;
  font-size: 10px;
  letter-spacing: .2em;
  text-transform: uppercase;
  font-weight: 700;
  color: rgba(255, 255, 255, .62);
  margin-bottom: 12px;
}

.hero-row { position: relative; display: flex; gap: 14px; align-items: center; }

.hero-date {
  flex: 0 0 auto;
  width: 64px;
  text-align: center;
  padding: 10px 0 8px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .16);
}
.hero-date b { display: block; font-size: 27px; line-height: 1; font-weight: 700; }
.hero-date small { display: block; font-size: 10px; letter-spacing: .14em; margin-top: 5px; color: #F3D188; font-weight: 700; }
.hero-info { min-width: 0; }
.hero-info h3 { font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.hero-info .hero-sub { font-size: 12.5px; color: rgba(255, 255, 255, .72); margin-top: 3px; }

.hero-groups { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.hero-groups .chip { background: rgba(255, 255, 255, .13); color: #fff; border-color: rgba(255, 255, 255, .18); }
.hero-groups .chip b { color: #fff; }

.hero-empty { position: relative; font-size: 13px; color: rgba(255, 255, 255, .74); }

/* ---------------- Navegação de mês ---------------- */

.month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
}
.month-nav button {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: grid; place-items: center;
  color: var(--ink-soft);
  background: var(--surface-2);
  border: 1px solid var(--line);
  flex: 0 0 auto;
}
.month-nav button:active { background: var(--primary-soft); color: var(--primary); }
.month-nav button svg { width: 18px; height: 18px; }
.month-nav .label {
  flex: 1 1 auto;
  width: auto; height: auto;
  min-width: 0;
  padding: 4px 2px;
  background: transparent;
  border: 0;
  border-radius: 12px;
  text-align: center;
  line-height: 1.1;
}
.month-nav .label:active { background: var(--primary-soft); }
.month-nav .label b {
  display: block;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  white-space: nowrap;
}
.month-nav .label small {
  display: block;
  font-size: 10px;
  color: var(--ink-mute);
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
  margin-top: 3px;
}

/* ---------------- Cards de escala ---------------- */

.scale-list { display: flex; flex-direction: column; gap: 12px; }

.scale-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  position: relative;
}
.scale-card.today { border-color: rgba(139, 90, 60, .5); box-shadow: 0 0 0 3px rgba(139, 90, 60, .12); }

.scale-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px 12px;
  border-bottom: 1px dashed var(--line);
  background: linear-gradient(180deg, #FCFCFF, #FFF);
}

.date-block {
  flex: 0 0 auto;
  width: 52px;
  text-align: center;
  border-radius: 14px;
  padding: 7px 0 6px;
  background: var(--navy);
  color: #fff;
}
.date-block b { display: block; font-size: 20px; line-height: 1; }
.date-block small { display: block; font-size: 9.5px; letter-spacing: .12em; color: #F3D188; font-weight: 700; margin-top: 4px; }

.scale-head-info { flex: 1 1 auto; min-width: 0; }
.scale-head-info h3 { font-size: 14.5px; font-weight: 600; }
.scale-head-info .chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.2;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  white-space: nowrap;
}
.chip b { font-weight: 800; }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .55; }

.chip-md { font-size: 11.5px; padding: 5px 11px; }
.chip-ghost { background: transparent; border-color: var(--line-strong); }

.inst-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
}
.inst {
  background: #fff;
  padding: 9px 13px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.inst:last-child:nth-child(odd) { grid-column: 1 / -1; }
.inst span {
  font-size: 9.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 700;
}
.inst strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inst.empty strong { color: #C7B3A3; font-weight: 500; font-style: italic; }

.scale-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface-2);
  border-top: 1px solid var(--line);
}
.scale-note { font-size: 11.5px; color: var(--ink-soft); font-style: italic; }
.scale-actions { display: flex; gap: 6px; margin-left: auto; }

.mini-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-soft);
  background: #fff;
  border: 1px solid var(--line-strong);
}
.mini-btn svg { width: 14px; height: 14px; }
.mini-btn:active { transform: scale(.96); }

.today-tag {
  position: absolute;
  top: 12px; right: 12px;
  font-size: 9px;
  letter-spacing: .12em;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
}

/* ---------------- Músicas ---------------- */

.filter-row {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 2px 4px 12px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.filter-row::-webkit-scrollbar { display: none; }

.filter-chip {
  flex: 0 0 auto;
  padding: 8px 13px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  white-space: nowrap;
  transition: all .16s ease;
}
.filter-chip b { font-weight: 800; margin-left: 4px; opacity: .6; }
.filter-chip.active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
  box-shadow: 0 6px 14px rgba(62, 35, 22, .22);
}
.filter-chip.active b { opacity: .7; }

.search-box {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 13px;
  height: 44px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}
.search-box svg { width: 17px; height: 17px; color: var(--ink-mute); flex: 0 0 auto; }
.search-box input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 14px; min-width: 0; }
.search-box input::placeholder { color: #C3AE9E; }

.song-list { display: flex; flex-direction: column; gap: 11px; }

.song-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 15px;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.song-top { display: flex; align-items: flex-start; gap: 10px; }
.song-title-wrap { min-width: 0; flex: 1; }
.song-card h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.01em;
  line-height: 1.15;
}
.song-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--ink-mute);
}
.song-meta .key-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--navy);
  color: #F3D188;
  font-weight: 700;
  font-size: 10.5px;
  letter-spacing: .04em;
}

.pill {
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: 8px;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.st-em_andamento { background: var(--warn-soft); color: var(--warn); }
.st-pronta_ensaio { background: var(--info-soft); color: var(--info); }
.st-aprovada { background: var(--ok-soft); color: var(--ok); }
.st-reprovada { background: var(--danger-soft); color: var(--danger); }

.song-note {
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.45;
  background: var(--surface-2);
  border-left: 3px solid var(--line-strong);
  padding: 8px 10px;
  border-radius: 0 8px 8px 0;
}

.song-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 9px;
  background: var(--primary-soft);
}
.song-link svg { width: 14px; height: 14px; }

.song-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px dashed var(--line);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 13px;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
  transition: transform .14s ease, filter .14s ease;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 14px rgba(139, 90, 60, .3); }
.btn-ok { background: var(--ok); color: #fff; box-shadow: 0 6px 14px rgba(14, 159, 110, .24); }
.btn-ghost { background: #fff; border-color: var(--line-strong); color: var(--ink-soft); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-dark { background: var(--navy); color: #fff; }
.btn-block { width: 100%; padding: 14px; font-size: 14px; border-radius: 14px; }
.btn:disabled { opacity: .5; }

.timeline {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 11px;
}
.timeline i {
  width: 100%;
  height: 4px;
  border-radius: 99px;
  background: var(--line);
  font-style: normal;
}
.timeline i.on { background: var(--primary); }
.timeline i.ok { background: var(--ok); }
.timeline i.no { background: var(--danger); }

/* ---------------- Pessoas / grupos ---------------- */

.group-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
}

.group-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 15px;
}
.group-badge {
  width: 44px; height: 44px;
  border-radius: 13px;
  display: grid; place-items: center;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: .02em;
  flex: 0 0 auto;
}
.group-head .gh-info { flex: 1; min-width: 0; }
.group-head h3 { font-size: 14.5px; font-weight: 600; }
.group-head p { font-size: 11.5px; color: var(--ink-mute); margin-top: 2px; }

.member-wrap { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 15px 14px; }
.member {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px 5px 5px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-soft);
}
.member .mini-avatar {
  width: 20px; height: 20px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 8.5px;
  font-weight: 800;
  background: var(--line);
  color: var(--ink-soft);
}
.member.leader { border-color: rgba(217, 166, 46, .5); background: #FDF7E7; color: #7A5B07; }
.member.leader .mini-avatar { background: #F3D188; color: #6B4E05; }

.person-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 15px;
  margin-bottom: 8px;
  text-align: left;
  width: 100%;
}
.person-row:active { background: var(--surface-2); }
.person-avatar {
  width: 38px; height: 38px;
  border-radius: 12px;
  display: grid; place-items: center;
  font-weight: 800;
  font-size: 12.5px;
  flex: 0 0 auto;
}
.person-info { flex: 1; min-width: 0; }
.person-info strong { display: block; font-size: 13.5px; font-weight: 600; }
.person-info small { display: block; font-size: 11px; color: var(--ink-mute); margin-top: 2px; }
.person-tags { display: flex; align-items: center; gap: 5px; flex: 0 0 auto; }

.role-badge {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 3px 6px;
  border-radius: 5px;
  background: var(--line);
  color: var(--ink-soft);
}
.role-admin { background: var(--navy); color: #F3D188; }
.role-leader { background: #FDF7E7; color: #8A6A00; }

.empty {
  text-align: center;
  padding: 34px 18px;
  color: var(--ink-mute);
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
}
.empty svg { width: 34px; height: 34px; margin-bottom: 10px; opacity: .35; }
.empty strong { display: block; font-size: 13.5px; color: var(--ink-soft); margin-bottom: 4px; }
.empty p { font-size: 12px; line-height: 1.5; }

/* ---------------- Perfil ---------------- */

.profile-card {
  background: linear-gradient(150deg, #5A3520, #341D11 60%);
  color: #fff;
  border-radius: var(--r-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 14px 30px rgba(62, 35, 22, .3);
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}
.profile-card::after {
  content: "";
  position: absolute;
  width: 180px; height: 180px;
  right: -60px; bottom: -100px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(217, 164, 65, .42), transparent 65%);
}
.profile-avatar {
  width: 58px; height: 58px;
  border-radius: 18px;
  display: grid; place-items: center;
  font-size: 19px;
  font-weight: 800;
  background: linear-gradient(145deg, #F1CE8A, #D9A441);
  color: #2B1A0E;
  flex: 0 0 auto;
}
.profile-card h2 { font-family: var(--font-display); font-size: 20px; font-weight: 700; }
.profile-card p { font-size: 12px; color: rgba(255, 255, 255, .66); margin-top: 3px; }

.menu-list {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 15px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
}
.menu-item:last-child { border-bottom: 0; }
.menu-item:active { background: var(--surface-2); }
.menu-item .mi-icon {
  width: 34px; height: 34px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
  flex: 0 0 auto;
}
.menu-item .mi-icon svg { width: 17px; height: 17px; }
.menu-item .mi-text { flex: 1; }
.menu-item .mi-text small { display: block; font-size: 11px; color: var(--ink-mute); font-weight: 400; margin-top: 2px; }
.menu-item .chev { color: #C7B3A3; }
.menu-item .chev svg { width: 16px; height: 16px; }
.menu-item.danger { color: var(--danger); }
.menu-item.danger .mi-icon { background: var(--danger-soft); color: var(--danger); }

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px 10px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.stat b { display: block; font-size: 20px; font-weight: 700; font-family: var(--font-display); }
.stat small { display: block; font-size: 10px; color: var(--ink-mute); margin-top: 3px; letter-spacing: .06em; text-transform: uppercase; font-weight: 600; }

/* ---------------- Tabbar ---------------- */

.tabbar {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(10px + env(safe-area-inset-bottom));
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 2px;
  padding: 7px;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(233, 232, 242, .9);
  border-radius: 22px;
  box-shadow: 0 12px 30px rgba(62, 35, 22, .14);
  z-index: 20;
}

.tab {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-radius: 15px;
  color: #9C9BB0;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .01em;
  transition: color .18s ease, background .18s ease;
  position: relative;
}
.tab svg { width: 21px; height: 21px; }
.tab.active { color: var(--primary-dark); background: var(--primary-soft); }
.tab.active svg { stroke-width: 2.2; }

.fab {
  position: absolute;
  right: 20px;
  bottom: calc(88px + env(safe-area-inset-bottom));
  width: 54px; height: 54px;
  border-radius: 19px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #A9764F, #7A4A2E);
  color: #fff;
  box-shadow: 0 12px 26px rgba(122, 74, 46, .42);
  z-index: 19;
  transition: transform .16s ease;
}
.fab:active { transform: scale(.92); }
.fab svg { width: 24px; height: 24px; }

/* ---------------- Login ---------------- */

.login {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: calc(34px + env(safe-area-inset-top)) 22px calc(28px + env(safe-area-inset-bottom));
  color: #fff;
  background: radial-gradient(140% 90% at 50% -10%, #5C3621 0%, #3B2214 42%, #23140D 100%);
}

.login::before {
  content: "";
  position: absolute;
  width: 320px; height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(217, 164, 65, .24), transparent 65%);
  top: -120px; right: -100px;
}
.login::after {
  content: "";
  position: absolute;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(139, 90, 60, .45), transparent 65%);
  bottom: -120px; left: -110px;
}

.login-inner { position: relative; z-index: 1; margin: auto 0; width: 100%; max-width: 380px; align-self: center; animation: rise .45s ease both; }

.login-logo {
  width: 132px; height: 132px;
  border-radius: 32px;
  margin-bottom: 22px;
  position: relative;
}
.login-logo img {
  width: 100%; height: 100%;
  border-radius: 32px;
  object-fit: cover;
  display: block;
  box-shadow: 0 22px 44px rgba(0, 0, 0, .45), 0 0 0 1px rgba(255, 255, 255, .14);
}

.login-eyebrow {
  font-size: 10px;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 8px;
}
.login h1 {
  font-family: var(--font-display);
  font-size: 30px;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -.01em;
}
.login h1 span { display: block; color: rgba(255, 255, 255, .55); font-size: 22px; margin-top: 4px; }
.login .sub { font-size: 12.5px; color: rgba(255, 255, 255, .55); margin-top: 12px; line-height: 1.5; }

.login-form { margin-top: 26px; display: flex; flex-direction: column; gap: 12px; }

.lfield { display: flex; flex-direction: column; gap: 6px; }
.lfield > span { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: rgba(255, 255, 255, .5); font-weight: 700; }
.lfield .wrap {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 52px;
  padding: 0 14px;
  border-radius: 15px;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .14);
  transition: border-color .18s ease, background .18s ease;
}
.lfield .wrap:focus-within { border-color: rgba(243, 209, 136, .7); background: rgba(255, 255, 255, .11); }
.lfield .wrap svg { width: 18px; height: 18px; color: rgba(255, 255, 255, .45); flex: 0 0 auto; }
.lfield input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: #fff;
  font-size: 15px;
  min-width: 0;
}
.lfield input::placeholder { color: rgba(255, 255, 255, .3); }

.login .btn-primary {
  height: 52px;
  border-radius: 15px;
  font-size: 14.5px;
  background: linear-gradient(145deg, #EFC97F, #C99A3B);
  color: #2B2205;
  box-shadow: 0 14px 28px rgba(217, 164, 65, .22);
  margin-top: 4px;
}
.login .btn-primary:disabled { opacity: .7; }

.server-link {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px auto 0;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, .62);
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .14);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.server-link b { color: #F3D188; font-weight: 700; }
.server-link .dot { width: 7px; height: 7px; border-radius: 50%; background: #C9A227; flex: 0 0 auto; }
.server-link .dot.ok { background: #4ADE80; }
.server-link .dot.err { background: #F87171; }

.login-error {
  display: none;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: #FFC9C9;
  background: rgba(220, 38, 38, .16);
  border: 1px solid rgba(255, 77, 77, .3);
  padding: 9px 12px;
  border-radius: 11px;
}
.login-error.show { display: flex; }

.login-hint {
  margin-top: 18px;
  font-size: 11.5px;
  color: rgba(255, 255, 255, .5);
  text-align: center;
  line-height: 1.6;
  background: rgba(255, 255, 255, .05);
  border: 1px dashed rgba(255, 255, 255, .14);
  border-radius: 12px;
  padding: 10px 12px;
}
.login-hint b { color: rgba(255, 255, 255, .85); font-weight: 600; }

.login-foot { margin-top: auto; padding-top: 26px; text-align: center; font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: rgba(255, 255, 255, .28); }

/* ---------------- Sheet ---------------- */

.sheet-wrap {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 12, 26, .55);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity .24s ease;
}
.sheet-wrap.is-open .sheet-backdrop { opacity: 1; }

.sheet {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  max-height: 92dvh;
  background: var(--surface);
  border-radius: 28px 28px 0 0;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.22, .9, .3, 1);
  box-shadow: 0 -20px 60px rgba(0, 0, 0, .3);
  overflow: hidden;
}
.sheet-wrap.is-open .sheet { transform: translateY(0); }

@media (min-width: 700px) {
  .sheet-wrap { align-items: center; }
  .sheet { border-radius: 28px; max-height: 86vh; max-height: 86dvh; transform: translateY(24px) scale(.98); opacity: 0; transition: transform .26s ease, opacity .26s ease; }
  .sheet-wrap.is-open .sheet { transform: none; opacity: 1; }
}

.sheet-grip {
  width: 42px; height: 4px;
  border-radius: 99px;
  background: #DCDBEA;
  margin: 10px auto 0;
  flex: 0 0 auto;
}

.sheet-head {
  padding: 12px 20px 12px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex: 0 0 auto;
}
.sheet-head h2 { font-family: var(--font-display); font-size: 21px; font-weight: 700; flex: 1; }
.sheet-head p { font-size: 12px; color: var(--ink-mute); margin-top: 3px; }
.sheet-head .icon-btn {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--ink-mute);
  width: 34px; height: 34px;
  border-radius: 11px;
  flex: 0 0 auto;
}

.sheet-body {
  padding: 6px 20px 20px;
  overflow-y: auto;
  flex: 1 1 auto;
  -webkit-overflow-scrolling: touch;
}

.sheet-foot {
  padding: 12px 20px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  gap: 9px;
  flex: 0 0 auto;
}
.sheet-foot .btn { flex: 1; padding: 13px; font-size: 13.5px; border-radius: 13px; }

/* ---------------- Formulários ---------------- */

.form-grid { display: flex; flex-direction: column; gap: 13px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 11px; font-weight: 700; letter-spacing: .04em; color: var(--ink-soft); text-transform: uppercase; }
.field > span b { color: var(--danger); }
.field em { font-size: 10.5px; color: var(--ink-mute); font-style: normal; }

.input, .select, .textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  border-radius: 12px;
  padding: 12px 13px;
  font-size: 14px;
  outline: 0;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
  min-width: 0;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(139, 90, 60, .14);
}
.textarea { min-height: 78px; resize: vertical; line-height: 1.45; }
.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238B8BA3' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}

.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { position: relative; }
.swatch input { position: absolute; opacity: 0; pointer-events: none; }
.swatch span {
  display: block;
  width: 38px; height: 38px;
  border-radius: 12px;
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 2px #fff;
  transition: transform .14s ease;
}
.swatch input:checked + span { border-color: var(--ink); transform: scale(1.06); }

.check-list { display: flex; flex-wrap: wrap; gap: 7px; }
.check-chip { position: relative; }
.check-chip input { position: absolute; opacity: 0; pointer-events: none; }
.check-chip span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
  transition: all .14s ease;
}
.check-chip input:checked + span {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 13px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.switch-row p { font-size: 13px; font-weight: 500; }
.switch-row small { display: block; font-size: 11px; color: var(--ink-mute); margin-top: 2px; }
.switch { position: relative; width: 46px; height: 27px; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; }
.switch span {
  position: absolute; inset: 0;
  border-radius: 99px;
  background: #D5D4E4;
  transition: background .2s ease;
}
.switch span::after {
  content: "";
  position: absolute;
  width: 21px; height: 21px;
  border-radius: 50%;
  background: #fff;
  top: 3px; left: 3px;
  transition: transform .2s cubic-bezier(.3, 1.4, .5, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(19px); }

.form-error {
  display: none;
  font-size: 12px;
  color: var(--danger);
  background: var(--danger-soft);
  padding: 9px 12px;
  border-radius: 10px;
}
.form-error.show { display: block; }

/* ---------------- Toast ---------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translate(-50%, 20px);
  background: var(--navy);
  color: #fff;
  font-size: 12.5px;
  font-weight: 500;
  padding: 12px 18px;
  border-radius: 13px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
  z-index: 200;
  max-width: min(440px, calc(100vw - 40px));
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.ok { background: #0B7A55; }
.toast.err { background: #B91C1C; }

/* ---------------- Diversos ---------------- */

.divider { height: 1px; background: var(--line); margin: 16px 0; }

.info-box {
  display: flex;
  gap: 10px;
  padding: 12px 13px;
  border-radius: 13px;
  background: var(--primary-soft);
  border: 1px solid rgba(139, 90, 60, .18);
  font-size: 12px;
  line-height: 1.5;
  color: #6E4429;
}
.info-box svg { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 1px; }

.badge-soft {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ink-mute);
  background: var(--line);
  padding: 3px 7px;
  border-radius: 6px;
}

.brand-mark svg { width: 22px; height: 22px; }
.login-error svg { width: 15px; height: 15px; flex: 0 0 auto; }
.sheet-head .icon-btn svg { width: 17px; height: 17px; }
.member-wrap .person-info { color: var(--ink-mute); }

/* ---------------- Sincronização ---------------- */

.sync-btn { position: relative; }
.sync-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #A9968A;
  border: 2px solid rgba(53, 32, 20, .9);
  box-sizing: content-box;
}
.sync-dot.ok { background: #4ADE80; }
.sync-dot.err { background: #F87171; }
.sync-dot.busy { background: #FBBF24; animation: pulse 1s infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .45; transform: scale(.8); }
}

.sync-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 13px;
  border-radius: 13px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.45;
}
.sync-status .dot { width: 9px; height: 9px; border-radius: 50%; background: #A9968A; flex: 0 0 auto; }
.sync-status .dot.ok { background: var(--ok); }
.sync-status .dot.err { background: var(--danger); }
.sync-status b { color: var(--ink); }

.server-help {
  font-size: 11px;
  color: var(--ink-mute);
  line-height: 1.55;
  padding: 10px 12px;
  border-radius: 11px;
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
}
.server-help code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 10.5px;
  background: #fff;
  padding: 1px 4px;
  border-radius: 4px;
  border: 1px solid var(--line);
}

.server-link {
  font-family: inherit;
  cursor: pointer;
  transition: background .16s ease;
}
.server-link:active { background: rgba(255, 255, 255, .12); }
.server-link > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.author-line { color: var(--ink-soft); font-weight: 600; }

.about-logo { display: flex; justify-content: center; padding: 2px 0 8px; }
.about-logo img {
  width: 104px; height: 104px;
  border-radius: 26px;
  box-shadow: var(--shadow-md);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
