/* ==========================================================
   ImobiSys · tema visual
   ========================================================== */
:root {
  --brand: #2563eb;
  --brand-dark: #1e3a8a;
  --brand-soft: #eff6ff;
  --sidebar-w: 268px;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --border: #e5e9f2;
  --text: #0f172a;
  --muted: #5b6778;
  --radius: 14px;
}

*, *::before, *::after { box-sizing: border-box; }
html { overflow-x: visible; }
body { overflow-x: hidden; overflow-x: clip; }
body { background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }

.brand-mark {
  width: 64px; height: 64px; border-radius: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff; color: var(--brand); font-size: 1.9rem;
  box-shadow: 0 10px 25px rgba(0,0,0,.15);
}
.brand-mark-sm {
  width: 38px; height: 38px; border-radius: 11px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark)); color: #fff; font-size: 1.1rem;
}
.min-w-0 { min-width: 0; }

/* ==========================================================
   LOGIN: painel da marca (desenho) + formulário
   ========================================================== */
.login-page { margin: 0; min-height: 100vh; background: var(--bg); overflow-x: hidden; }
.login-split { display: flex; flex-direction: column; min-height: 100vh; }

.login-hero {
  display: none; position: relative; overflow: hidden; color: #fff;
  padding: 3rem; align-items: center;
  background:
    radial-gradient(circle at 12% 14%, rgba(255,255,255,.22), transparent 38%),
    radial-gradient(circle at 92% 92%, rgba(29,78,216,.55), transparent 42%),
    linear-gradient(155deg, #0a1a4a 0%, #13286b 50%, #1e40af 100%);
}
.login-hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.07) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(circle at 35% 40%, #000, transparent 72%);
          mask-image: radial-gradient(circle at 35% 40%, #000, transparent 72%);
}
.login-hero-inner { position: relative; z-index: 1; width: 100%; max-width: 480px; margin: auto; }
.login-hero-kicker {
  display: inline-block; margin: 0 0 .9rem; padding: .3rem .75rem; border-radius: 999px;
  font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22);
}
.login-hero-titulo { font-size: 2.2rem; font-weight: 800; line-height: 1.15; letter-spacing: -.02em; margin: 0; }
.login-hero-texto { opacity: .88; margin: 1rem 0 0; font-size: 1.02rem; line-height: 1.6; max-width: 420px; }
/* Foto opcional do painel de entrada (Configurações → Sistema) */
.login-foto {
  margin-top: 2rem; aspect-ratio: 4 / 3; border-radius: 22px; overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .18); box-shadow: 0 24px 48px rgba(7, 18, 48, .4);
}
.login-foto img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Recursos do sistema, quando não há foto no painel */
.login-recursos { list-style: none; padding: 0; margin: 2.25rem 0 0; display: grid; gap: 1.1rem; }
.login-recursos li { display: flex; gap: .9rem; align-items: flex-start; }
.login-recursos i {
  width: 44px; height: 44px; border-radius: 13px; flex-shrink: 0; font-size: 1.2rem;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .2);
}
.login-recursos strong { display: block; font-size: 1rem; font-weight: 700; }
.login-recursos span { display: block; opacity: .85; font-size: .9rem; line-height: 1.45; }

.login-side {
  position: relative; flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 4.5rem 1.25rem 2.5rem; background: var(--surface);
}
.login-tema { position: absolute; top: 1rem; right: 1rem; }

.login-card { width: 100%; max-width: 390px; }
.login-marca { text-align: center; margin-bottom: 2rem; }
.login-logo {
  width: 68px; height: 68px; border-radius: 20px; margin-bottom: 1rem;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark)); color: #fff; font-size: 1.9rem;
  box-shadow: 0 14px 28px rgba(37, 99, 235, .3);
}
.login-logo.brand-img { background: transparent; box-shadow: none; }
.login-titulo { font-size: 1.6rem; font-weight: 800; letter-spacing: -.01em; margin: 0; }
.login-sub { color: var(--muted); margin: .35rem 0 0; font-size: .95rem; }

.login-campo {
  position: relative; display: flex; align-items: center;
  margin-bottom: 1rem; border: 1px solid var(--border); border-radius: 14px;
  background: var(--bg); transition: border-color .15s, box-shadow .15s, background .15s;
}
.login-campo:focus-within { border-color: var(--brand); box-shadow: 0 0 0 .24rem rgba(37, 99, 235, .14); background: var(--surface); }
.login-campo > i:first-child { position: absolute; left: 1rem; color: var(--muted); font-size: 1.05rem; pointer-events: none; transition: color .15s; }
.login-campo:focus-within > i:first-child { color: var(--brand); }
.login-campo input {
  width: 100%; border: 0; background: transparent; color: var(--text);
  padding: .95rem 1rem .95rem 2.8rem; font-size: 1rem; outline: none; border-radius: 14px;
}
.login-campo input::placeholder { color: var(--muted); opacity: .9; }
.login-olho { border: 0; background: transparent; color: var(--muted); padding: .5rem .9rem; margin-right: .15rem; border-radius: 10px; line-height: 1; }
.login-olho:hover { color: var(--brand); }

.login-botao {
  width: 100%; margin-top: .5rem; padding: .95rem; border: 0; border-radius: 14px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark)); color: #fff;
  font-weight: 700; font-size: 1rem; letter-spacing: .01em;
  box-shadow: 0 12px 24px rgba(37, 99, 235, .3); transition: transform .15s, box-shadow .15s;
}
.login-botao:hover { transform: translateY(-1px); box-shadow: 0 16px 30px rgba(37, 99, 235, .38); }
.login-botao:active { transform: translateY(0); }

.login-rodape { text-align: center; color: var(--muted); font-size: .8rem; margin: 2rem 0 0; }
.login-esqueci { color: var(--brand); font-weight: 600; text-decoration: none; }
.login-esqueci:hover { text-decoration: underline; }

@media (min-width: 992px) {
  .login-split { flex-direction: row; }
  .login-hero { display: flex; flex: 0 0 50%; }
  .login-side { flex: 0 0 50%; min-height: 100vh; }
}

/* Celular e tablet: fundo com o gradiente da marca e o cartão por cima */
@media (max-width: 991.98px) {
  .login-page { background: linear-gradient(155deg, #0a1a4a 0%, #13286b 55%, #1e40af 100%); }
  .login-side { background: transparent; min-height: 100vh; }
  .login-card { background: var(--surface); border-radius: 24px; padding: 2.25rem 1.75rem 1.75rem; box-shadow: 0 30px 60px rgba(7, 18, 48, .3); }
  .login-tema { color: #fff; }
  .login-tema .btn-theme { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.3); color: #fff; }
}

/* ==========================================================
   CARREGAMENTO AO ENTRAR (discreto)
   ========================================================== */
.loader-overlay {
  position: fixed; inset: 0; z-index: 2000;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.1rem;
  background: rgba(15, 23, 42, .55); backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none; transition: opacity .25s ease;
}
.loader-overlay.show { opacity: 1; pointer-events: auto; }
.loader-spinner {
  width: 46px; height: 46px; border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, .25); border-top-color: #fff;
  animation: girar .8s linear infinite;
}
.loader-texto { color: #fff; font-weight: 600; margin: 0; letter-spacing: .02em; }
@keyframes girar { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .loader-spinner { animation-duration: 2.4s; } }

/* Pessoa inativa: linha mais apagada na listagem */
.pessoa-inativa td { opacity: .6; }

/* ==========================================================
   LAYOUT INTERNO
   ========================================================== */
.app-wrapper { display: flex; min-height: 100vh; }

.app-sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
}
.sidebar-brand {
  padding: 1.35rem 1.25rem;
  border-bottom: 1px solid var(--border);
  min-height: 74px;
}
/* scrollbar-gutter: reserva o espaço da barra de rolagem desde o início, para o menu não "pular" ao abrir um grupo */
.sidebar-nav { padding: .75rem .75rem; gap: .15rem; overflow-y: auto; flex: 1; scrollbar-gutter: stable; scrollbar-width: thin; }
.nav-section {
  font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: #94a3b8; padding: 1rem .75rem .35rem;
}
.sidebar-nav .nav-link {
  color: #475569; border-radius: 10px; padding: .6rem .8rem;
  display: flex; align-items: center; gap: .75rem; font-weight: 500; font-size: .95rem;
  border: 0; background: transparent; width: 100%; text-align: left;
  transition: background .15s, color .15s;
}
.sidebar-nav .nav-link i:first-child { font-size: 1.1rem; width: 1.25rem; text-align: center; }
.sidebar-nav .nav-link:hover { background: var(--brand-soft); color: var(--brand); }
.sidebar-nav .nav-link.active { background: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(37,99,235,.25); }
.sidebar-nav .nav-link .chevron { font-size: .75rem; transition: transform .2s; }
.sidebar-nav .sidebar-divider { margin: .5rem .8rem; border: 0; border-top: 1px solid rgba(148, 163, 184, .35); opacity: 1; }
.sidebar-nav .nav-link:not(.collapsed) .chevron { transform: rotate(180deg); }
.sidebar-nav .submenu { padding-left: .5rem; gap: .1rem; }
/* Os grupos (Cadastros, Configurações) ocupam a largura do menu e não "encolhem" para o lado */
.sidebar-nav { flex-wrap: nowrap; }
.sidebar-nav > .collapse,
.sidebar-nav .submenu { width: 100%; flex-wrap: nowrap; }
.sidebar-nav .submenu .nav-link { font-size: .9rem; padding: .45rem .8rem; }

.sidebar-footer {
  padding: 1rem 1.25rem 1.25rem;
  border-top: 1px solid var(--border);
}
.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: .85rem;
}

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.app-topbar {
  position: sticky; top: 0; z-index: 1030;
  display: flex; align-items: center; gap: .85rem;
  padding: .65rem 1rem; background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.btn-icon { width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border-radius: 10px; }

.app-content { padding: 2rem 2.25rem; width: 100%; max-width: 1400px; }
.page-head { margin-bottom: 1.5rem; align-items: center; }

@media (max-width: 991.98px) {
  .app-content { padding: 1.1rem 1rem; }
  .app-sidebar { width: 290px; }
}
@media (min-width: 992px) {
  .app-sidebar { position: sticky; top: 0; height: 100vh; }
  .app-sidebar.offcanvas-lg { visibility: visible; transform: none; }
}

/* ==========================================================
   CARDS E ELEMENTOS
   ========================================================== */
.card { border-radius: var(--radius); border: 1px solid var(--border) !important; box-shadow: 0 1px 2px rgba(15,23,42,.04); }

.welcome-card {
  background: linear-gradient(120deg, #1e3a8a, #2563eb 70%, #0ea5e9);
  box-shadow: 0 14px 30px rgba(37,99,235,.2);
}
.quick-card { transition: transform .15s, box-shadow .15s; color: inherit; }
.quick-card:hover { transform: translateY(-3px); box-shadow: 0 12px 24px rgba(15,23,42,.08); }
.quick-icon {
  width: 46px; height: 46px; border-radius: 12px; display: inline-flex;
  align-items: center; justify-content: center; font-size: 1.3rem;
}

.empty-icon {
  width: 72px; height: 72px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-soft); color: var(--brand); font-size: 1.9rem;
}

.alert { border-radius: 10px; border: 0; }
.btn { border-radius: 10px; }

/* Busca e avatar nas listagens */
.search-box { position: relative; max-width: 460px; }
.search-box i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); z-index: 2; }
.search-box .form-control { padding-left: 2.6rem; border-radius: 10px; height: 44px; border-color: var(--border); }
.table thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border-bottom: 0; }
.table td { padding-top: .9rem; padding-bottom: .9rem; border-color: var(--border); }

/* ==========================================================
   TEMA ESCURO E COMPONENTES DO TEMA / DASHBOARD
   ========================================================== */
:root { --nav-text: #475569; }

[data-bs-theme="dark"] {
  --bg: #0b1120;
  --surface: #111a2d;
  --border: #1f2c44;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --brand-soft: rgba(59,130,246,.15);
  --nav-text: #cbd5e1;
}
[data-bs-theme="dark"] .table-light { --bs-table-bg: #172238; --bs-table-color: var(--muted); color: var(--muted); }
[data-bs-theme="dark"] .auth-form-side { background: var(--surface); }
[data-bs-theme="dark"] .auth-page { background: var(--bg); }

.sidebar-nav .nav-link { color: var(--menu-texto, var(--nav-text)); }

/* Menu com cor escolhida em Configurações > Sistema (--menu-bg e --menu-texto vêm do layout) */
.app-sidebar { background: var(--menu-bg, var(--surface)); }
.menu-personalizado .app-sidebar { border-right-color: transparent; }
.menu-personalizado .app-sidebar .text-secondary,
.menu-personalizado .app-sidebar .nav-section,
.menu-personalizado .app-sidebar .sidebar-divider { color: var(--menu-texto) !important; opacity: .75; }
.menu-personalizado .app-sidebar .sidebar-footer,
.menu-personalizado .app-sidebar .sidebar-brand { border-color: rgba(127, 127, 127, .35); }
.menu-personalizado .app-sidebar .nav-link:hover { background: rgba(127, 127, 127, .18); color: var(--menu-texto); }
.menu-personalizado .app-sidebar .nav-link.active { background: var(--menu-texto); color: var(--menu-bg); }

/* Botão de tema (sol / lua) */
.btn-theme {
  width: 42px; height: 42px; border-radius: 12px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 1.05rem; transition: background .15s, transform .15s;
}
.btn-theme:hover { background: var(--brand-soft); transform: rotate(12deg); }
.btn-theme .icon-sun { color: #f59e0b; }
.btn-theme .icon-moon { color: #6366f1; }
html[data-bs-theme="dark"] .btn-theme .icon-moon { display: none; }
html:not([data-bs-theme="dark"]) .btn-theme .icon-sun { display: none; }

.auth-theme { position: absolute; top: 1rem; right: 1rem; z-index: 5; }
.auth-form-side { position: relative; }
.auth-form-side .auth-theme { position: absolute; }

/* Cabeçalho da página */
.page-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.page-actions { flex-wrap: wrap; justify-content: flex-end; }

/* Botões Kanban / Lista */
.view-toggle .btn { border-color: var(--border); color: var(--muted); background: var(--surface); }
.view-toggle .btn.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* Modo Kanban */
.kanban-board { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; }
.kanban-col { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem; display: flex; flex-direction: column; gap: .75rem; }
.kanban-head { display: flex; align-items: center; gap: .6rem; }
.kanban-head .quick-icon { width: 38px; height: 38px; font-size: 1.1rem; border-radius: 10px; }
.kanban-card { transition: transform .15s, box-shadow .15s; color: inherit; }
.kanban-card:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(15,23,42,.1); }

/* Modo Lista */
.dash-lista .list-group-item { background: var(--surface); border-color: var(--border); color: var(--text); }
.dash-lista .list-group-item:hover { background: var(--brand-soft); }

/* Alternância entre os modos */
[data-dash="kanban"] .dash-lista { display: none; }
[data-dash="lista"] .dash-kanban { display: none; }
/* Sem escolha salva (data-dash vazio): Kanban no computador e Lista no celular, já na primeira pintura */
@media (min-width: 768px) { [data-dash=""] .dash-lista { display: none; } }
@media (max-width: 767.98px) { [data-dash=""] .dash-kanban { display: none; } }



/* ==========================================================
   BOTÃO SAIR
   ========================================================== */
.btn-logout {
  display: flex; align-items: center; justify-content: center; gap: .55rem;
  padding: .65rem 1rem; border-radius: 12px; font-weight: 600; font-size: .92rem;
  color: #b91c1c; background: linear-gradient(135deg, #fff1f2, #fee2e2);
  border: 1px solid #fecaca; transition: all .2s ease;
}
.btn-logout i { font-size: 1.05rem; transition: transform .2s; }
.btn-logout:hover { background: linear-gradient(135deg, #ef4444, #dc2626); color: #fff; border-color: #dc2626; box-shadow: 0 8px 18px rgba(220,38,38,.25); }
.btn-logout:hover i { transform: translateX(3px); }
[data-bs-theme="dark"] .btn-logout { background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.35); color: #fca5a5; }

/* Modais */
.modal-soft { border-radius: 20px; }
.modal-title-icon {
  width: 46px; height: 46px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark)); color: #fff; font-size: 1.25rem;
}
.modal-icon-danger {
  width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: #fee2e2; color: #dc2626; font-size: 1.6rem;
}
[data-bs-theme="dark"] .modal-icon-danger { background: rgba(239,68,68,.15); }
.modal .form-control { border-radius: 10px; border-color: var(--border); padding: .6rem .85rem; }
.modal .form-label { font-size: .9rem; }
.status-box { background: var(--brand-soft); border: 1px dashed var(--border); border-radius: 12px; padding: .9rem 1rem; }
.form-check-input:checked { background-color: #16a34a; border-color: #16a34a; }

/* Status (ativo / inativo) */
.status-pill { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .7rem; border-radius: 999px; font-size: .8rem; font-weight: 600; }
.status-on { background: #dcfce7; color: #15803d; }
.status-off { background: #f1f5f9; color: #475569; }
[data-bs-theme="dark"] .status-on { background: rgba(34,197,94,.15); color: #86efac; }
[data-bs-theme="dark"] .status-off { background: rgba(148,163,184,.15); color: #cbd5e1; }

/* ==========================================================
   DASHBOARD
   ========================================================== */
.welcome-cta { color: var(--brand-dark); box-shadow: 0 6px 16px rgba(15,23,42,.18); white-space: nowrap; }
.welcome-cta:hover { color: var(--brand); transform: translateY(-1px); }

.stat-card { transition: transform .15s, box-shadow .15s; color: inherit; }
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 12px 24px rgba(15,23,42,.08); color: inherit; }
.stat-card .card-body { padding: 1.25rem 1.3rem; }
.stat-value { font-size: 1.9rem; font-weight: 800; line-height: 1.1; letter-spacing: -.02em; margin-bottom: .2rem; }
.stat-arrow { color: var(--muted); opacity: .6; transition: transform .15s, opacity .15s; }
.stat-card:hover .stat-arrow { transform: translate(2px, -2px); opacity: 1; }

.section-title { letter-spacing: .06em; }

@media (max-width: 575.98px) {
  .stat-value { font-size: 1.5rem; }
  .welcome-cta { width: 100%; }
}

/* ==========================================================
   CLIENTES: fotos na listagem e no modal
   ========================================================== */
[hidden] { display: none !important; }

.foto-thumb {
  width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0; object-fit: cover;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
}
.foto-thumb-vazia { background: var(--brand-soft); color: var(--brand); font-weight: 700; }

.foto-box { padding: 1.25rem; border: 1px dashed var(--border); border-radius: var(--radius); background: var(--bg); }
.foto-preview {
  width: 150px; height: 150px; border-radius: 18px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-soft); border: 1px solid var(--border);
}
.foto-preview img { width: 100%; height: 100%; object-fit: cover; }
.foto-preview-inicial { font-size: 3rem; font-weight: 800; color: var(--brand); }

/* ==========================================================
   SELETOR DE PESSOA (documentos e recibos)
   ========================================================== */
.pessoa-lista { max-height: 264px; overflow-y: auto; background: var(--surface); }
.pessoa-lista .list-group-item { background: transparent; color: var(--text); border-color: var(--border); }
.pessoa-lista .list-group-item.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.pessoa-lista .list-group-item:not(.active):hover { background: var(--brand-soft); }

/* ==========================================================
   RECIBO: passos, tipo e logo
   ========================================================== */
.step-head { display: flex; align-items: center; gap: .6rem; font-weight: 700; font-size: 1rem; }
.step-num {
  width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand); color: #fff; font-size: .85rem; font-weight: 700;
}
.tipo-card {
  display: flex; flex-direction: column; gap: .2rem; cursor: pointer;
  padding: 1rem 1.1rem; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); transition: border-color .15s, background .15s, box-shadow .15s;
}
.tipo-card i { font-size: 1.4rem; color: var(--brand); margin-bottom: .2rem; }
.tipo-card:hover { border-color: var(--brand); }
.btn-check:checked + .tipo-card { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 .2rem rgba(37,99,235,.15); }
.btn-check:focus-visible + .tipo-card { outline: 2px solid var(--brand); outline-offset: 2px; }

.logo-preview {
  width: 96px; height: 96px; flex-shrink: 0; overflow: hidden;
  border-radius: 14px; border: 1px dashed var(--border); background: var(--bg);
}
.logo-preview img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }

/* Perfil de acesso no cadastro de usuário (mesmo visual dos cards de tipo) */
.perfil-card {
  display: flex; flex-direction: column; gap: .2rem; cursor: pointer; height: 100%;
  padding: .9rem 1rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.perfil-card i { font-size: 1.3rem; color: var(--brand); margin-bottom: .15rem; }
.perfil-card:hover { border-color: var(--brand); }
.btn-check:checked + .perfil-card { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 .2rem rgba(37,99,235,.15); }
.btn-check:focus-visible + .perfil-card { outline: 2px solid var(--brand); outline-offset: 2px; }

.form-control-color { height: 42px; border-radius: 10px; }
.doc-icon { width: 40px; height: 40px; border-radius: 10px; font-size: 1.1rem; flex-shrink: 0; }

@media (max-width: 575.98px) { .tipo-card { padding: .85rem; } }

/* ==========================================================
   MARCA, FOTO DE PERFIL E IDENTIDADE DO SISTEMA
   ========================================================== */
.brand-img { background: transparent !important; box-shadow: none !important; padding: 0; overflow: hidden; }
.brand-img img { width: 100%; height: 100%; object-fit: contain; }
.avatar-foto { padding: 0; overflow: hidden; background: transparent; }
.avatar-foto img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

.identidade-preview {
  width: 100%; height: 190px; background: var(--bg); overflow: hidden;
}
.identidade-preview img { max-width: 100%; max-height: 100%; object-fit: contain; padding: 14px; }
.identidade-preview.identidade-redonda { width: 170px; height: 170px; }
.identidade-redonda img { width: 100%; height: 100%; object-fit: cover; padding: 0; border-radius: 50%; }
.identidade-vazia { font-size: 3rem; color: var(--muted); }
.identidade-preview[hidden], .identidade-preview img[hidden] { display: none !important; }

/* ==========================================================
   DASHBOARD: números em destaque, indicadores e gráficos
   ========================================================== */
.stat-num { font-size: 2.4rem; font-weight: 800; line-height: 1; letter-spacing: -.03em; color: var(--text); }
.stat-nome { font-size: 1.05rem; font-weight: 700; color: var(--text); }
.stat-card .card-body { padding: 1.3rem 1.35rem; }

.indicador .card-body { padding-left: 1.1rem; padding-right: 1.1rem; }
.indicador-icone {
  width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; font-size: 1.15rem;
}
.indicador-valor { font-size: 1.2rem; font-weight: 800; letter-spacing: -.01em; color: var(--text); }

.grafico-caixa { position: relative; height: 270px; width: 100%; }
.grafico-rosca { height: 250px; }

/* ==========================================================
   LÁPIS PARA TROCAR A LOGO E A FOTO; ÍCONES DOS MÓDULOS
   ========================================================== */
.identidade-preview { position: relative; }
.btn-lapis {
  position: absolute; top: .6rem; right: .6rem; z-index: 3; margin: 0;
  width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand); color: #fff; box-shadow: 0 8px 18px rgba(37, 99, 235, .35);
  transition: transform .15s, background .15s;
}
.btn-lapis:hover { background: var(--brand-dark); transform: scale(1.06) rotate(-8deg); }
.identidade-redonda .btn-lapis { top: 0; right: 0; }

.marca-lapis {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted); background: var(--bg); transition: color .15s, background .15s;
}
.marca-lapis:hover { color: var(--brand); background: var(--brand-soft); }

.modulo-icone {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; font-size: 1.15rem;
}
.modulo-numero { font-size: 1.5rem; font-weight: 800; line-height: 1; letter-spacing: -.02em; color: var(--text); }

/* Prévias de logo e foto com o lápis sem recorte (a imagem é que fica redonda) */
.identidade-preview { overflow: visible !important; }
.identidade-preview.identidade-redonda img { border-radius: 50%; }
.identidade-preview.identidade-redonda .btn-lapis { top: auto; right: 4px; bottom: 4px; width: 44px; height: 44px; }
.identidade-preview:not(.identidade-redonda) .btn-lapis { top: .6rem; right: .6rem; }

/* ==========================================================
   PAGINAÇÃO (listagens)
   ========================================================== */
.paginacao-lista { gap: .3rem; flex-wrap: wrap; justify-content: center; }
.paginacao-lista .page-link {
  min-width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 10px !important; background: var(--surface);
  color: var(--text); font-weight: 600; font-size: .9rem; padding: 0 .75rem;
  transition: background .15s, border-color .15s, color .15s;
}
.paginacao-lista .page-link:hover { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.paginacao-lista .page-item.active .page-link {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark)); border-color: transparent; color: #fff;
  box-shadow: 0 6px 14px rgba(37, 99, 235, .3);
}
.paginacao-lista .page-item.disabled .page-link { background: transparent; color: var(--muted); opacity: .55; }
.paginacao-lista .paginacao-seta { padding: 0 .9rem; }
.paginacao-resumo strong { font-weight: 700; }

/* Tabelas no celular: menos espaço nas laterais e selos que quebram linha */
@media (max-width: 575.98px) {
  .table > :not(caption) > * > * { padding-left: .6rem; padding-right: .6rem; }
  .table .badge { white-space: normal; text-align: left; }
  .table .btn-sm { padding: .3rem .5rem; }
}

/* ==========================================================
   STATUS ONLINE / OFFLINE e rodapé do menu lateral
   ========================================================== */
.status-bolinha {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--surface);
}
.status-bolinha.online { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .22); }
.status-bolinha.offline { background: #94a3b8; }
.usuario-avatar .status-bolinha { position: absolute; right: -2px; bottom: -2px; }
.usuario-rodape { padding-top: .25rem; }
.status-texto-online { color: #15803d; font-weight: 600; }
[data-bs-theme="dark"] .status-texto-online { color: #4ade80; }

.btn-sair {
  display: inline-flex; align-items: center; gap: .4rem; flex-shrink: 0;
  padding: .45rem .7rem; border-radius: 10px; font-size: .85rem; font-weight: 600;
  color: #b91c1c; background: #fff1f2; border: 1px solid #fecaca; transition: background .15s, color .15s;
}
.btn-sair:hover { background: #dc2626; color: #fff; border-color: #dc2626; }
[data-bs-theme="dark"] .btn-sair { background: rgba(239, 68, 68, .12); border-color: rgba(239, 68, 68, .35); color: #fca5a5; }

/* ==========================================================
   PALETA DO DASHBOARD: cada área tem a sua cor
   Clientes = azul · Inquilinos = roxo · Documentos = âmbar · Recibos = verde
   ========================================================== */
.cor-clientes   { --cor: #2563eb; }
.cor-inquilinos { --cor: #7c3aed; }
.cor-documentos { --cor: #b45309; }
.cor-recibos    { --cor: #15803d; }
.cor-cancelado  { --cor: #dc2626; }
.cor-neutro     { --cor: #64748b; }
.cor-chip { background: color-mix(in srgb, var(--cor) 14%, transparent); color: var(--cor); }

.kanban-col .kanban-head .quick-icon { background: color-mix(in srgb, var(--cor) 14%, transparent) !important; color: var(--cor) !important; }
.kanban-card .modulo-numero { color: var(--cor); }
.dash-lista .modulo-numero { color: var(--cor); }

.indicador { border-left: 4px solid var(--cor); }
.indicador-icone { background: color-mix(in srgb, var(--cor) 14%, transparent); color: var(--cor); }
.indicador-valor { font-size: 1.35rem; }

.dash-card-titulo { font-size: .95rem; font-weight: 700; margin: 0; }
.dash-card-sub { font-size: .8rem; color: var(--muted); }

/* ==========================================================
   MENU LATERAL: rodapé (usuário e Sair) sempre no final
   ========================================================== */
.app-sidebar { display: flex; flex-direction: column; }
.app-sidebar > .offcanvas-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.app-sidebar .sidebar-nav { flex: 1 1 auto; min-height: 0; }
.app-sidebar .sidebar-footer { flex-shrink: 0; margin-top: auto; }
@media (min-width: 992px) {
  .app-sidebar { height: 100vh; position: sticky; top: 0; }
}

/* ==========================================================
   MÓDULOS DO DASHBOARD: números brancos sobre a cor do módulo
   ========================================================== */
.kanban-col .kanban-card {
  border: 0 !important; color: #fff;
  background: linear-gradient(135deg, var(--cor), color-mix(in srgb, var(--cor) 72%, #0f172a)) !important;
  box-shadow: 0 12px 24px color-mix(in srgb, var(--cor) 30%, transparent);
}
.kanban-col .kanban-card:hover { box-shadow: 0 16px 30px color-mix(in srgb, var(--cor) 42%, transparent); }
.kanban-col .kanban-card .modulo-numero { color: #fff; }
.kanban-col .kanban-card .text-secondary { color: rgba(255, 255, 255, .85) !important; }
.kanban-col .kanban-card .kanban-abrir { color: #fff; }

.dash-lista .modulo-numero {
  background: var(--cor); color: #fff; font-size: 1.05rem; font-weight: 800;
  padding: .3rem .85rem; border-radius: 999px; min-width: 52px; text-align: center;
}

/* Menu lateral fixo: fica parado na tela enquanto a página rola (computador) */
@media (min-width: 992px) {
  .app-wrapper { align-items: flex-start; }
  .app-sidebar {
    position: sticky !important; top: 0; align-self: flex-start;
    height: 100vh; max-height: 100vh; overflow: hidden;
  }
  .app-sidebar > .offcanvas-body { height: 100%; }
}

/* ==========================================================
   NOTIFICAÇÕES (canto inferior direito)
   ========================================================== */
.notificacoes-area {
  position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 1085;
  display: flex; flex-direction: column; align-items: flex-end; gap: .6rem;
  width: min(390px, calc(100vw - 2.5rem)); pointer-events: none;
}
.notificacao {
  --cor-n: #2563eb;
  pointer-events: auto; width: 100%;
  display: flex; align-items: flex-start; gap: .8rem;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-left: 4px solid var(--cor-n);
  border-radius: 14px; padding: .9rem 1rem;
  box-shadow: 0 18px 40px rgba(15, 23, 42, .18);
  opacity: 0; transform: translateY(14px) scale(.98);
  transition: opacity .25s ease, transform .25s ease;
}
.notificacao.show { opacity: 1; transform: none; }
.notificacao-success { --cor-n: #16a34a; }
.notificacao-danger  { --cor-n: #dc2626; }
.notificacao-warning { --cor-n: #d97706; }
.notificacao-info    { --cor-n: #2563eb; }
.notificacao-icone {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; font-size: 1.1rem;
  color: var(--cor-n); background: color-mix(in srgb, var(--cor-n) 14%, transparent);
}
.notificacao-texto { flex: 1; min-width: 0; }
.notificacao-texto strong { display: block; font-size: .92rem; font-weight: 700; margin-bottom: .1rem; }
.notificacao-texto span { display: block; font-size: .88rem; color: var(--muted); line-height: 1.4; overflow-wrap: anywhere; }
.notificacao-fechar {
  border: 0; background: transparent; color: var(--muted); padding: .2rem .35rem; border-radius: 8px; line-height: 1;
}
.notificacao-fechar:hover { background: var(--brand-soft); color: var(--text); }
@media (max-width: 575.98px) { .notificacoes-area { left: 1rem; right: 1rem; width: auto; align-items: stretch; } }

/* Modal de sair: ícone grande */
.modal-icon-grande { width: 96px; height: 96px; font-size: 2.5rem; }

/* ==========================================================
   PERMISSÕES: usuários à esquerda, interruptores por permissão
   ========================================================== */
.usuario-avatar-mini {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand-soft); color: var(--brand); font-weight: 800; font-size: .8rem;
}
.usuario-item.active .usuario-avatar-mini { background: rgba(255,255,255,.22); color: #fff; }
.usuario-item { border: 0 !important; border-radius: 12px !important; margin-bottom: .25rem; }
.permissoes-lista { position: sticky; top: 1.25rem; }

.usuario-avatar-grande {
  width: 64px; height: 64px; border-radius: 18px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark)); color: #fff;
  font-weight: 800; font-size: 1.3rem; box-shadow: 0 10px 22px rgba(37, 99, 235, .3);
}
.permissoes-contador { font-size: 1.6rem; font-weight: 800; line-height: 1; color: var(--brand); }

.grupo-permissao .grupo-icone {
  width: 44px; height: 44px; border-radius: 13px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; font-size: 1.2rem;
  background: var(--brand-soft); color: var(--brand);
}
.permissao-linha {
  display: flex; align-items: center; gap: 1rem; padding: .85rem .25rem;
  border-top: 1px solid var(--border); cursor: pointer; transition: background .15s;
}
.permissao-linha:hover { background: color-mix(in srgb, var(--brand) 4%, transparent); }
.permissao-linha label { cursor: pointer; }
.permissao-switch .form-check-input {
  width: 2.7rem; height: 1.45rem; cursor: pointer; margin: 0; border-color: var(--border);
}
.permissao-switch .form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.permissoes-salvar {
  position: sticky; bottom: 1rem; z-index: 5; margin-top: 1rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: .9rem 1.1rem; box-shadow: 0 18px 40px rgba(15, 23, 42, .14);
}

/* ==========================================================
   MARCA: casinha nova, nome com destaque e login mais escuro
   ========================================================== */
.brand-casinha { background: none !important; box-shadow: none !important; padding: 0; overflow: visible; }
.brand-casinha img { width: 100%; height: 100%; display: block; object-fit: contain; border-radius: 0; }
.brand-mark-sm.brand-casinha { width: 40px; height: 40px; }
.login-logo.brand-casinha { width: 76px; height: 76px; margin-bottom: 1.1rem; }
.login-logo.brand-casinha img { filter: drop-shadow(0 12px 18px rgba(10, 26, 74, .35)); }

.wordmark { font-weight: 800; font-size: 1.12rem; letter-spacing: -.02em; color: var(--text); }
.wordmark span { color: #2563eb; }
[data-bs-theme="dark"] .wordmark span { color: #60a5fa; }
.login-titulo span { color: #2563eb; }
[data-bs-theme="dark"] .login-titulo span { color: #60a5fa; }

/* Escolha da frase de motivação ao emitir o recibo */
.frase-escolha { display: flex; flex-direction: column; gap: .6rem; }
.frase-opcao {
  display: flex; align-items: center; gap: .75rem; cursor: pointer; margin: 0;
  padding: .8rem 1rem; border: 1px solid var(--border); border-radius: 14px; background: var(--surface);
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.frase-opcao:hover { border-color: var(--brand); }
.frase-opcao i { font-size: 1.1rem; color: var(--brand); flex-shrink: 0; }
.frase-opcao span { font-style: italic; }
.frase-opcao:has(.frase-radio:checked) { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 .2rem rgba(37, 99, 235, .15); }
.frase-radio { width: 1.1rem; height: 1.1rem; margin: 0; flex-shrink: 0; accent-color: var(--brand); }

/* Gastos com imóveis: cor rosa, lançamento e resumo */
.cor-gastos { --cor: #e11d48; }
.cor-gastos-texto { color: #be123c; }
.cor-estoque { --cor: #b45309; }

/* Estoque: bolinhas da situação (verde, laranja, vermelho) e fotos dos produtos */
.estoque-bolinha { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: .45rem; vertical-align: middle; box-shadow: 0 0 0 3px rgba(148, 163, 184, .15); }
.estoque-bolinha.verde { background: #16a34a; }
.estoque-bolinha.laranja { background: #d97706; }
.estoque-bolinha.vermelho { background: #dc2626; }
.estoque-foto { width: 46px; height: 46px; object-fit: cover; border-radius: .6rem; background: var(--bs-tertiary-bg); }
.estoque-foto-vazia { width: 46px; height: 46px; border-radius: .6rem; background: var(--bs-tertiary-bg); color: var(--bs-secondary-color); display: inline-flex; align-items: center; justify-content: center; font-size: 1.2rem; }

/* Botões "suaves" (fundo leve da cor, borda e texto da mesma cor): ficam bons no modo claro e no escuro */
.btn-soft { --soft: #2563eb; color: var(--soft); background: color-mix(in srgb, var(--soft) 12%, transparent); border: 1px solid color-mix(in srgb, var(--soft) 40%, transparent); font-weight: 600; }
.btn-soft:hover, .btn-soft:focus { color: var(--soft); background: color-mix(in srgb, var(--soft) 22%, transparent); border-color: var(--soft); }
.btn-soft.soft-verde { --soft: #166534; }
.btn-soft.soft-vermelho { --soft: #b91c1c; }
.btn-soft.soft-azul { --soft: #1d4ed8; }
.btn-soft.soft-neutro { --soft: #475569; }
[data-bs-theme="dark"] .btn-soft.soft-verde { --soft: #4ade80; }
[data-bs-theme="dark"] .btn-soft.soft-vermelho { --soft: #f87171; }
[data-bs-theme="dark"] .btn-soft.soft-azul { --soft: #60a5fa; }
[data-bs-theme="dark"] .btn-soft.soft-neutro { --soft: #cbd5e1; }

/* Agenda: kanban de situações (em cima) e calendário pequeno do mês (embaixo) */
.agenda-titulo { min-width: 170px; text-align: center; }
.agenda-kanban { display: grid; grid-template-columns: repeat(4, minmax(200px, 1fr)); gap: 1rem; overflow-x: auto; padding-bottom: .25rem; }
.ag-coluna {
  display: flex; flex-direction: column; min-width: 0; border-radius: 1rem; background: var(--bs-tertiary-bg);
  border: 1px solid var(--bs-border-color); border-top: 4px solid var(--cor, #64748b); min-height: 260px; transition: background .15s, box-shadow .15s;
}
.ag-coluna.cor-primary { --cor: #2563eb; }
.ag-coluna.cor-success { --cor: #16a34a; }
.ag-coluna.cor-secondary { --cor: #64748b; }
.ag-coluna.cor-warning { --cor: #d97706; }
.ag-coluna.solta { background: color-mix(in srgb, var(--cor) 12%, var(--bs-tertiary-bg)); box-shadow: inset 0 0 0 2px var(--cor); }
.ag-coluna-topo { display: flex; justify-content: space-between; align-items: center; padding: .7rem .9rem; font-weight: 700; }
.ag-coluna-titulo { display: inline-flex; align-items: center; gap: .45rem; }
.ag-bolinha { width: 10px; height: 10px; border-radius: 50%; background: var(--cor); }
.ag-contador {
  min-width: 26px; text-align: center; font-size: .78rem; font-weight: 700; padding: .15rem .5rem; border-radius: 999px;
  background: color-mix(in srgb, var(--cor) 16%, transparent); color: var(--cor);
}
.ag-coluna-corpo { display: flex; flex-direction: column; gap: .6rem; padding: 0 .6rem .7rem; flex: 1; }
.ag-vazio { color: var(--bs-secondary-color); font-size: .85rem; text-align: center; padding: 1.5rem .5rem; }
.ag-card {
  background: var(--bs-card-bg); border: 1px solid var(--bs-border-color); border-left: 4px solid var(--tipo, #64748b);
  border-radius: .8rem; padding: .65rem .75rem; box-shadow: 0 2px 6px rgba(15, 23, 42, .06); cursor: pointer; user-select: none;
  transition: transform .12s, box-shadow .12s, opacity .12s;
}
.ag-card:hover { box-shadow: 0 6px 16px rgba(15, 23, 42, .12); transform: translateY(-1px); }
.ag-card[draggable="true"] { cursor: grab; }
.ag-card.arrastando { opacity: .45; }
.ag-card-topo { display: flex; justify-content: space-between; align-items: center; margin-bottom: .25rem; }
.ag-hora { font-weight: 800; font-size: 1rem; }
.ag-data { font-size: .75rem; color: var(--bs-secondary-color); }
.ag-card-cliente { font-weight: 700; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-card-linha { font-size: .78rem; color: var(--bs-secondary-color); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: .15rem; }
.ag-card-linha i { margin-right: .2rem; }
.ag-coluna[data-status="cancelada"] .ag-card { opacity: .7; }
.ag-coluna[data-status="cancelada"] .ag-card-cliente { text-decoration: line-through; }

/* Menu do botão direito */
.ag-menu {
  position: fixed; z-index: 1080; min-width: 200px; padding: .4rem; border-radius: .8rem;
  background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); box-shadow: 0 16px 36px rgba(15, 23, 42, .22);
}
.ag-menu[hidden] { display: none; }
.ag-menu-titulo { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--bs-secondary-color); padding: .35rem .6rem; }
.ag-menu-item { display: block; width: 100%; text-align: left; border: 0; background: transparent; color: var(--bs-body-color); padding: .45rem .6rem; border-radius: .5rem; font-size: .9rem; }
.ag-menu-item:hover { background: var(--bs-tertiary-bg); }
.ag-menu-item.perigo { color: #dc2626; }
.ag-menu-separador { height: 1px; background: var(--bs-border-color); margin: .3rem .2rem; }

/* Calendário do mês: grade de quadradinhos, com as visitas dentro de cada dia */
.ag-cal-scroll { overflow-x: auto; }
.ag-cal { min-width: 760px; }
.ag-cal-semana, .ag-cal-linha { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.ag-cal-semana { margin-bottom: 6px; }
.ag-cal-semana > div { text-align: center; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--bs-secondary-color); }
.ag-cal-linha { margin-bottom: 6px; }
.ag-dia {
  min-height: 118px; min-width: 0; display: flex; flex-direction: column; padding: .4rem;
  border-radius: 12px; border: 1px solid var(--bs-border-color); background: var(--bs-card-bg);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .05); overflow: hidden; transition: border-color .12s, box-shadow .12s;
}
.ag-dia:hover { border-color: color-mix(in srgb, var(--bs-primary) 45%, var(--bs-border-color)); box-shadow: 0 4px 12px rgba(15, 23, 42, .08); }
.ag-dia.outro-mes { background: var(--bs-tertiary-bg); }
.ag-dia.outro-mes .ag-dia-numero { color: var(--bs-secondary-color); }
.ag-dia.selecionado { border-color: var(--bs-primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--bs-primary) 35%, transparent); }
.ag-dia-topo { display: flex; justify-content: space-between; align-items: center; margin-bottom: .3rem; }
.ag-dia-numero {
  display: inline-flex; width: 26px; height: 26px; align-items: center; justify-content: center;
  border-radius: 50%; font-size: .82rem; font-weight: 700; color: var(--bs-body-color); text-decoration: none;
}
a.ag-dia-numero:hover { background: var(--bs-tertiary-bg); color: var(--bs-body-color); }
.ag-dia.hoje .ag-dia-numero { background: var(--bs-primary); color: #fff; }
.ag-dia-mais { color: var(--bs-secondary-color); opacity: 0; font-size: .85rem; line-height: 1; transition: opacity .12s; }
.ag-dia:hover .ag-dia-mais { opacity: .8; }
.ag-dia-mais:hover { color: var(--bs-primary); opacity: 1; }
.ag-dia-eventos { display: flex; flex-direction: column; gap: 3px; min-height: 0; overflow: hidden; }
.ag-evento {
  display: block; width: 100%; text-align: left; border: 0; border-left: 3px solid var(--tipo, #64748b);
  background: color-mix(in srgb, var(--tipo, #64748b) 14%, transparent); color: var(--bs-body-color);
  border-radius: 6px; padding: 3px 6px; font-size: .7rem; line-height: 1.25; cursor: pointer; overflow: hidden;
  white-space: nowrap; text-overflow: ellipsis;
}
.ag-evento:hover { background: color-mix(in srgb, var(--tipo, #64748b) 26%, transparent); }
.ag-evento-hora { font-weight: 800; margin-right: 4px; }
.ag-evento-nome { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: inline-block; max-width: 100%; vertical-align: bottom; }
.ag-evento.cancelada { text-decoration: line-through; }
.ag-evento.remarcada { border-style: dashed; border-left-style: solid; }
.ag-evento-mais { font-size: .68rem; font-weight: 600; color: var(--bs-primary); text-decoration: none; padding-left: 4px; }
.ag-evento-mais:hover { text-decoration: underline; }

/* Modal com as informações da visita */
.ag-modal { border-radius: 1.1rem; overflow: hidden; }
.ag-modal-icone {
  width: 52px; height: 52px; border-radius: 14px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.4rem; color: var(--tipo, #2563eb); background: color-mix(in srgb, var(--tipo, #2563eb) 14%, transparent);
}
.ag-info { height: 100%; padding: .75rem .9rem; border-radius: 12px; background: var(--bs-tertiary-bg); }
.ag-info span { display: block; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--bs-secondary-color); }
.ag-info strong, .ag-info p { display: block; margin-top: .2rem; font-size: .95rem; color: var(--bs-body-color); word-break: break-word; }
.ag-info p { font-weight: 400; white-space: pre-line; }
@media (max-width: 991.98px) {
  .agenda-kanban { grid-template-columns: repeat(4, minmax(200px, 1fr)); }
}
.resumo-gasto .resumo-linha { display: flex; justify-content: space-between; padding: .55rem 0; border-bottom: 1px dashed var(--border); font-size: .92rem; }
.resumo-total { display: flex; justify-content: space-between; align-items: center; margin-top: 1rem; padding-top: 1rem; border-top: 2px solid var(--border); }
.resumo-total strong { font-size: 1.5rem; font-weight: 800; color: #e11d48; }
.materiais-cabecalho { display: grid; grid-template-columns: 1fr 200px 44px; gap: .75rem; font-size: .75rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 0 .25rem; }
.material-linha { display: grid; grid-template-columns: 1fr 200px 44px; gap: .75rem; align-items: center; margin-bottom: .6rem; }
.material-linha .material-remover { grid-column: 3; grid-row: 1; }
.material-linha .material-anexo { grid-column: 1 / 3; grid-row: 2; min-width: 0; }
.material-anexo .form-control { width: 100%; }
@media (max-width: 575.98px) {
  .material-linha { grid-template-columns: 1fr; }
  .material-linha .material-remover { justify-self: end; grid-column: auto; grid-row: auto; }
  .material-linha .material-anexo { grid-column: auto; grid-row: auto; }
}
/* Visualizador de PDF em janela */
.pdf-modal { border-radius: 1.1rem; overflow: hidden; }
.pdf-frame { display: block; width: 100%; height: 78vh; border: 0; background: var(--bs-tertiary-bg); }
@media (max-width: 575.98px) { .pdf-frame { height: 70vh; } }

/* Celular: listas em cartões e botões com área de toque maior */
@media (max-width: 767.98px) {
  .card .table-responsive > table thead { display: none; }
  .card .table-responsive > table,
  .card .table-responsive > table tbody { display: block; width: 100%; }
  .card .table-responsive > table tbody tr {
    display: block; margin: .6rem; padding: .35rem .85rem; border: 1px solid var(--bs-border-color);
    border-radius: 14px; background: var(--bs-card-bg); box-shadow: 0 1px 3px rgba(15, 23, 42, .06);
  }
  .card .table-responsive > table tbody td {
    display: flex; justify-content: space-between; align-items: center; gap: .75rem;
    border: 0; padding: .4rem 0; text-align: right; background: transparent !important; word-break: break-word;
  }
  .card .table-responsive > table tbody td[data-label]::before {
    content: attr(data-label) ":"; flex-shrink: 0; text-align: left; font-size: .7rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .05em; color: var(--bs-secondary-color);
  }
  .card .table-responsive > table tbody td[data-label="Ações"],
  .card .table-responsive > table tbody td[data-label="Ações"] > * { flex-wrap: wrap; }
  .card .table-responsive > table tbody td[data-label="Ações"] { justify-content: flex-end; flex-wrap: wrap; }
  .card .table-responsive > table tbody td:not([data-label]) { justify-content: center; text-align: center; }
  .card .table-responsive > table tbody td.ps-4 { padding-left: 0 !important; }
  .card .table-responsive > table tbody td.pe-4 { padding-right: 0 !important; }
  .btn-sm { min-height: 38px; padding: .4rem .75rem; }
  .card .table-responsive > table tbody td .btn-sm + .btn-sm,
  .card .table-responsive > table tbody td form + .btn-sm { margin-left: .3rem; }
}
/* Celular: células com mais de uma linha (nome + CPF, por exemplo) usam a largura que sobrar */
@media (max-width: 767.98px) {
  .card .table-responsive > table tbody td > div { flex: 1 1 auto; min-width: 0; text-align: right; overflow-wrap: anywhere; }
  .card .table-responsive > table tbody td .text-nowrap { white-space: normal !important; }
  .card .table-responsive > table tbody td > span:not(.badge):not(.status-pill) { min-width: 0; overflow-wrap: anywhere; }
}
/* Celular: célula com várias linhas empilha os valores; o nome da coluna fica em cima */
@media (max-width: 767.98px) {
  .card .table-responsive > table tbody td:has(> div + div) { flex-direction: column; align-items: flex-end; }
  .card .table-responsive > table tbody td:has(> div + div)[data-label]::before { align-self: flex-start; }
}
/* Rótulos com dois-pontos e campos separados: o nome da informação nunca fica colado no valor */
.detalhe-secao { margin-bottom: 1.1rem; }
.detalhe-secao-titulo { font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--bs-secondary-color); margin: 0 0 .55rem; }
.detalhe-grade { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .6rem; }
.detalhe-campo { background: var(--bs-tertiary-bg); border-radius: 12px; padding: .65rem .85rem; min-width: 0; }
.detalhe-campo span { display: block; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--bs-secondary-color); }
.detalhe-campo span::after { content: ":"; }
.detalhe-campo strong { display: block; margin-top: .15rem; font-weight: 600; color: var(--bs-body-color); word-break: break-word; }
.ag-info span::after { content: ":"; }

/* ==========================================================
   CONTRASTE DE TEXTO (WCAG 2.1 AA, mínimo 4,5:1)
   Tons de texto mais escuros no tema claro e mais claros no escuro.
   ========================================================== */
.texto-laranja { color: #b45309; font-weight: 600; }
[data-bs-theme="dark"] .texto-laranja { color: #fbbf24; }
[data-bs-theme="dark"] .text-success { color: #4ade80 !important; }
[data-bs-theme="dark"] .text-danger { color: #f87171 !important; }
[data-bs-theme="dark"] .text-primary { color: #60a5fa !important; }
[data-bs-theme="dark"] .text-warning { color: #fbbf24 !important; }
[data-bs-theme="dark"] .cor-gastos-texto { color: #fb7185; }

/* Foto no topo do modal de detalhes (estoque e demais): tamanho fixo, o nome fica ao lado */
.detalhe-foto { width: 84px; height: 84px; flex: 0 0 84px; object-fit: cover; border-radius: 14px; border: 1px solid var(--border); }
@media (max-width: 575.98px) { .detalhe-foto { width: 64px; height: 64px; flex-basis: 64px; } }

/* Dois cartões lado a lado (alertas dos inquilinos), com o mesmo visual dos módulos */
.kanban-duplo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
@media (max-width: 575.98px) { .kanban-duplo { grid-template-columns: 1fr; } }

/* Módulos do painel compactos: cabem lado a lado (ex.: os 5 módulos numa linha) */
.dash-kanban .kanban-col { padding: .6rem; gap: .5rem; border-radius: 12px; }
.dash-kanban .kanban-head { gap: .45rem; }
.dash-kanban .kanban-head .quick-icon { width: 30px; height: 30px; font-size: .95rem; border-radius: 8px; }
.dash-kanban .kanban-head h3 { font-size: .85rem !important; line-height: 1.2; }
.dash-kanban .kanban-card .card-body { padding: .6rem .7rem; }
.dash-kanban .kanban-card .modulo-numero { font-size: 1.2rem; }
.dash-kanban .kanban-card p { font-size: .75rem; margin-bottom: .4rem !important; line-height: 1.3; }
.dash-kanban .kanban-abrir { font-size: .75rem; }

/* Tabelas com ações: os botões quebram linha em vez de criar rolagem lateral */
.acoes-celula { white-space: normal; }
.acoes-celula .btn { white-space: nowrap; margin: .15rem .1rem; }
.acoes-celula form { display: inline-block; }

/* Ações da lista em uma linha só, com botões de ícone do mesmo tamanho */
.acoes-linha { display: flex; flex-wrap: nowrap; justify-content: flex-end; align-items: center; gap: .3rem; }
.acoes-linha .btn { width: 34px; height: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; }
.acoes-linha form { margin: 0; }

/* Linha das etiquetas do inquilino: altura fixa, para as linhas da lista ficarem iguais */
.linha-selos { height: 24px; min-width: 0; }
.linha-selos .badge { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

/* Sininho de notificações */
.sino-avisos .sino-contador { position: absolute; top: -6px; right: -6px; font-size: .65rem; min-width: 1.25rem; }
.sino-painel { width: 360px; max-width: 92vw; }
.sino-lista { max-height: 380px; overflow-y: auto; }
.sino-item { display: block; padding: .65rem .9rem; border-bottom: 1px solid var(--border); color: inherit; text-decoration: none; }
.sino-item:hover { background: var(--brand-soft); color: inherit; }
.sino-item.nao-lida { background: color-mix(in srgb, var(--brand) 10%, transparent); }
.sino-item .sino-titulo { font-weight: 600; display: block; }
.sino-item .sino-texto { font-size: .85rem; color: var(--muted); display: block; overflow-wrap: anywhere; }
.sino-item .sino-quando { font-size: .75rem; color: var(--muted); }

/* Chat flutuante (canto inferior direito) */
.chat-botao { position: fixed; right: 20px; bottom: 20px; z-index: 1050; width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--brand); color: #fff; font-size: 1.4rem; box-shadow: 0 10px 24px rgba(37,99,235,.35); display: inline-flex; align-items: center; justify-content: center; }
.chat-botao:hover { background: var(--brand-dark); color: #fff; }
/* Menu lateral (celular) acima do botão do chat: o botão Sair não fica escondido atrás da bolinha */
.app-sidebar.offcanvas-lg, .app-sidebar.offcanvas { z-index: 1055; }
.chat-contador { position: absolute; top: -4px; right: -4px; font-size: .65rem; }
.chat-painel { position: fixed; right: 20px; bottom: 90px; z-index: 1050; width: 340px; max-width: calc(100vw - 24px); height: 480px; max-height: calc(100vh - 120px); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; display: flex; flex-direction: column; overflow: hidden; }
.chat-cabecalho { display: flex; align-items: center; gap: .5rem; padding: .7rem .9rem; border-bottom: 1px solid var(--border); }
.chat-cabecalho strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-lista { flex: 1; min-height: 0; overflow-y: auto; }
.chat-item { display: flex; justify-content: space-between; align-items: center; gap: .5rem; width: 100%; padding: .6rem .9rem; border: 0; border-bottom: 1px solid var(--border); background: transparent; color: var(--text); text-align: left; }
.chat-item:hover { background: var(--brand-soft); }
.chat-item .chat-item-nome { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-conversa { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat-mensagens { flex: 1; min-height: 0; overflow-y: auto; padding: .7rem; display: flex; flex-direction: column; gap: .4rem; }
.chat-msg { max-width: 82%; padding: .45rem .65rem; border-radius: 12px; background: var(--bs-tertiary-bg); color: var(--text); align-self: flex-start; overflow-wrap: anywhere; }
.chat-msg.minha { align-self: flex-end; background: var(--brand); color: #fff; }
.chat-msg .chat-msg-meta { display: block; font-size: .7rem; opacity: .8; }
.chat-emotes { display: grid; grid-template-columns: repeat(9, 1fr); gap: .15rem; padding: .4rem; border-top: 1px solid var(--border); }
.chat-emotes button { border: 0; background: transparent; font-size: 1.15rem; line-height: 1; padding: .2rem; border-radius: 6px; }
.chat-emotes button:hover { background: var(--brand-soft); }
.chat-envio { display: flex; gap: .4rem; padding: .6rem; border-top: 1px solid var(--border); }
.chat-envio .form-control { min-width: 0; }
@media (max-width: 575.98px) { .chat-painel { right: 12px; bottom: 84px; width: calc(100vw - 24px); } .chat-botao { right: 14px; bottom: 14px; } }
.chat-secao { padding: .5rem .9rem .2rem; font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
/* Status de presença no chat: online (verde), ausente (laranja), offline (cinza com X) */
.chat-item { gap: .6rem; }
.chat-item .chat-item-nome { flex: 1; text-align: left; }
.chat-status { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 14px; height: 14px; border-radius: 50%; }
.chat-status-online { background: #16a34a; box-shadow: 0 0 0 2px rgba(22,163,74,.2); }
.chat-status-ausente { background: #f59e0b; box-shadow: 0 0 0 2px rgba(245,158,11,.2); }
.chat-status-offline { background: #94a3b8; color: #fff; font-size: .55rem; font-weight: 800; line-height: 1; }
.chat-status-offline .bi { line-height: 1; }
.usuario-foto-form { width: 76px; height: 76px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); flex-shrink: 0; }
.chat-avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; flex-shrink: 0; border: 1px solid var(--border); }

/* ==========================================================
   TELA DE DESCANSO (animação depois de um tempo parado)
   ========================================================== */
.tela-descanso { position: fixed; inset: 0; z-index: 2000; background: #030712; overflow: hidden; cursor: none; }
.tela-descanso[hidden] { display: none !important; }
.tela-descanso canvas { display: block; width: 100%; height: 100%; }
body.descanso-ativo { overflow: hidden; }

/* Cadastros longos (clientes e inquilinos): o formulário ocupa a altura do modal e só o corpo rola.
   O <form> envolve cabeçalho, corpo e rodapé; sem ser flex, o corpo não tinha altura limitada e não rolava. */
#modalPessoa .modal-dialog { max-height: calc(100vh - 2rem); }
#modalPessoa .modal-content { display: flex; flex-direction: column; min-height: 0; max-height: calc(100vh - 2rem); overflow: hidden; }
#modalPessoa form { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
#modalPessoa .modal-header, #modalPessoa .modal-footer { flex: 0 0 auto; }
#modalPessoa .modal-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* Campos de texto dos cadastros aparecem em maiúsculas enquanto a pessoa digita (o sistema grava em maiúsculas).
   E-mail, senha, busca, data, hora, cor, arquivo e o chat ficam como estão. */
.form-control:not([type="email"]):not([type="password"]):not([type="search"]):not([type="date"]):not([type="time"]):not([type="month"]):not([type="color"]):not([type="file"]):not(.nao-maiusculas) {
  text-transform: uppercase;
}

/* Cadastros em modal: sem rolagem para o lado (só para baixo) e listas (select) com texto longo cortado com reticências */
#modalPessoa .modal-body { overflow-x: hidden; }
