/* Shell Escudeiro — Vistoria (mobile-first). Complementa app.css. */
:root {
  --brand-primary: #004225;
  --brand-primary-2: #00552e;
  --brand-light: #f4f7f5;
  --brand-border: #d8e6dc;
  --brand-gray: #1f2a24;
  --brand-muted: #68756f;
  --font-jakarta: "Plus Jakarta Sans", "Inter", system-ui, sans-serif;
  --shadow-card: 0 1px 3px rgba(0, 66, 37, 0.08), 0 8px 24px rgba(0, 66, 37, 0.06);
  --esc-nav-h: 64px;
  --esc-top-h: 72px;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: clip;
  max-width: 100%;
}

body.esc-shell {
  font-family: var(--font-jakarta) !important;
  overscroll-behavior-y: none;
  overflow-x: clip;
  max-width: 100%;
  padding: 0 !important;
  min-height: 100dvh;
  background: var(--brand-light) !important;
}

body.esc-shell::before { opacity: .02; }

button, a, input, select, textarea {
  touch-action: manipulation;
}

/* ---- Topbar compacta ---- */
.esc-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: 0 1px 0 var(--brand-border) !important;
  background: rgba(255,255,255,.96) !important;
  backdrop-filter: blur(8px);
  padding-top: env(safe-area-inset-top, 0px) !important;
}

.esc-topbar-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--esc-top-h);
  padding: 8px 12px;
  max-width: 720px;
  margin: 0 auto;
}

.esc-back,
.esc-back-spacer {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  flex-shrink: 0;
  text-decoration: none !important;
  color: var(--brand-primary) !important;
  font-size: 1.25rem;
  font-weight: 700;
}

.esc-back { background: var(--brand-light); border: 1px solid var(--brand-border); }
.esc-back:active { background: #e5efe9; }

.esc-topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.esc-logo {
  flex: 0 0 auto;
  width: 48px !important;
  height: 48px !important;
  object-fit: contain;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--brand-border);
  padding: 3px;
}

.esc-topbar-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.esc-topbar-brand-name {
  font-size: 0.84rem;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--brand-primary);
  white-space: nowrap;
}

.esc-topbar-title {
  font-size: 0.95rem;
  line-height: 1.2;
  color: var(--brand-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.esc-topbar-sub {
  font-size: 0.72rem;
  color: var(--brand-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.esc-topbar-logout {
  font-size: 0.8rem !important;
  font-weight: 700 !important;
  color: var(--brand-primary) !important;
  text-decoration: none !important;
  padding: 8px 10px;
  border-radius: 10px;
  flex-shrink: 0;
}

/* Larger brand mark on desktop; bottom navigation keeps its own height. */
@media (min-width: 768px) {
  :root { --esc-top-h: 84px; }

  .esc-topbar-inner {
    gap: 14px;
    padding: 10px 20px;
  }

  .esc-logo {
    width: 60px !important;
    height: 60px !important;
    border-radius: 12px;
    padding: 4px;
  }

  .esc-topbar-brand-name { font-size: 1rem; }
  .esc-topbar-title { font-size: 1.05rem; }
}

/* ---- Main ---- */
.esc-main {
  max-width: 720px !important;
  margin: 0 auto !important;
  padding: 14px 14px 24px !important;
  width: 100%;
}

html.esc-app .esc-main {
  padding-bottom: calc(var(--esc-nav-h) + env(safe-area-inset-bottom, 0px) + 18px) !important;
}

html.esc-app body.esc-shell:not(.app-login) > * {
  max-width: none;
  margin-left: 0;
  margin-right: 0;
}

html.esc-app .esc-topbar,
html.esc-app .esc-main,
html.esc-app .esc-footer,
html.esc-app .esc-bottom-nav {
  max-width: 100%;
}

.esc-footer {
  display: none;
  text-align: center;
  color: var(--brand-muted);
  font-size: 0.75rem;
  padding: 8px 14px 16px;
}

html.esc-pc .esc-footer { display: block; }

/* ---- Bottom nav (phone only) ---- */
html.esc-pc [data-shell="mobile-nav"] { display: none !important; }
html.esc-app [data-shell="sidebar"] { display: none !important; }

.esc-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  min-height: var(--esc-nav-h);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
  background: rgba(255,255,255,.97);
  border-top: 1px solid var(--brand-border);
  box-shadow: 0 -8px 24px rgba(0,66,37,.06);
}

.esc-nav-item {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 48px;
  border-radius: 12px;
  text-decoration: none !important;
  color: var(--brand-muted) !important;
  font-weight: 600 !important;
  font-size: 0.68rem;
}

.esc-nav-item.is-active {
  color: var(--brand-primary) !important;
  background: var(--brand-light);
}

.esc-nav-ico {
  font-size: 1rem;
  font-weight: 800;
  line-height: 1;
}

/* ---- Components ---- */
.field {
  width: 100%;
  min-height: 2.75rem;
  border-radius: 12px;
  border: 1px solid var(--brand-border);
  padding: 0.625rem 0.75rem;
  font-size: 1rem;
  background: #fff;
  color: var(--brand-gray);
}

.btn-primary,
.btn-secondary,
a.btn-primary,
a.btn-secondary,
button.btn-primary,
button.btn-secondary {
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border-radius: 12px;
  padding: 0.75rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none !important;
  cursor: pointer;
  border: 0;
}

.btn-primary, button.btn-primary, a.btn-primary {
  background: var(--brand-primary) !important;
  color: #fff !important;
  box-shadow: var(--shadow-card);
}

.btn-primary:hover { background: var(--brand-primary-2) !important; }

.btn-secondary, button.btn-secondary, a.btn-secondary {
  background: #fff !important;
  color: var(--brand-gray) !important;
  border: 1px solid var(--brand-border) !important;
}

.btn-secondary:hover { background: #f8faf9 !important; }

.btn-block, html.esc-app .btn-primary, html.esc-app .btn-secondary,
html.esc-app .esc-main form > button[type="submit"],
html.esc-app .esc-main .form-buttons > button,
html.esc-app .esc-main .form-buttons > a {
  width: 100%;
}

.card, .esc-card {
  border-radius: 16px;
  border: 1px solid var(--brand-border);
  background: #fff;
  padding: 0.9rem;
  box-shadow: var(--shadow-card);
  margin-bottom: 12px;
}

.esc-step {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 0 0 14px;
}

.esc-step span {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--brand-border);
  color: var(--brand-muted);
}

.esc-step span.is-on {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
}

.esc-msg, .msg-success, .sucesso, .ok, .mensagem {
  border-radius: 12px;
  padding: 12px 14px;
  margin: 0 0 12px;
  font-weight: 600;
  background: #eaf5ee;
  border: 1px solid #b7d8c3;
  color: var(--brand-primary);
}

.esc-msg.is-error, .error {
  background: #fdeeee;
  border-color: #e8b4b4;
  color: #8b0000;
}

.esc-save-toast {
  position: sticky;
  top: calc(var(--esc-top-h) + env(safe-area-inset-top, 0px) + 4px);
  z-index: 35;
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.85rem;
  text-align: center;
  background: #fff8e6;
  border: 1px solid #f0d78c;
  color: #9a6500;
}

.esc-save-toast.is-saving { display: block; }
.esc-save-toast.is-ok {
  display: block;
  background: #eaf5ee;
  border-color: #b7d8c3;
  color: var(--brand-primary);
}
.esc-save-toast.is-err {
  display: block;
  background: #fdeeee;
  border-color: #e8b4b4;
  color: #8b0000;
}

/* Room / property list cards (mobile) */
.esc-list { display: flex; flex-direction: column; gap: 10px; margin: 0 0 16px; }

.esc-list-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--brand-border);
  background: #fff;
  box-shadow: var(--shadow-card);
}

.esc-list-item h3 {
  margin: 0;
  font-size: 1rem;
}

.esc-list-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

html.esc-pc .esc-list-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.esc-chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.esc-chip {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--brand-light);
  color: var(--brand-primary);
  border: 1px solid var(--brand-border);
}

.esc-chip.warn { background: #fff8e6; color: #9a6500; border-color: #f0d78c; }

/* Estado radios touch-friendly */
.esc-estado-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 8px 0 12px;
}

.esc-estado-grid label {
  display: flex !important;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--brand-border);
  background: #fff;
  margin: 0 !important;
  font-weight: 600;
}

.esc-estado-grid input { width: 18px; height: 18px; }

/* Photo UX */
.photo-zone {
  border: 1.5px dashed var(--brand-border);
  border-radius: 16px;
  padding: 14px;
  background: #fafcfb;
  margin: 8px 0 12px;
}

.photo-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.photo-preview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.photo-preview-grid img,
.photo-preview-grid .ph {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--brand-border);
  background: #eee;
}

.fotos-row {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

html.esc-pc .fotos-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.foto-card {
  border-radius: 14px;
  border: 1px solid var(--brand-border);
  background: #fff;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.foto-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 10px;
}

.stack-gap > * + * { margin-top: 12px; }

.esc-section-title {
  margin: 4px 0 10px;
  font-size: 1.05rem;
  color: var(--brand-primary);
}

.esc-hint {
  font-size: 0.8rem;
  color: var(--brand-muted);
  margin: 0 0 10px;
}

/* Hide dense admin tables on phone list pages — cards preferred */
html.esc-app .esc-hide-mobile { display: none !important; }
html.esc-pc .esc-hide-pc { display: none !important; }

/* Painel denser on PC */
html.esc-pc body.app-painel .esc-main {
  max-width: 1180px !important;
  padding: 20px !important;
}

html.esc-app,
html.esc-app body {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  overflow-x: clip !important;
}

/* Checklist compact */
.checklist .feito, .checklist .aviso {
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 6px;
}

/* Inline edit forms on mobile stack */
html.esc-app .item-edit-form,
html.esc-app .foto-edit,
html.esc-app .acoes-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

html.esc-app .item-edit-form input,
html.esc-app .item-edit-form select,
html.esc-app .foto-edit input,
html.esc-app .foto-edit select {
  width: 100%;
  min-height: 44px;
}

label { font-weight: 700; color: var(--brand-gray); display: block; margin: 8px 0 4px; }

.form-buttons { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
/* === Fase3 PWA: install invite + offline badge === */
.vp-install-invite {
  display: block;
  background: #eaf5ee;
  border-bottom: 1px solid #b7d8c3;
  padding: 10px 12px;
  position: sticky;
  top: calc(var(--esc-top-h, 56px) + env(safe-area-inset-top, 0px));
  z-index: 40;
}

html.esc-pc .vp-install-invite { display: none !important; }
.vp-install-invite[hidden] { display: none !important; }
.vp-install-invite-inner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 720px;
  margin: 0 auto;
}
.vp-install-ico { font-size: 1.1rem; line-height: 1.4; }
.vp-install-body { flex: 1; min-width: 0; }
.vp-install-title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: #004225;
}
.vp-install-hint {
  margin: 4px 0 0;
  font-size: 0.72rem;
  line-height: 1.35;
  color: #3d5c4a;
}
.vp-install-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.vp-install-actions .btn-primary,
.vp-install-actions .btn-secondary {
  min-height: 44px;
  padding: 8px 14px;
  font-size: 0.8rem;
}
.vp-install-close {
  border: 0;
  background: transparent;
  min-width: 44px;
  min-height: 44px;
  font-size: 1.4rem;
  line-height: 1;
  color: #3d5c4a;
  cursor: pointer;
  border-radius: 10px;
}
.vp-offline-badge {
  margin: 0 0 10px;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
  background: #fff8e6;
  border: 1px solid #f0d78c;
  color: #9a6500;
}
.vp-offline-badge[hidden] { display: none !important; }
.vp-pending-offline {
  border-style: dashed !important;
  border-color: #f0d78c !important;
  background: #fffdf5 !important;
}


/* === Login brand refresh 20260929 === */
body.app-login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100svh;
  padding: clamp(18px, 4vw, 48px) !important;
  background: radial-gradient(circle at 50% 0%, rgba(0,66,37,.12), transparent 42%), linear-gradient(145deg, #eef7f1 0%, #f8fbf9 55%, #eaf3ed 100%) !important;
  overflow-x: hidden;
}
body.app-login::before { opacity: .025; background-position: center; background-size: min(620px, 88vw) auto; }
body.app-login > .login-card {
  width: min(460px, 100%) !important;
  margin: 0 !important;
  padding: clamp(24px, 5vw, 40px) !important;
  border: 1px solid rgba(0,66,37,.14) !important;
  border-radius: 24px !important;
  box-shadow: 0 24px 70px rgba(0,66,37,.14), 0 4px 14px rgba(0,66,37,.06) !important;
}
.login-brand { display: flex; justify-content: center; align-items: center; min-height: 112px; margin: -4px auto 8px; }
.login-logo { display: block; width: min(300px, 86%); max-height: 132px; object-fit: contain; }
body.app-login .login-card h2 { margin: 8px 0 22px; color: var(--verde) !important; font-size: clamp(24px, 5vw, 30px); line-height: 1.1; text-align: center; }
body.app-login .login-card .field { min-height: 48px; margin-bottom: 12px !important; border-radius: 12px; background: #fbfdfc; }
body.app-login .login-card .btn-primary { min-height: 48px; margin-top: 2px; border-radius: 12px; font-size: .98rem; }
body.app-login .login-sep { margin: 26px 0 18px; border-top-color: rgba(0,66,37,.14); }
body.app-login .recover-title { display: block; margin: 0 0 8px; color: var(--texto); font-size: .9rem; letter-spacing: .01em; }
body.app-login .recover-row { align-items: stretch; gap: 10px; margin-top: 0; }
body.app-login .recover-row .field { min-width: 0; }
body.app-login .recover-row .btn-secondary { min-height: 48px; border-radius: 12px; padding-inline: 18px; }
body.app-login .login-hint:not(.recover-title) { margin: 10px 0 0; line-height: 1.5; }
@media (max-width: 460px) {
  body.app-login { padding: 16px !important; }
  body.app-login > .login-card { padding: 24px 20px !important; }
  body.app-login .recover-row { flex-direction: column; }
  body.app-login .recover-row .btn-secondary { width: 100%; }
}

/* === PWA/standalone login visibility fix 20260929f6 === */
html.esc-app.esc-login,
html.esc-app body.app-login,
html.esc-app body.app-login.esc-shell {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 100svh !important;
  min-height: 100dvh !important;
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  padding: clamp(18px, 4vw, 48px) !important;
  padding-top: calc(clamp(18px, 4vw, 48px) + env(safe-area-inset-top, 0px)) !important;
  padding-bottom: calc(clamp(18px, 4vw, 48px) + env(safe-area-inset-bottom, 0px)) !important;
}

html.esc-app body.app-login > .login-card,
html.esc-app body.app-login > main.login-card,
body.app-login > .login-card {
  position: relative !important;
  z-index: 20 !important;
  opacity: 1 !important;
  visibility: visible !important;
  display: block !important;
  transform: none !important;
  width: min(460px, 100%) !important;
  max-width: 460px !important;
  margin: 0 auto !important;
  pointer-events: auto !important;
}

body.app-login::before {
  z-index: 0 !important;
  opacity: .025 !important;
}

@media (display-mode: standalone), (display-mode: fullscreen) {
  html.esc-app body.app-login,
  body.app-login.esc-shell {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 100svh !important;
    min-height: 100dvh !important;
  }
  body.app-login > .login-card,
  body.app-login > main.login-card {
    position: relative !important;
    z-index: 20 !important;
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
  }
}

/* Ficha flexível chips */
.vp-flex-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.esc-chip.tip-chip,
.esc-chip.sug-chip {
  cursor: pointer; user-select: none; font: inherit; font-weight: 600;
  min-height: 2.5rem; border-radius: 999px;
}
.esc-chip.tip-chip.is-on { background: #004225; color: #fff; border-color: #004225; }
