/* =====================================================================
   Painel da proprietária — casco, bloqueio, janelas e componentes
   ===================================================================== */

[hidden] { display: none !important; }

html.is-locked,
html.is-locked body { overflow: hidden; }

.on-dark { color: var(--text); }

.ico { flex: none; }

body.painel {
  --top-h: calc(56px + env(safe-area-inset-top));
  --tab-h: calc(64px + env(safe-area-inset-bottom));
  overscroll-behavior-y: none;
}

/* ---------- casco ---------- */
.app {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
}

.side { display: none; }

.top {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  height: var(--top-h);
  padding: env(safe-area-inset-top) 0.9rem 0 1rem;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--line);
}
.top__title {
  flex: 1;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.top .brand__txt { display: none; }

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--bg-elev);
  border-top: 1px solid var(--line);
}
.tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.28rem;
  min-height: 62px;
  color: var(--text-3);
  text-decoration: none;
  font: 500 0.64rem/1 var(--font-ui);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: color 0.15s ease;
}
.tab[aria-current="page"] { color: var(--gold-text); }
.tab[aria-current="page"]::before {
  content: "";
  position: absolute;
  top: 0;
  width: 30px;
  height: 2px;
  border-radius: 0 0 3px 3px;
  background: var(--gold-grad);
}

.main {
  min-width: 0;
  padding: 1rem 1rem calc(var(--tab-h) + 92px);
}

.main--fill {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--top-h) - var(--tab-h));
  height: calc(100dvh - var(--top-h) - var(--tab-h));
  padding-bottom: 0;
  overflow: hidden;
}

.fab {
  position: fixed;
  right: 1rem;
  bottom: calc(var(--tab-h) + 14px);
  z-index: 25;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--gold-grad);
  color: var(--on-gold);
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  transition: transform 0.15s ease, filter 0.15s ease;
}
.fab:hover { filter: brightness(1.08); }
.fab:active { transform: scale(0.95); }

/* ---------- marca ---------- */
.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  color: var(--text);
}
.brand img { height: auto; }
.brand__txt { display: grid; gap: 0.35rem; }
.brand__name {
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
.brand__sub {
  font: 500 0.6rem/1 var(--font-ui);
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--gold-text);
}

/* ---------- desktop ---------- */
@media (min-width: 960px) {
  body.painel { --top-h: 0px; --tab-h: 0px; }

  .app { grid-template-columns: 252px minmax(0, 1fr); }

  .side {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    gap: 1.8rem;
    height: 100vh;
    height: 100dvh;
    padding: 1.6rem 1rem 1.2rem;
    background: var(--bg-elev);
    border-right: 1px solid var(--line);
  }
  .side .brand { padding: 0.2rem 0.5rem; }

  .nav { display: grid; gap: 0.25rem; }
  .nav__item {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-height: 48px;
    padding: 0 1rem;
    border-radius: var(--radius-sm);
    color: var(--text-2);
    text-decoration: none;
    font-weight: 500;
    letter-spacing: 0.03em;
    transition: background-color 0.15s ease, color 0.15s ease;
  }
  .nav__item:hover { background: var(--gold-wash); color: var(--text); }
  .nav__item[aria-current="page"] {
    background: var(--gold-wash-2);
    color: var(--text);
    box-shadow: inset 2px 0 0 var(--gold);
  }
  .nav__item[aria-current="page"] svg { color: var(--gold-text); }

  .side__foot { margin-top: auto; display: grid; gap: 0.2rem; padding-top: 1rem; border-top: 1px solid var(--line-soft); }
  .side__btn {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-height: 42px;
    padding: 0 1rem;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-3);
    font: 500 0.9rem/1 var(--font-ui);
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
  }
  .side__btn:hover { background: var(--gold-wash); color: var(--text); }
  :root:not([data-theme="light"]) .ico--moon,
  :root[data-theme="light"] .ico--sun { display: none; }

  .top, .tabbar, .fab { display: none !important; }

  .main {
    width: 100%;
    max-width: 1320px;
    margin: 0 auto;
    padding: 2.2rem 2.6rem 3.5rem;
  }
  .main--fill {
    height: 100vh;
    height: 100dvh;
    padding-bottom: 1.6rem;
  }
}
.side__btn .ico--sun, .side__btn .ico--moon { display: block; }

/* ---------- cabeçalho de página ---------- */
.page__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.8rem 1rem;
  margin-bottom: 1.2rem;
}
.page__title { font-size: clamp(1.9rem, 3.4vw, 2.6rem); }
.page__sub { margin-top: 0.3rem; color: var(--text-2); font-size: 0.98rem; }
.page__actions { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
@media (max-width: 959px) {
  .page__head--hide-m { display: none; }
  .page__actions--desk { display: none; }
}

/* ---------- blocos genéricos ---------- */
.stack { display: grid; gap: 1rem; }
.stack--sm { gap: 0.6rem; }
.row { display: flex; align-items: center; gap: 0.7rem; }
.row--wrap { flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--text-2); }
.subtle { color: var(--text-3); }
.grid2 { display: grid; gap: 0.9rem; grid-template-columns: 1fr 1fr; }
.grid3 { display: grid; gap: 0.9rem; grid-template-columns: repeat(3, 1fr); }
.tnum { font-variant-numeric: tabular-nums; }
.is-inc { color: var(--inc-text); }
.is-exp { color: var(--exp-text); }

.sect-title {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin: 1.8rem 0 0.8rem;
  font: 500 0.74rem/1 var(--font-ui);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold-text);
}
.sect-title::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line-strong), transparent); }

/* ---------- segmentado ---------- */
.seg {
  display: inline-flex;
  max-width: 100%;
  padding: 3px;
  gap: 2px;
  background: var(--card-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
}
.seg__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 38px;
  padding: 0 0.95rem;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-2);
  font: 500 0.88rem/1 var(--font-ui);
  letter-spacing: 0.03em;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.seg__btn:hover { color: var(--text); }
.seg__btn[aria-pressed="true"] {
  background: var(--gold-grad);
  color: var(--on-gold);
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.22);
}
.seg--block { display: flex; }
.seg--block .seg__btn { flex: 1; }

/* ---------- avatar, vazio, dinheiro ---------- */
.avatar {
  --s: 44px;
  flex: none;
  width: var(--s);
  height: var(--s);
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: linear-gradient(135deg, rgba(245, 224, 163, 0.2), rgba(169, 130, 47, 0.1));
  color: var(--gold-text);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: calc(var(--s) * 0.4);
  line-height: 1;
  letter-spacing: 0.04em;
}

.empty {
  display: grid;
  justify-items: center;
  gap: 0.6rem;
  padding: 2.6rem 1rem;
  text-align: center;
  color: var(--text-2);
}
.empty__ico {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--gold-wash);
  color: var(--gold-text);
}
.empty__title { font-size: 1.55rem; color: var(--text); }
.empty__text { max-width: 38ch; }
.empty .btn { margin-top: 0.6rem; }

.money { position: relative; }
.money__cur {
  position: absolute;
  left: 0.95rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  font-size: 0.95rem;
  pointer-events: none;
}
.money .input { padding-left: 2.7rem; }

/* ---------- janelas (sheets) ---------- */
#overlays { position: relative; z-index: 500; }

.ov {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: var(--overlay);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  animation: fade 0.18s ease both;
}
.ov.is-leaving { opacity: 0; transition: opacity 0.17s ease; pointer-events: none; }

.sheet {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 580px;
  max-height: 94vh;
  max-height: 94dvh;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 24px 24px 0 0;
  box-shadow: var(--shadow);
  outline: none;
  animation: rise 0.26s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.sheet--sm { max-width: 450px; }
.sheet--lg { max-width: 780px; }

.sheet__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 0.9rem 0.5rem 1.4rem;
}
.sheet__ttl { display: grid; gap: 0.45rem; padding-top: 0.2rem; min-width: 0; }
.sheet__title { font-size: 1.7rem; overflow-wrap: anywhere; }
.sheet__body {
  padding: 0.7rem 1.4rem 1.3rem;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.sheet__foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.7rem;
  padding: 0.95rem 1.4rem calc(0.95rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line-soft);
}
.sheet__msg { color: var(--text-2); line-height: 1.55; }

@media (min-width: 640px) {
  .ov { align-items: center; padding: 1.5rem; }
  .sheet {
    border-bottom: 1px solid var(--line);
    border-radius: 24px;
    animation: pop 0.22s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  }
}

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pop { from { transform: translateY(12px) scale(0.98); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- avisos ---------- */
.toasts {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tab-h) + 86px);
  z-index: 600;
  display: grid;
  gap: 0.5rem;
  width: min(92vw, 440px);
  transform: translateX(-50%);
  pointer-events: none;
}
@media (min-width: 960px) { .toasts { bottom: 1.6rem; } }

.toast {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: #1d1a15;
  color: var(--text);
  box-shadow: var(--shadow);
  font-size: 0.95rem;
  pointer-events: auto;
  animation: rise 0.24s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.toast.is-leaving { opacity: 0; transform: translateY(8px); transition: opacity 0.2s ease, transform 0.2s ease; }
.toast--ok svg { color: var(--inc-text); }
.toast--error { border-color: var(--danger-line); }
.toast--error svg { color: var(--danger); }
.toast__msg { flex: 1; min-width: 0; }
.toast__act {
  flex: none;
  margin: -0.3rem -0.4rem -0.3rem 0;
  padding: 0.5rem 0.65rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--gold-text);
  font: 600 0.88rem/1 var(--font-ui);
  letter-spacing: 0.04em;
  cursor: pointer;
}
.toast__act:hover { background: var(--gold-wash); }

/* ---------- tela de bloqueio ---------- */
.lock {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 1.2rem;
  overflow-y: auto;
  background:
    radial-gradient(ellipse 80% 55% at 50% 28%, rgba(217, 181, 96, 0.13), transparent 70%),
    var(--bg);
  transition: opacity 0.26s ease, transform 0.26s ease;
}
.lock.is-leaving { opacity: 0; transform: scale(1.02); pointer-events: none; }
.lock__swoosh { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.lock__panel {
  --k: clamp(58px, 9.4vh, 76px);
  position: relative;
  width: 100%;
  max-width: 340px;
  margin: auto;
  padding: 0.6rem 0;
  text-align: center;
}
.lock__logo { width: clamp(120px, 24vh, 190px); height: auto; margin: 0 auto 1rem; }
.lock__title { font-size: 1.75rem; margin: 0.5rem 0 0.35rem; }
.lock__msg { min-height: 2.7em; padding: 0 0.5rem; font-size: 0.9rem; line-height: 1.35; color: var(--text-2); }
.lock__msg.is-err { color: var(--danger); }
.lock__dots { display: flex; justify-content: center; gap: 14px; margin: 0.9rem 0 1.3rem; }
.dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid var(--gold);
  transition: background 0.12s ease, transform 0.12s ease;
}
.dot.is-on { background: var(--gold-grad); transform: scale(1.08); }
.lock__dots.is-shake { animation: shake 0.4s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-9px); }
  40%, 80% { transform: translateX(9px); }
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, var(--k));
  justify-content: center;
  gap: calc(var(--k) * 0.2);
  transition: opacity 0.2s ease;
}
.keypad.is-off { opacity: 0.35; pointer-events: none; }
.key {
  width: var(--k);
  height: var(--k);
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.025);
  color: var(--text);
  font-family: var(--font-display);
  font-size: calc(var(--k) * 0.42);
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease, transform 0.1s ease;
}
.key:hover { background: var(--gold-wash); border-color: var(--gold); }
.key:active { background: var(--gold-wash-2); transform: scale(0.95); }
.key--act { border-color: transparent; background: transparent; color: var(--text-2); }
.key--act:disabled { opacity: 0.3; pointer-events: none; }
.key--ghost { border-color: transparent; background: transparent; pointer-events: none; }
.lock__link {
  min-height: 44px;
  margin-top: 1.1rem;
  padding: 0 1rem;
  border: 0;
  background: none;
  color: var(--text-3);
  font: 400 0.86rem/1 var(--font-ui);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.lock__link:hover { color: var(--gold-text); }
.lock__choices { display: grid; gap: 0.7rem; width: min(280px, 100%); margin: 1.3rem auto 0; }
