/* ZarbCondo — paleta do logo: azul-claro, azul-marinho e laranja */
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/poppins-400-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/poppins-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/poppins-600-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/poppins-600-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/poppins-700-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/poppins-700-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("../fonts/poppins-800-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("../fonts/poppins-800-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
:root,
[data-theme="light"] {
  --bg: #f4f9fc;
  --bg-2: #e7f3fa;
  --sidebar-bg: #ffffff;
  --card: #ffffff;
  --border: #d5e6f2;
  --text: #1a3358;
  --muted: #5c7590;
  --primary-a: #2b9fe0;
  --primary-b: #1e4f9e;
  --accent: #e8940a;
  --danger: #e03131;
  --ok: #2f9e44;
  --warn: #e8940a;
  --link: #1a56b0;
  --radius: 14px;
  --shadow: 0 4px 20px rgba(30, 79, 158, 0.07);
  --sidebar-w: 260px;
  --topbar-h: 64px;
  --font: "Poppins", system-ui, sans-serif;
  --toast-bg: #1a3358;
  --toast-text: #fff;
  --backdrop: rgba(15, 35, 64, 0.35);
  --btn-secondary-bg: #e7f1f8;
  --btn-secondary-text: #1a3358;
  --badge-ok-bg: rgba(47, 158, 68, 0.12);
  --badge-ok-fg: #2b8a3e;
  --badge-warn-bg: rgba(232, 148, 10, 0.14);
  --badge-warn-fg: #c47a08;
  --badge-danger-bg: rgba(224, 49, 49, 0.12);
  --badge-danger-fg: #c92a2a;
  --badge-info-bg: rgba(43, 159, 224, 0.14);
  --badge-info-fg: #1a56b0;
  --proof-bg: rgba(47, 158, 68, 0.12);
  --proof-fg: #2b8a3e;
}

[data-theme="dark"] {
  --bg: #0f1c2e;
  --bg-2: #16263c;
  --sidebar-bg: #122033;
  --card: #17304a;
  --border: #2a4464;
  --text: #e7f2fb;
  --muted: #9bb6d0;
  --primary-a: #3eb4ee;
  --primary-b: #2a6ec4;
  --accent: #f0a83a;
  --link: #7ec8f0;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  --toast-bg: #0c1828;
  --toast-text: #e7f2fb;
  --backdrop: rgba(0, 0, 0, 0.55);
  --btn-secondary-bg: #243e5c;
  --btn-secondary-text: #e7f2fb;
  --badge-ok-bg: rgba(64, 192, 87, 0.2);
  --badge-ok-fg: #8ce99a;
  --badge-warn-bg: rgba(240, 168, 58, 0.18);
  --badge-warn-fg: #ffd43b;
  --badge-danger-bg: rgba(250, 82, 82, 0.18);
  --badge-danger-fg: #ffa8a8;
  --badge-info-bg: rgba(62, 180, 238, 0.2);
  --badge-info-fg: #9ad7f8;
  --proof-bg: rgba(64, 192, 87, 0.2);
  --proof-fg: #8ce99a;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea, optgroup {
  font-family: inherit;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* —— Shell —— */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  height: 100dvh;
  max-height: 100dvh;
  padding-top: env(safe-area-inset-top);
  z-index: 60;
  transition: transform .25s ease;
}
.sidebar-brand {
  padding: .85rem 1rem 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.sidebar-brand:hover { text-decoration: none; }
.brand-logo {
  width: min(168px, 100%);
  height: auto;
  display: block;
  border-radius: 16px;
}
.sidebar-user {
  margin: 20px 0 0;
  padding: 0 1rem .85rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  text-align: center;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  word-break: break-word;
}
.sidebar-user strong { font-weight: 800; }
.sidebar-user-icon { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: .75rem .65rem 1rem;
}
.sidebar-logout {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: .65rem;
  margin-top: auto;
  padding: .85rem 1.5rem calc(.85rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  color: var(--danger);
  font-weight: 700;
  text-decoration: none;
  min-height: 48px;
}
.sidebar-logout .nav-icon { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-logout:hover {
  background: rgba(224, 49, 49, .08);
  text-decoration: none;
  color: var(--danger);
}
.nav-section {
  margin: .85rem 0 .35rem;
  padding: 0 .65rem;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .7rem .85rem;
  border-radius: 10px;
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
  min-height: 44px;
}
.sidebar-nav .nav-icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  opacity: .9;
}
.sidebar-nav a:hover {
  background: var(--bg-2);
  color: var(--text);
  text-decoration: none;
}
.sidebar-nav a.active {
  background: linear-gradient(135deg, rgba(43, 159, 224, 0.16), rgba(30, 79, 158, 0.1));
  color: var(--text);
}

.shell-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: var(--topbar-h);
  height: auto;
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: calc(.45rem + env(safe-area-inset-top)) 1rem .45rem;
}
.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: .65rem;
  flex-wrap: wrap;
  min-width: 0;
}
.topbar-left { flex: 1 1 auto; }
.topbar-right { flex: 0 1 auto; justify-content: flex-end; }
.topbar-title {
  margin: 0;
  min-width: 0;
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1.2;
  color: var(--text);
}
.menu-toggle {
  display: none;
  background: var(--btn-secondary-bg);
  color: var(--btn-secondary-text);
  border: 0;
  border-radius: 10px;
  min-height: 44px;
  min-width: 44px;
  font-weight: 700;
  cursor: pointer;
}
body.sidebar-open { overflow: hidden; }
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--backdrop);
  z-index: 55;
}
body.sidebar-open .sidebar-overlay { display: block; }

.predio-form { position: relative; display: flex; align-items: center; margin: 0; }
.predio-trigger {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: var(--primary-b);
  color: #fff;
  border: 0;
  outline: none;
  box-shadow: none;
  border-radius: 999px;
  padding: .45rem .9rem;
  min-height: 42px;
  font-weight: 700;
  font-size: .85rem;
  line-height: 1;
  cursor: pointer;
  appearance: none;
}
.predio-trigger:hover,
.predio-trigger:focus,
.predio-trigger:focus-visible,
.predio-trigger[aria-expanded="true"] {
  background: var(--primary-b);
  color: #fff;
  border: 0;
  outline: none;
  box-shadow: none;
}
.predio-trigger .icon,
.predio-trigger [data-lucide] { color: #fff; width: 16px; height: 16px; }
.predio-menu {
  position: absolute;
  top: calc(100% + .4rem);
  right: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: .15rem;
  min-width: 220px;
  max-width: min(320px, 80vw);
  margin: 0;
  padding: .35rem;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.predio-menu[hidden] { display: none; }
.predio-option {
  display: block;
  width: 100%;
  margin: 0;
  padding: .65rem .8rem;
  border: 0;
  outline: none;
  box-shadow: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-weight: 600;
  font-size: .9rem;
  text-align: left;
  cursor: pointer;
}
.predio-option:hover,
.predio-option:focus,
.predio-option:focus-visible {
  background: var(--bg-2);
  color: var(--text);
  outline: none;
  box-shadow: none;
}
.predio-option.is-selected,
.predio-option.is-selected:hover,
.predio-option.is-selected:focus,
.predio-option.is-selected:focus-visible {
  background: var(--primary-b);
  color: #fff;
  border: 0;
  outline: none;
  box-shadow: none;
}
.fab-novo {
  position: fixed;
  right: 1.25rem;
  bottom: calc(1.25rem + env(safe-area-inset-bottom));
  z-index: 45;
  width: 56px;
  height: 56px;
  min-height: 56px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-a), var(--primary-b));
  color: #fff;
  box-shadow: 0 10px 24px rgba(30, 79, 158, 0.35);
  text-decoration: none;
}
.fab-novo:hover { text-decoration: none; filter: brightness(1.06); }
.fab-novo [data-lucide] { width: 26px; height: 26px; }
body:has(.fab-novo) .toast-host { bottom: calc(5.5rem + env(safe-area-inset-bottom)); }
body:has(.fab-novo) .container { padding-bottom: calc(5.5rem + env(safe-area-inset-bottom)); }
.choice-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: var(--backdrop);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}
.choice-backdrop.open { opacity: 1; pointer-events: auto; }
.choice-panel {
  width: min(420px, 100%);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.25rem;
  box-shadow: var(--shadow);
  transform: scale(.96);
  transition: transform .18s ease;
}
.choice-backdrop.open .choice-panel { transform: scale(1); }
.choice-panel h2 { margin: 0 0 1rem; font-size: 1.15rem; text-align: center; }
.choice-list { display: flex; flex-direction: column; gap: .65rem; }
.choice-option {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  min-height: 52px;
  border-radius: 12px;
  font-weight: 700;
  text-decoration: none;
  background: var(--btn-secondary-bg);
  color: var(--btn-secondary-text);
  border: 1px solid var(--border);
}
.choice-option:first-child {
  background: linear-gradient(135deg, var(--primary-a), var(--primary-b));
  color: #fff;
  border: 0;
}
.choice-option:hover { text-decoration: none; filter: brightness(1.05); }
.choice-option [data-lucide] { width: 20px; height: 20px; }
.theme-toggle {
  background: var(--btn-secondary-bg);
  color: var(--btn-secondary-text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .45rem .9rem;
  min-height: 42px;
  font-weight: 700;
  cursor: pointer;
  font-size: .85rem;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}

.container { width: min(1100px, 100%); margin: 0 auto; padding: 1.25rem 1rem 2.5rem; }
.page-title { margin: 0 0 1rem; font-size: 1.4rem; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}
.grid { display: grid; gap: 1rem; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1024px) {
  .grid-3 { grid-template-columns: 1fr; }
  .menu-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .sidebar { transform: translateX(-105%); }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .shell-main { margin-left: 0; }
  .topbar {
    flex-wrap: nowrap;
    gap: .4rem;
    padding-left: .65rem;
    padding-right: .65rem;
  }
  .topbar-left, .topbar-right { flex-wrap: nowrap; gap: .4rem; }
  .topbar-right { min-width: 0; }
  .topbar-title {
    font-size: 1.05rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .theme-label { display: none; }
  .theme-toggle {
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    justify-content: center;
  }
  .predio-form { min-width: 0; max-width: 9.5rem; }
  .predio-trigger {
    max-width: 100%;
    min-width: 0;
    min-height: 44px;
  }
  .predio-trigger span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .dash-period { flex-shrink: 0; }
  .topbar .dash-period-btn { min-height: 44px; padding: .35rem .5rem; }
}
@media (max-width: 640px) {
  .predio-form { max-width: 6.75rem; }
  .topbar { gap: .3rem; padding-left: .5rem; padding-right: .5rem; }
  .topbar .dash-period-btn { padding: .35rem .4rem; font-size: .75rem; }
}
@media (min-width: 1025px) {
  body.sidebar-open { overflow: auto; }
  body.sidebar-open .sidebar-overlay { display: none; }
}

.stat-value { font-size: 2rem; font-weight: 800; }
.stat-label { color: var(--muted); font-size: .9rem; }

/* Ícones Lucide */
.icon, [data-lucide] {
  width: 1.15em; height: 1.15em;
  stroke-width: 2;
  flex-shrink: 0;
  vertical-align: middle;
}
.icon-sm { width: 16px; height: 16px; }
.muted-icon { color: var(--muted); opacity: .85; }
.user-chip { display: inline-flex; align-items: center; gap: .35rem; }
.theme-toggle .theme-icon-light,
.theme-toggle .theme-icon-dark { width: 16px; height: 16px; }
[data-theme="light"] .theme-toggle .theme-icon-dark { display: none; }
[data-theme="dark"] .theme-toggle .theme-icon-light { display: none; }
.menu-toggle [data-lucide] { width: 20px; height: 20px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  border: 0; border-radius: 12px; padding: .85rem 1.15rem; min-height: 48px;
  font-weight: 700; cursor: pointer; color: #fff; text-decoration: none;
  font-size: 1rem;
}
.btn [data-lucide] { width: 18px; height: 18px; }
.btn-sm [data-lucide] { width: 15px; height: 15px; }
.btn:hover { text-decoration: none; filter: brightness(1.05); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn-primary {
  background: linear-gradient(135deg, var(--primary-a), var(--primary-b));
  box-shadow: 0 8px 20px rgba(30, 79, 158, 0.22);
}
.btn-secondary {
  background: var(--btn-secondary-bg);
  color: var(--btn-secondary-text);
}
.btn-danger { background: var(--danger); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { min-height: 38px; padding: .5rem .8rem; font-size: .9rem; }

.form-group { margin-bottom: 1rem; }
.unidade-picker { position: relative; }
.unidade-search { position: relative; }
.unidade-search-icon {
  position: absolute; left: .85rem; top: 50%; transform: translateY(-50%);
  color: var(--muted); display: flex; pointer-events: none;
}
.unidade-search input[type=search] { padding-left: calc(.85rem + 16px + 9px); }
.unidade-search[hidden],
.unidade-pill[hidden],
.unidade-drop[hidden],
.unidade-quick[hidden] { display: none !important; }
.unidade-drop {
  position: absolute; left: 0; right: 0; top: calc(100% - .25rem); z-index: 40;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 14px 32px rgba(15, 40, 70, .14);
  max-height: 280px; overflow: auto;
}
.unidade-item, .unidade-create {
  width: 100%; display: flex; align-items: center; gap: .65rem;
  padding: .75rem .95rem; background: transparent; border: 0;
  border-bottom: 1px solid var(--border); color: var(--text);
  font: inherit; font-size: .95rem; text-align: left; cursor: pointer;
}
.unidade-item:hover { background: color-mix(in srgb, var(--primary-a) 12%, var(--card)); }
.unidade-item-mark {
  width: 18px; height: 18px; border-radius: 5px; flex-shrink: 0;
  background: color-mix(in srgb, var(--primary-b) 16%, var(--card));
  border: 1px solid color-mix(in srgb, var(--primary-a) 45%, var(--border));
}
.unidade-empty { margin: 0; padding: .85rem .95rem; text-align: center; color: var(--muted); font-size: .9rem; }
.unidade-create {
  justify-content: center; font-weight: 700; color: var(--primary-b);
  background: color-mix(in srgb, var(--primary-a) 14%, var(--card));
  border-bottom: 0;
}
.unidade-create:hover { background: color-mix(in srgb, var(--primary-a) 24%, var(--card)); }
.unidade-pill {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  min-height: 48px; padding: .45rem .65rem .45rem .95rem; border-radius: 12px;
  background: color-mix(in srgb, var(--primary-a) 14%, var(--card));
  border: 1px solid color-mix(in srgb, var(--primary-a) 42%, var(--border));
  color: var(--primary-b); font-weight: 700;
}
.unidade-pill-label { display: inline-flex; align-items: center; gap: .5rem; min-width: 0; }
.unidade-pill-label .icon { color: var(--primary-a); }
.unidade-pill-clear {
  width: 28px; height: 28px; border: 0; border-radius: 999px; flex-shrink: 0;
  background: var(--card); color: var(--primary-b); cursor: pointer;
  font-size: 1.05rem; line-height: 1; box-shadow: 0 1px 3px rgba(15, 40, 70, .12);
}
.unidade-pill-clear:hover { color: var(--danger); }
.unidade-quick {
  position: fixed; inset: 0; z-index: 140;
  display: flex; align-items: center; justify-content: center; padding: 1rem;
  background: rgba(15, 35, 64, .45); backdrop-filter: blur(3px);
}
.unidade-quick-card {
  width: min(420px, 100%); background: var(--card); color: var(--text);
  border: 1px solid var(--border); border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .22); overflow: hidden;
}
.unidade-quick-head {
  display: flex; align-items: center; gap: .55rem;
  padding: .9rem 1.1rem; border-bottom: 1px solid var(--border); background: var(--bg-2);
}
.unidade-quick-head h3 { margin: 0; font-size: 1.05rem; }
.unidade-quick-head .icon { color: var(--primary-a); }
.unidade-quick-body { padding: 1rem 1.1rem .25rem; }
.unidade-quick-body label { margin-top: .35rem; }
.unidade-quick-actions {
  display: flex; justify-content: flex-end; gap: .5rem;
  padding: .85rem 1.1rem 1rem; border-top: 1px solid var(--border); background: var(--bg-2);
}
.form-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 1rem;
}
.form-thirds {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: 1rem;
}
.form-thirds-2 { grid-template-columns: 1fr 1fr; }
.turno-picker { position: relative; }
.turno-trigger {
  width: 100%;
  height: 48px;
  min-height: 48px;
  padding: 0 .95rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  background: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  font: inherit;
  font-size: 1rem;
  text-align: left;
  cursor: pointer;
}
.turno-trigger:hover,
.turno-picker.is-open .turno-trigger { border-color: var(--primary-a); }
.turno-trigger-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.turno-trigger-label.is-placeholder { color: var(--muted); font-weight: 500; }
.turno-chevron {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translateY(-2px);
}
.turno-picker.is-open .turno-chevron { transform: rotate(225deg) translateY(-1px); }
.turno-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + .35rem);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: .1rem;
  margin: 0;
  padding: .35rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(15, 40, 70, .12);
  max-height: min(240px, 46vh);
  overflow-y: auto;
}
.turno-menu.is-up {
  top: auto;
  bottom: calc(100% + .35rem);
}
.turno-menu[hidden] { display: none; }
.turno-check {
  display: flex;
  align-items: center;
  gap: .65rem;
  margin: 0;
  padding: .55rem .7rem;
  border-radius: 10px;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}
.turno-check:hover { background: var(--bg-2); }
.turno-check input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
  accent-color: var(--primary-b);
  cursor: pointer;
}
.turno-check:has(input:checked) {
  background: color-mix(in srgb, var(--primary-a) 14%, transparent);
}
.field-hint { margin: .35rem 0 0; color: var(--muted); font-size: .82rem; }
.usuario-status { min-height: 1.1rem; margin: .35rem 0 0; font-size: .85rem; font-weight: 700; }
.usuario-status.is-hint { color: var(--muted); font-weight: 600; }
.usuario-status.is-ok { color: var(--ok); }
.usuario-status.is-bad { color: var(--danger); }
input.is-valid { border-color: var(--ok); }
input.is-invalid { border-color: var(--danger); }
.form-group.is-disabled > label { color: #8b95a5; }
input[type=text].is-frozen,
input[type=text].is-frozen:disabled {
  background: #e4e7ec;
  color: #7d8796;
  -webkit-text-fill-color: #7d8796;
  border-color: #cfd4dc;
  cursor: not-allowed;
  box-shadow: none;
  opacity: 1;
}
[data-theme="dark"] .form-group.is-disabled > label { color: #8ea0b8; }
[data-theme="dark"] input[type=text].is-frozen,
[data-theme="dark"] input[type=text].is-frozen:disabled {
  background: #243044;
  color: #8ea0b8;
  -webkit-text-fill-color: #8ea0b8;
  border-color: #3a4d66;
}
@media (max-width: 1024px) {
  .form-split,
  .form-thirds,
  .form-thirds-2 { grid-template-columns: 1fr; }
}
label { display: block; margin-bottom: .35rem; color: var(--muted); font-weight: 600; }
input[type=text], input[type=password], input[type=email], input[type=tel],
input[type=search], input[type=date], input[type=file], select, textarea {
  width: 100%; background: var(--bg-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px; padding: .8rem .95rem;
  font-size: 1rem; min-height: 48px;
}
textarea { min-height: 100px; resize: vertical; }
.checkbox-row { display: flex; gap: .5rem; align-items: center; min-height: 44px; }
.checkbox-row input { width: auto; min-height: auto; }
.col-marca { width: 52px; text-align: center; }
.enc-lote { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: 0 0 .85rem; }
.marca { position: relative; display: inline-flex; cursor: pointer; }
.marca-input {
  position: absolute; inset: 0; margin: 0;
  width: 100%; height: 100%; opacity: 0; cursor: pointer;
}
.marca-face {
  width: 28px; height: 28px; border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
  box-shadow: inset 0 0 0 4px var(--bg-2);
}
.marca-face::after {
  content: '';
  width: 7px; height: 4px;
  border-left: 2px solid transparent;
  border-bottom: 2px solid transparent;
  transform: rotate(-45deg) translate(0, -1px);
}
.marca-input:checked + .marca-face {
  background: linear-gradient(135deg, var(--primary-a), var(--primary-b));
  border-color: transparent;
  box-shadow: none;
  transform: scale(1.04);
}
.marca-input:checked + .marca-face::after { border-color: #fff; }
.marca-input:focus-visible + .marca-face { outline: 2px solid var(--primary-b); outline-offset: 3px; }
tbody tr:has(.marca-input:checked) { background: color-mix(in srgb, var(--primary-b) 10%, transparent); }
.marca-input:indeterminate + .marca-face {
  background: color-mix(in srgb, var(--primary-b) 45%, var(--bg));
  border-color: transparent;
  box-shadow: none;
}
.marca-input:indeterminate + .marca-face::after {
  width: 8px; height: 0; border: 0; border-top: 2px solid #fff; transform: none;
}
.marca-linha {
  display: flex; align-items: center; gap: .7rem;
  padding: .45rem .55rem; border-radius: 12px;
}
.marca-linha:hover { background: var(--bg); }
.marca-texto { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.marca-texto span { color: var(--muted); font-size: .82rem; }
.lote-form { display: flex; flex-direction: column; gap: .85rem; }
.lote-unidade { margin: 0; }
.lote-lista {
  display: flex; flex-direction: column; gap: .15rem;
  max-height: 168px; overflow: auto;
  padding: .25rem; border: 1px solid var(--border); border-radius: 14px;
  background: var(--bg-2);
}
.lote-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.lote-grid h3, .lote-sign label { margin: 0 0 .45rem; font-size: .95rem; }
.lote-form .form-group { margin-bottom: .65rem; }
.lote-sign canvas {
  width: 100%; height: 160px; display: block;
  background: #fff; border-radius: 14px; border: 1px solid var(--border);
  touch-action: none; cursor: crosshair;
}
#signature-pad { background: #fff; border-radius: 12px; border: 1px solid var(--border); touch-action: none; max-width: 100%; }
#prova-preview { margin-top: .5rem; }
@media (max-width: 1024px) {
  .lote-grid { grid-template-columns: 1fr; }
}

.td-detalhe { word-break: break-word; }
@media (min-width: 1025px) {
  .td-detalhe { max-width: 280px; }
}
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .75rem .5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.rel-periodo th,
.rel-periodo td { padding: .45rem .5rem; }
th { color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; }

.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  border-radius: 999px; padding: .25rem .65rem; font-size: .8rem; font-weight: 700;
}
.badge-ok { background: var(--badge-ok-bg); color: var(--badge-ok-fg); }
.badge-warn { background: var(--badge-warn-bg); color: var(--badge-warn-fg); }
.badge-danger { background: var(--badge-danger-bg); color: var(--badge-danger-fg); }
.badge-info { background: var(--badge-info-bg); color: var(--badge-info-fg); }

.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  margin: 0;
  cursor: pointer;
  user-select: none;
  min-height: 32px;
}
.switch.is-busy { opacity: .55; pointer-events: none; }
.switch-input {
  position: absolute;
  width: 46px;
  height: 26px;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.switch-track {
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: #c5ccd6;
  position: relative;
  flex-shrink: 0;
  transition: background .2s ease;
}
.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(26, 35, 50, .25);
  transition: transform .2s ease;
}
.switch-input:checked + .switch-track { background: var(--ok); }
.switch-input:checked + .switch-track::after { transform: translateX(20px); }
.switch-input:focus-visible + .switch-track { box-shadow: 0 0 0 3px rgba(47, 158, 68, .35); }
.switch-text { font-size: .85rem; font-weight: 700; color: #8b95a5; }
.switch-input:checked ~ .switch-text { color: var(--ok); }

.flash { display: none; } /* toasts substituem */

.actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.toolbar {
  display: flex; flex-wrap: wrap; gap: .75rem;
  align-items: center; justify-content: flex-end;
  margin-bottom: 1rem;
}
.toolbar-search { display: flex; flex: 1; gap: .5rem; min-width: 200px; }
.muted { color: var(--muted); }
.guest-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 1rem;
  position: relative;
}
.guest-card { width: min(420px, 100%); }
.guest-theme {
  position: fixed;
  top: calc(1rem + env(safe-area-inset-top));
  right: calc(1rem + env(safe-area-inset-right));
  z-index: 40;
}
.login-stage {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 1.5rem 1.25rem;
  overflow-x: hidden;
  overflow-y: auto;
  background: #12304f;
}
.login-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  filter: blur(12px) saturate(1.08);
  transform: scale(1.08);
  pointer-events: none;
}
.login-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, rgba(255, 255, 255, .12) 0%, rgba(12, 36, 64, .38) 78%),
    linear-gradient(165deg, rgba(30, 79, 158, .38), rgba(18, 48, 86, .46));
}
.login-stage .guest-card {
  position: relative;
  z-index: 2;
  width: min(420px, 100%);
}
.login-stage .guest-theme {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 3;
  background: color-mix(in srgb, var(--card) 48%, transparent);
  border-color: color-mix(in srgb, #fff 40%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.login-card {
  margin-bottom: 0;
  padding: 2rem 1.7rem 1.55rem;
  text-align: center;
  background: color-mix(in srgb, var(--card) 78%, transparent);
  border: 1px solid color-mix(in srgb, #fff 62%, transparent);
  border-radius: 24px;
  box-shadow: 0 28px 70px rgba(12, 28, 48, .32);
  backdrop-filter: blur(20px) saturate(1.35);
  -webkit-backdrop-filter: blur(20px) saturate(1.35);
}
[data-theme="dark"] .login-card {
  background: color-mix(in srgb, var(--card) 74%, transparent);
  border-color: color-mix(in srgb, #fff 18%, transparent);
}
.login-card label { text-align: left; }
.login-card input[type=text],
.login-card input[type=password] {
  background: var(--bg-2);
  border-color: var(--border);
}
.login-heading { margin: 0 0 .35rem; text-align: center; }
.login-logo {
  width: min(168px, 58%);
  height: auto;
  display: block;
  margin: 0 auto .15rem;
  border-radius: 20px;
  box-shadow: 0 10px 28px rgba(15, 35, 64, .22);
}
.login-tagline { text-align: center; margin: 0 0 1.25rem; }
.thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }
.thumb-empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-2);
  color: var(--muted);
}
.thumb-lg { width: 160px; height: 160px; object-fit: cover; border-radius: 12px; }
.prova-assinatura {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  margin-top: .5rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  object-fit: contain;
}
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.filters a, .filters .chip {
  padding: .55rem .9rem; border-radius: 999px; background: var(--bg-2);
  border: 1px solid var(--border); color: var(--muted); font-weight: 600;
  text-decoration: none;
}
.filters a.active { color: var(--text); border-color: var(--primary-a); }

.camera-box, .sign-box {
  background: #000; border-radius: 12px; overflow: hidden; position: relative;
  min-height: 220px; border: 1px solid var(--border);
}
.camera-box video, .camera-box canvas { width: 100%; display: block; }
#signature-pad { width: 100%; height: 200px; touch-action: none; background: #fff; border-radius: 12px; }

.proof-seal {
  display: inline-flex; align-items: center; gap: .35rem;
  background: var(--proof-bg); color: var(--proof-fg); border-radius: 999px;
  padding: .3rem .7rem; font-weight: 700; font-size: .85rem;
}
.prova-lista { display: flex; flex-direction: column; align-items: stretch; gap: 1rem; }
.prova-item { min-width: 0; }

/* Pagination */
.pagination {
  display: flex; flex-wrap: wrap; gap: .35rem;
  align-items: center; justify-content: center;
  margin-top: 1rem; padding-top: .75rem;
  border-top: 1px solid var(--border);
}
.pagination a, .pagination span, .pagination button {
  min-width: 40px; min-height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px; padding: .35rem .65rem;
  font-weight: 600; border: 1px solid var(--border);
  background: var(--bg-2); color: var(--text); text-decoration: none;
  font: inherit; cursor: pointer;
}
.pagination a:hover, .pagination button:hover { border-color: var(--primary-a); }
.pagination span { cursor: default; }
.pagination .current {
  background: linear-gradient(135deg, var(--primary-a), var(--primary-b));
  color: #fff; border-color: transparent;
}
.pagination .disabled { opacity: .45; pointer-events: none; }
.lupa-ver {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg-2);
  color: var(--primary-b); text-decoration: none;
}
.lupa-ver:hover { border-color: var(--primary-a); color: var(--primary-a); text-decoration: none; }
.enc-row-acoes { display: flex; gap: .35rem; justify-content: flex-end; }
button.lupa-ver { padding: 0; cursor: pointer; font: inherit; }
.lupa-ver.lupa-perigo { color: var(--danger); }
.lupa-ver.lupa-perigo:hover { border-color: var(--danger); color: var(--danger); }
.enc-ficha { display: flex; flex-direction: column; gap: 1rem; }
.enc-ficha-top {
  display: grid;
  grid-template-columns: minmax(150px, 210px) minmax(0, 1fr);
  gap: 1rem;
  align-items: stretch;
}
.enc-foto {
  border-radius: 16px;
  overflow: hidden;
  background: var(--bg-2);
  border: 1px solid var(--border);
  min-height: 190px;
  display: flex;
}
.enc-foto img { width: 100%; height: 100%; object-fit: cover; min-height: 190px; }
.enc-foto-vazia {
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
  color: var(--muted);
  font-weight: 600;
  font-size: .85rem;
}
.enc-bloco {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
}
.enc-dados { display: flex; flex-direction: column; gap: .8rem; margin: 0; }
.enc-dados-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.enc-protocolo { font-size: 1rem; letter-spacing: -.01em; }
.enc-dl { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem 1rem; margin: 0; }
.enc-dl div { min-width: 0; }
.enc-dl dt { margin: 0; font-size: .75rem; font-weight: 600; color: var(--muted); }
.enc-dl dd { margin: .15rem 0 0; font-weight: 700; word-break: break-word; }
.enc-span { grid-column: 1 / -1; }
.enc-fotos-extra { display: flex; gap: .5rem; flex-wrap: wrap; }
.enc-fotos-extra img { width: 72px; height: 72px; object-fit: cover; border-radius: 12px; border: 1px solid var(--border); }
.enc-qr-card { display: flex; align-items: center; gap: 1rem; }
.enc-qr-card img {
  width: 128px; height: 128px; flex-shrink: 0;
  background: #fff; border-radius: 12px; padding: 6px;
}
.enc-codigo { margin: .35rem 0 0; font-weight: 800; letter-spacing: .01em; word-break: break-all; }
.enc-bloco h2 { margin: 0 0 .75rem; font-size: 1.05rem; }
.enc-acoes {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: flex-end;
  margin-top: 1rem;
}
.enc-acoes form {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  align-items: flex-end;
  flex: 1;
  margin: 0;
}
.enc-acoes label { width: 100%; font-size: .8rem; font-weight: 600; color: var(--muted); }
.enc-acoes select { min-width: min(100%, 220px); flex: 1; }
.enc-acoes .btn { min-width: 150px; }
@media (max-width: 1024px) {
  .enc-ficha-top, .enc-dl { grid-template-columns: 1fr; }
  .enc-foto, .enc-foto img { max-height: 240px; }
  .enc-qr-card { flex-direction: column; align-items: flex-start; }
  .enc-acoes .btn, .enc-acoes select { width: 100%; }
}

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: var(--backdrop);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 1.25rem;
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
.modal-panel {
  width: min(560px, 100%);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  margin: 2vh auto;
  transform: translateY(16px);
  transition: transform .22s ease;
  max-height: none;
}
.modal-backdrop.open .modal-panel { transform: translateY(0); }
.modal-panel.wide { width: min(720px, 100%); }
.modal-panel.xl { width: min(920px, 100%); }
.modal-panel.assinatura { width: min(1040px, 100%); }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: .75rem; padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { margin: 0; font-size: 1.15rem; }
.modal-close {
  background: var(--btn-secondary-bg); color: var(--btn-secondary-text);
  border: 0; border-radius: 10px; width: 44px; height: 44px;
  font-size: 1.25rem; cursor: pointer; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.modal-body { padding: 1.15rem; }
@media (max-width: 720px) {
  .modal-backdrop {
    padding: 0;
    overflow: hidden;
    align-items: stretch;
  }
  .modal-panel,
  .modal-panel.wide,
  .modal-panel.xl,
  .modal-panel.assinatura {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
    display: flex;
    flex-direction: column;
  }
  .modal-header {
    flex-shrink: 0;
    padding-top: calc(1rem + env(safe-area-inset-top));
  }
  .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: calc(1.15rem + env(safe-area-inset-bottom));
  }
  .lote-lista { max-height: 40vh; }
  .lote-sign canvas,
  #signature-pad { height: 180px; }
  .unidade-drop { max-height: min(220px, 36vh); }
  .turno-menu { max-height: min(200px, 36vh); }
  .wa-actions { flex-direction: column; align-items: stretch; }
  .wa-logs-btn { margin-left: 0; }
  .wa-actions .btn,
  .wa-actions .wa-refresh-form { width: 100%; }
  .wa-actions .wa-refresh-form .btn { width: 100%; }
  .unidade-quick { padding: 0; align-items: stretch; }
  .unidade-quick-card {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    display: flex;
    flex-direction: column;
  }
  .unidade-quick-body { flex: 1; overflow: auto; }
}
.modal-footer {
  display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end;
  padding: 0 1.15rem 1.15rem;
}

/* Confirm (stacked above form modal) */
.confirm-backdrop {
  position: fixed; inset: 0; z-index: 120;
  background: var(--backdrop);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  opacity: 0; pointer-events: none;
  transition: opacity .18s ease;
}
.confirm-backdrop.open { opacity: 1; pointer-events: auto; }
.confirm-panel {
  width: min(420px, 100%);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.25rem;
  box-shadow: var(--shadow);
  transform: scale(.96);
  transition: transform .18s ease;
}
.confirm-backdrop.open .confirm-panel { transform: scale(1); }
.confirm-panel h3 { margin: 0 0 .5rem; }
.confirm-panel p { margin: 0 0 1.15rem; color: var(--muted); }
.confirm-actions { display: flex; gap: .5rem; justify-content: flex-end; flex-wrap: wrap; }

/* Toasts */
.toast-host {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  width: min(360px, calc(100vw - 2rem));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: var(--toast-bg);
  color: var(--toast-text);
  border-radius: 12px;
  padding: .85rem 1rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  font-weight: 600;
  animation: toast-in .25s ease;
  border-left: 4px solid var(--primary-a);
}
.toast-success { border-left-color: var(--ok); }
.toast-error { border-left-color: var(--danger); }
.toast-info { border-left-color: var(--primary-b); }
.toast.out { animation: toast-out .25s ease forwards; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateY(8px); }
}

/* —— Dashboard gerencial —— */
.rel-filters { display: flex; flex-direction: column; gap: .85rem; margin-bottom: 1rem; }
.rel-filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: flex-end;
}
.rel-filters .field {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  margin: 0;
  min-width: 140px;
}
.rel-filters .field > span { font-size: .8rem; color: var(--muted); font-weight: 600; }
.rel-filters .field-grow { flex: 1; min-width: 200px; }
.rel-empty {
  padding: 2rem 1rem;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: var(--bg-2);
}
.rel-list-foot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 1rem;
  margin-top: 1rem;
  padding-top: .75rem;
  border-top: 1px solid var(--border);
}
.rel-list-foot .pagination {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.rel-list-foot > .muted {
  grid-column: 1 / -1;
  grid-row: 2;
}
.rel-list-foot .rel-export {
  grid-column: 2;
  grid-row: 1;
  white-space: nowrap;
}
.rel-list-foot [data-retirar-lote][hidden] { display: none; }
.rel-list-foot.has-lote { grid-template-columns: auto auto minmax(0, 1fr) auto; }
.rel-list-foot.has-lote .pagination { grid-column: 1; grid-row: 1; justify-content: flex-start; }
.rel-list-foot.has-lote [data-retirar-lote] { grid-column: 2; grid-row: 1; }
.rel-list-foot.has-lote .rel-export { grid-column: 4; grid-row: 1; }
@media (max-width: 640px) {
  .rel-filters-row { flex-direction: column; align-items: stretch; }
  .rel-filters .field,
  .rel-filters .field-grow { min-width: 0; width: 100%; flex: 1 1 auto; }
  .field-submit > span { display: none; }
  .field-submit .btn { width: 100%; }
  .rel-list-foot,
  .rel-list-foot.has-lote { grid-template-columns: 1fr; }
  .rel-list-foot .pagination,
  .rel-list-foot.has-lote .pagination,
  .rel-list-foot.has-lote [data-retirar-lote],
  .rel-list-foot .rel-export,
  .rel-list-foot.has-lote .rel-export,
  .rel-list-foot > .muted {
    grid-column: 1;
    grid-row: auto;
    justify-self: stretch;
    width: 100%;
  }
  .rel-list-foot .rel-export,
  .rel-list-foot [data-retirar-lote] { justify-content: center; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar .actions,
  .toolbar .btn { width: 100%; }
  .toolbar-search { flex-direction: column; min-width: 0; width: 100%; }
  .toolbar-search .btn { width: 100%; }
}
[data-ajax-list-shell].is-ajax-loading [data-ajax-results] {
  pointer-events: none;
}
.list-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  min-height: 160px;
  margin: .25rem 0 1rem;
  color: var(--muted);
  font-weight: 700;
}
.list-loader[hidden] { display: none !important; }
.list-loader p { margin: 0; }
.list-loader-spin {
  width: 42px;
  height: 42px;
  border: 3px solid var(--border);
  border-top-color: var(--primary-a);
  border-radius: 50%;
  animation: list-spin .7s linear infinite;
}
@keyframes list-spin { to { transform: rotate(360deg); } }

.dash-period {
  display: inline-flex;
  gap: .25rem;
  padding: .2rem;
  border-radius: 999px;
  background: var(--bg-2);
  border: 1px solid var(--border);
}
.dash-period-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: .82rem;
  letter-spacing: .02em;
  padding: .4rem .75rem;
  border-radius: 999px;
  cursor: pointer;
  line-height: 1;
  min-height: 32px;
}
.dash-period-btn:hover { color: var(--text); }
.dash-period-btn.is-active {
  background: var(--primary-b);
  color: #fff;
}
#dash-root.is-loading .dash-kpi-grid,
#dash-root.is-loading .dash-chart-wrap {
  opacity: .55;
  pointer-events: none;
  transition: opacity .15s ease;
}
.topbar .dash-period { align-items: center; min-height: 42px; }
.topbar .dash-period-btn { min-height: 34px; }
.dash-hero {
  display: flex; flex-wrap: wrap; gap: 1rem;
  align-items: flex-end; justify-content: flex-end;
  margin-bottom: 0;
}
.dash-hero:has(.dash-hero-actions) { margin-bottom: 1.25rem; }
.dash-eyebrow {
  margin: 0 0 .25rem;
  font-size: .75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--primary-a);
}
.dash-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}
.dash-kpi {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .35rem 0.85rem;
  align-items: center;
  position: relative;
  overflow: hidden;
}
.dash-kpi::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--primary-b);
}
.dash-kpi--warn::before { background: var(--warn); }
.dash-kpi--ok::before { background: var(--ok); }
.dash-kpi--info::before { background: var(--primary-b); }
.dash-kpi--accent::before {
  background: linear-gradient(180deg, var(--primary-a), var(--primary-b));
}
.dash-kpi-icon {
  grid-row: span 2;
  width: 48px; height: 48px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--bg-2);
  color: var(--primary-b);
}
.dash-kpi-icon [data-lucide] { width: 22px; height: 22px; }
.dash-kpi--warn .dash-kpi-icon { color: var(--warn); }
.dash-kpi--ok .dash-kpi-icon { color: var(--ok); }
.dash-kpi--accent .dash-kpi-icon { color: var(--primary-a); }
.dash-kpi-value { font-size: 1.85rem; font-weight: 800; line-height: 1.1; }
.dash-kpi-label { color: var(--muted); font-size: .88rem; font-weight: 600; }
.dash-kpi-foot { grid-column: 1 / -1; margin-top: .35rem; font-size: .8rem; }

.dash-grid-2 {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
.dash-panel h2 {
  margin: 0; font-size: 1.05rem;
  display: inline-flex; align-items: center; gap: .4rem;
}
.dash-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: .75rem; margin-bottom: 1rem; flex-wrap: wrap;
}
.dash-health-row span:first-child {
  display: inline-flex; align-items: center; gap: .4rem;
}
.dash-chart-wrap { position: relative; height: 240px; }
.dash-health { display: flex; flex-direction: column; gap: .65rem; }
.dash-health-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; padding: .55rem .65rem;
  background: var(--bg-2); border-radius: 10px;
  font-size: .92rem;
}
.text-danger { color: var(--danger); }

.dash-progress {
  height: 8px; border-radius: 999px; background: var(--bg-2);
  overflow: hidden; margin-top: .45rem;
}
.dash-progress span {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--primary-a), var(--primary-b));
  border-radius: 999px;
}

.dash-rank { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .85rem; }
.dash-rank-meta {
  display: flex; justify-content: space-between; gap: .5rem;
  font-size: .92rem; margin-bottom: .25rem;
}

.dash-table th { font-size: .75rem; }
.dash-table td { font-size: .9rem; }

.dash-global { margin-bottom: 1.25rem; }
.dash-global .dash-panel-head { margin-bottom: .75rem; }
.dash-global .dash-kpi-grid { margin-bottom: 0; }

@media (max-width: 1000px) {
  .dash-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .dash-kpi-grid { grid-template-columns: 1fr; }
}

/* —— WhatsApp admin editor —— */
.wa-predio-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
}
.wa-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  margin: 1rem 0;
}
.wa-actions .wa-refresh-form { display: flex; margin: 0; }
.wa-actions .btn {
  height: 48px;
  min-height: 48px;
  padding-top: 0;
  padding-bottom: 0;
  box-sizing: border-box;
  line-height: 1;
}
.btn-test {
  background: #16a34a;
  color: #fff;
  box-shadow: 0 8px 20px rgba(22, 163, 74, .22);
}
.btn-test:hover { filter: brightness(1.05); }
.wa-logs-btn { margin-left: auto; }
.wa-test-hint { margin: 0 0 1rem; font-size: .9rem; }
.wa-test-label {
  display: block;
  margin-bottom: .4rem;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.wa-test-phones {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem;
  min-height: 48px;
  padding: .4rem .55rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-2);
  cursor: text;
}
.wa-test-phones input {
  flex: 1 1 140px;
  min-height: 36px;
  width: auto;
  border: 0;
  background: transparent;
  padding: .2rem .35rem;
  box-shadow: none;
}
.wa-test-phones input:focus { outline: none; }
.wa-test-chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  background: #d1fae5;
  color: #047857;
  border-radius: 999px;
  padding: .28rem .45rem .28rem .7rem;
  font-weight: 700;
  font-size: .85rem;
}
.wa-test-chip button {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 .15rem;
}
.wa-test-help { margin: .45rem 0 0; font-size: .78rem; }
.wa-test-warn {
  margin: .45rem 0 0;
  color: #b45309;
  font-size: .78rem;
  font-weight: 600;
}
.wa-test-warn[hidden] { display: none; }
.wa-test-feedback { min-height: 1.2rem; margin: .65rem 0 0; font-size: .88rem; font-weight: 700; }
.wa-test-feedback.is-error { color: var(--danger); }
.wa-test-feedback.is-ok { color: var(--ok); }
.wa-test-feedback.is-muted { color: var(--muted); font-weight: 600; }
.wa-test-actions { display: flex; gap: .75rem; margin-top: 1.1rem; }
.wa-test-actions .btn { flex: 1; }
.wa-logs-search { display: block; margin: 0 0 .85rem; }
.wa-logs-search span {
  display: block;
  margin-bottom: .35rem;
  color: var(--muted);
  font-weight: 600;
}
.wa-logs .filters { margin-bottom: .85rem; }
.filters button.chip { font: inherit; cursor: pointer; line-height: 1.2; }
.filters button.chip.active { color: var(--text); border-color: var(--primary-a); }
.wa-logs-count { text-align: center; margin: .5rem 0 0; font-size: .85rem; }
.wa-logs [data-wa-view-msg] { white-space: nowrap; }
.wa-msg-backdrop {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(8, 16, 28, .45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}
.wa-msg-backdrop.open { opacity: 1; pointer-events: auto; }
.wa-phone {
  width: min(390px, 100%);
  height: min(680px, 88vh);
  display: flex;
  flex-direction: column;
  border-radius: 28px;
  overflow: hidden;
  background: #efeae2;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
  font-family: "Segoe UI", Helvetica, Arial, sans-serif;
  color: #111b21;
}
.wa-phone-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .55rem 1.15rem .15rem;
  background: #008069;
  color: #fff;
  font-size: .78rem;
  font-weight: 700;
}
.wa-phone-icons { display: inline-flex; align-items: flex-end; gap: .28rem; }
.wa-phone-icons i {
  display: block;
  background: #fff;
  border-radius: 1px;
}
.wa-phone-icons i:nth-child(1) { width: 3px; height: 6px; }
.wa-phone-icons i:nth-child(2) { width: 3px; height: 9px; }
.wa-phone-icons i:nth-child(3) { width: 3px; height: 12px; }
.wa-phone-icons b {
  width: 18px;
  height: 9px;
  margin-left: .2rem;
  border: 1.5px solid #fff;
  border-radius: 2px;
  position: relative;
}
.wa-phone-icons b::before {
  content: "";
  position: absolute;
  inset: 1px 3px 1px 1px;
  background: #fff;
  border-radius: 1px;
}
.wa-phone-head {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .35rem .7rem .7rem;
  background: #008069;
  color: #fff;
}
.wa-phone-back {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
}
.wa-phone-back:hover { background: rgba(255, 255, 255, .12); }
.wa-phone-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #dfe5e7;
  color: #54656f;
  font-weight: 800;
  flex-shrink: 0;
}
.wa-phone-who { min-width: 0; display: flex; flex-direction: column; }
.wa-phone-who strong {
  font-size: 1.02rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wa-phone-who span { font-size: .75rem; opacity: .85; margin-top: -1px; }
.wa-phone-chat {
  flex: 1;
  overflow: auto;
  padding: .85rem .7rem 1.1rem;
  background-color: #efeae2;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(11, 20, 26, .045) 0 1px, transparent 1.5px),
    radial-gradient(circle at 70% 60%, rgba(11, 20, 26, .04) 0 1px, transparent 1.5px);
  background-size: 28px 28px, 36px 36px;
}
.wa-day { display: flex; justify-content: center; margin: .15rem 0 .7rem; }
.wa-day span {
  background: #fff;
  color: #54656f;
  font-size: .72rem;
  font-weight: 600;
  padding: .28rem .65rem;
  border-radius: 8px;
  box-shadow: 0 1px 0.5px rgba(11, 20, 26, .13);
}
.wa-in {
  position: relative;
  width: fit-content;
  max-width: 86%;
  margin-left: 8px;
  background: #fff;
  color: #111b21;
  border-radius: 0 8px 8px 8px;
  padding: 6px 8px 4px 9px;
  box-shadow: 0 1px 0.5px rgba(11, 20, 26, .13);
}
.wa-in::after { content: ""; display: block; clear: both; }
.wa-in::before {
  content: "";
  position: absolute;
  top: 0;
  left: -8px;
  border-width: 0 8px 10px 0;
  border-style: solid;
  border-color: transparent #fff transparent transparent;
}
.wa-in-text {
  font-size: 14.2px;
  line-height: 19px;
  word-wrap: break-word;
  white-space: normal;
}
.wa-in-text code {
  font-family: Consolas, monospace;
  font-size: .92em;
  background: rgba(11, 20, 26, .06);
  border-radius: 3px;
  padding: 0 .2em;
}
.wa-in-time {
  float: right;
  margin: 4px 0 0 10px;
  color: #667781;
  font-size: 11px;
  line-height: 15px;
}
.wa-log-erro {
  margin: .35rem 0 0;
  color: var(--danger);
  font-size: .8rem;
  max-width: 16rem;
}
.wa-qr-modal { text-align: center; }
.wa-qr-hint { margin: 0 0 1rem; font-size: .9rem; }
.wa-qr-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 260px;
  margin: 0 auto 1rem;
  padding: 1rem;
  border-radius: 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
}
.wa-qr-img {
  width: min(240px, 100%);
  height: auto;
  background: #fff;
  padding: 10px;
  border-radius: 10px;
  box-shadow: 0 4px 18px rgba(0,0,0,.08);
}
.wa-qr-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
  color: var(--muted);
  font-size: .9rem;
}
.wa-qr-spinner[hidden] { display: none !important; }
.wa-spinner-dot {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--primary-b);
  border-radius: 50%;
  animation: wa-spin .7s linear infinite;
}
@keyframes wa-spin { to { transform: rotate(360deg); } }
.wa-qr-status { margin: 0; font-size: .9rem; }
.wa-qr-error {
  margin: .75rem 0 0;
  color: var(--danger);
  font-size: .88rem;
}
.wa-qr-error[hidden] { display: none !important; }
.wa-divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 1.25rem 0;
}
.wa-section-title {
  margin: 0 0 .75rem;
  font-size: 1rem;
  font-weight: 600;
}
.wa-editor {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card, var(--bg-2));
  overflow: hidden;
}
.wa-toolbar {
  display: flex;
  gap: .25rem;
  padding: .5rem .65rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
}
.wa-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.wa-tool:hover { background: var(--border); }
.wa-tool [data-lucide] { width: 16px; height: 16px; }
.wa-compose {
  min-height: 180px;
  max-height: 360px;
  overflow-y: auto;
  padding: .9rem 1rem;
  line-height: 1.55;
  font-size: .98rem;
  outline: none;
  white-space: pre-wrap;
  word-break: break-word;
}
.wa-compose:focus { box-shadow: inset 0 0 0 2px var(--primary-a, rgba(34,139,230,.25)); }
.wa-compose strong, .wa-compose b { font-weight: 700; }
.wa-compose em, .wa-compose i { font-style: italic; }
.wa-compose s { text-decoration: line-through; opacity: .85; }
.wa-compose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .9em;
  background: var(--bg-2);
  padding: .1em .35em;
  border-radius: 4px;
}
.wa-tag-chip {
  display: inline-flex;
  align-items: center;
  margin: 0 .15em;
  padding: .12em .55em;
  border-radius: 999px;
  background: var(--badge-info-bg);
  color: var(--badge-info-fg);
  font-size: .82em;
  font-weight: 600;
  font-style: normal;
  text-decoration: none;
  vertical-align: baseline;
  user-select: none;
  cursor: default;
}
.wa-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem;
  padding: .65rem .85rem;
  border-top: 1px solid var(--border);
  background: var(--bg-2);
}
.wa-tags-label {
  font-size: .78rem;
  color: var(--muted);
  margin-right: .25rem;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.wa-tag-btn {
  border: 1px solid var(--border);
  background: var(--card, var(--bg));
  color: var(--text);
  border-radius: 999px;
  padding: .28rem .7rem;
  font-size: .82rem;
  cursor: pointer;
  line-height: 1.2;
}
.wa-tag-btn:hover {
  border-color: var(--primary-a, var(--primary));
  color: var(--badge-info-fg);
}
.wa-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .85rem;
}

/* —— Ajuda —— */
.help-kicker {
  margin: 0 0 .35rem;
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--primary-a);
}
.help-lead { margin: 0 0 1rem; max-width: 68ch; color: var(--muted); font-size: 1.05rem; }
.help-block, .help-step { scroll-margin-top: 120px; margin-bottom: 2rem; }
.help-step h2, .help-block h2, .help-screen h2 { display: flex; align-items: center; gap: .7rem; font-size: 1.25rem; margin-top: 0; }
.help-subtitle { margin: 1.4rem 0 .7rem; font-size: 1.05rem; }
.help-num {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary-a), var(--primary-b));
  color: #fff; font-weight: 800; font-size: .95rem;
}
.help-ol { margin: .4rem 0 1rem; padding-left: 1.2rem; }
.help-ol li { margin: .35rem 0; }
.help-index {
  display: flex; gap: .45rem; overflow-x: auto;
  padding-bottom: .35rem; margin: 0 0 1.5rem;
}
.help-index a {
  flex: 0 0 auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .4rem .8rem;
  font-weight: 700;
  font-size: .85rem;
  color: var(--text);
  text-decoration: none;
}
.help-index a:hover { border-color: var(--primary-a); text-decoration: none; }
.help-flow {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  gap: .65rem;
  align-items: stretch;
  margin-top: .8rem;
}
.help-flow-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}
.help-flow-card p { margin: .4rem 0 0; color: var(--muted); }
.help-flow-arrow { display: flex; align-items: center; color: var(--primary-a); }
.help-roles { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.help-role h3 { display: flex; align-items: center; gap: .45rem; margin-top: 0; }
.help-role ul { margin: .4rem 0 0; padding-left: 1.1rem; }
.help-role li { margin: .3rem 0; }
.help-menu-map {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .55rem .9rem;
}
.help-menu-map div {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .7rem .85rem;
}
.help-menu-map strong { display: block; }
.help-menu-map span { color: var(--muted); font-size: .92rem; }
.help-links { display: flex; flex-wrap: wrap; gap: .5rem; }
.help-shot { margin: .8rem 0 1rem; }
.help-shot figcaption { margin-top: .45rem; color: var(--muted); font-size: .9rem; }
.help-shot-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .8rem;
  align-items: start;
}
.help-window {
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  background: var(--bg);
  box-shadow: var(--shadow);
}
.help-chrome {
  display: flex; align-items: center; gap: .4rem;
  padding: .5rem .75rem;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: .78rem;
}
.help-chrome .dot { width: 9px; height: 9px; border-radius: 50%; background: #ced4da; }
.help-chrome .dot:nth-child(1) { background: #ff6b6b; }
.help-chrome .dot:nth-child(2) { background: #ffd43b; }
.help-chrome .dot:nth-child(3) { background: #69db7c; }
.help-chrome strong { margin-left: .35rem; font-weight: 700; }
.help-stage { padding: 1rem 1rem 1.15rem; }
.help-login { max-width: 360px; margin: 0 auto; text-align: center; }
.help-login .help-brand { font-size: 1.25rem; }
.help-login label, .help-form label { text-align: left; }
.help-login .help-aim { margin-left: auto; margin-right: auto; }
.help-field {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  min-height: 44px;
  padding: .7rem .9rem;
  margin-bottom: .75rem;
  color: var(--text);
  text-align: left;
}
.help-form label { margin-top: .15rem; }
.help-actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; margin-top: .35rem; }
.help-toolbar {
  display: flex; justify-content: space-between; align-items: flex-end; gap: .75rem; margin-bottom: .75rem;
}
.help-top {
  display: flex; justify-content: space-between; align-items: flex-end; gap: .75rem;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: .75rem;
}
.help-select {
  display: inline-flex; align-items: center; gap: .4rem;
  border: 1px solid var(--border); border-radius: 10px; padding: .55rem .8rem;
  font-weight: 700; background: var(--bg);
}
.help-menu {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .45rem;
}
.help-mi, .help-mi-label {
  padding: .55rem .7rem;
  border-radius: 10px;
  font-weight: 700;
}
.help-mi { color: var(--muted); }
.help-mi.is-on {
  background: linear-gradient(135deg, rgba(43, 159, 224, 0.16), rgba(30, 79, 158, 0.1));
  color: var(--text);
}
.help-mi-label {
  margin-top: .35rem;
  font-size: .7rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.help-point { display: inline-flex; flex-direction: column; align-items: center; max-width: 100%; }
.help-point.is-full { display: flex; width: 100%; align-items: stretch; }
.help-point.is-full .help-aim { align-self: center; }
.help-point.is-full .help-field,
.help-point.is-full .help-mi,
.help-point.is-full .help-check { width: 100%; }
.help-aim {
  display: flex; flex-direction: column; align-items: center;
  margin-bottom: .15rem; pointer-events: none;
}
.help-aim-label {
  background: #e8940a; color: #fff; font-weight: 800; font-size: .82rem;
  padding: .28rem .7rem; border-radius: 999px;
  box-shadow: 0 6px 16px rgba(232, 148, 10, .35);
  white-space: nowrap;
}
.help-aim-shaft { width: 3px; height: 22px; background: var(--accent); }
.help-aim-head {
  width: 0; height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 9px solid var(--accent);
}
.help-hot {
  box-shadow: 0 0 0 3px var(--card), 0 0 0 6px var(--accent) !important;
}
.help-check { border-radius: 10px; padding: .35rem .5rem; margin-bottom: .35rem; }
.help-role [data-lucide], .help-flow-arrow [data-lucide] { width: 18px; height: 18px; }

body.help-focus-body {
  overflow: hidden;
  background:
    radial-gradient(900px 420px at 50% -10%, rgba(43, 159, 224, .16), transparent 60%),
    var(--bg);
}
.help-focus {
  height: 100dvh;
  display: flex;
  flex-direction: column;
}
.help-focus-top {
  flex: none;
  padding: calc(.75rem + env(safe-area-inset-top)) 1rem .7rem;
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--border);
}
.help-focus-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .65rem;
}
.help-exit {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  color: var(--muted);
  font-weight: 700;
  font-size: .92rem;
  text-decoration: none;
}
.help-exit:hover { color: var(--text); text-decoration: none; }
.help-rail {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: flex-start;
  gap: .4rem;
  overflow: visible;
  padding: .15rem 0 .1rem;
}
.help-dot {
  flex: 0 1 auto;
  width: auto;
  height: auto;
  min-height: 36px;
  padding: .35rem .75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  font-weight: 800;
  font-size: .86rem;
  white-space: nowrap;
  text-align: left;
  cursor: pointer;
  transition: background .25s ease, color .25s ease, box-shadow .25s ease;
}
.help-dot.is-done {
  background: rgba(43, 159, 224, .16);
  color: var(--text);
  border-color: transparent;
}
.help-dot.is-current {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary-a), var(--primary-b));
  box-shadow: 0 0 0 4px rgba(232, 148, 10, .35);
}
.help-focus-stage {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 1rem 1rem 1.25rem;
}
.help-focus .help {
  width: min(860px, 100%);
  margin: 0 auto;
  min-height: 100%;
}
.help-screen { display: none; }
.help-screen.is-on {
  display: block;
  min-height: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 1.35rem 1.2rem 1.5rem;
}
#help-prev[hidden] { display: none !important; }
.help-focus-bottom {
  flex: none;
  display: flex;
  justify-content: flex-end;
  gap: .65rem;
  padding: .75rem 1rem calc(.75rem + env(safe-area-inset-bottom));
  background: var(--sidebar-bg);
  border-top: 1px solid var(--border);
}
.help-focus-bottom .btn { min-width: 168px; }
#help-prev { margin-right: auto; }

@keyframes helpRise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}
@keyframes helpPop {
  from { opacity: 0; transform: translateY(-10px) scale(.96); }
  to { opacity: 1; transform: none; }
}
.help-screen.is-on > * {
  animation: helpRise .9s cubic-bezier(.16, .84, .32, 1) both;
}
.help-screen.is-on > *:nth-child(1) { animation-delay: .05s; }
.help-screen.is-on > *:nth-child(2) { animation-delay: .28s; }
.help-screen.is-on > *:nth-child(3) { animation-delay: .52s; }
.help-screen.is-on > *:nth-child(4) { animation-delay: .76s; }
.help-screen.is-on > *:nth-child(5) { animation-delay: 1s; }
.help-screen.is-on > *:nth-child(6) { animation-delay: 1.24s; }
.help-screen.is-on > *:nth-child(7) { animation-delay: 1.48s; }
.help-screen.is-on > .help-shot,
.help-screen.is-on > .help-shot-grid,
.help-screen.is-on .help-shot {
  animation: none;
}
.help-screen.is-on .help-flow-card,
.help-screen.is-on .help-role,
.help-screen.is-on .help-menu-map > div {
  animation: helpRise .85s cubic-bezier(.16, .84, .32, 1) both;
}
.help-screen.is-on .help-flow-card:nth-child(1),
.help-screen.is-on .help-role:nth-child(1),
.help-screen.is-on .help-menu-map > div:nth-child(1) { animation-delay: .4s; }
.help-screen.is-on .help-flow-card:nth-child(3),
.help-screen.is-on .help-role:nth-child(2),
.help-screen.is-on .help-menu-map > div:nth-child(2) { animation-delay: .62s; }
.help-screen.is-on .help-flow-card:nth-child(5) { animation-delay: .84s; }
.help-screen.is-on .help-menu-map > div:nth-child(n+3) { animation-delay: .8s; }
.help-screen.is-on .help-seq {
  animation: helpRise .55s cubic-bezier(.16, .84, .32, 1) both;
  animation-delay: calc(.25s + (var(--help-i, 0) * .32s));
}

@media (max-width: 640px) {
  .help-focus-bottom .btn { min-width: 0; }
  #help-next { flex: 1; }
  .help-screen.is-on { border-radius: 16px; padding: 1.05rem .9rem 1.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  .help-screen.is-on > *,
  .help-screen.is-on .help-flow-card,
  .help-screen.is-on .help-role,
  .help-screen.is-on .help-menu-map > div,
  .help-screen.is-on .help-shot,
  .help-screen.is-on .help-seq { animation: none; }
}

@media (max-width: 1024px) {
  .help-rail {
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
  }
  .help-dot { flex: 0 0 auto; min-height: 44px; }
  .help-flow, .help-roles, .help-menu-map, .help-shot-grid { grid-template-columns: 1fr; }
  .help-flow-arrow { justify-content: center; transform: rotate(90deg); }
  .help-aim-label { white-space: normal; text-align: center; }
}

.print-only { display: none; }

@media (max-width: 1024px) {
  .table-wrap { overflow-x: visible; }
  .table-wrap table,
  .table-wrap tbody { display: block; width: 100%; }
  .table-wrap thead { display: none; }
  .table-wrap thead:has(.marca-input) { display: block; margin-bottom: .35rem; }
  .table-wrap thead:has(.marca-input) tr {
    display: flex;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
  }
  .table-wrap thead th { display: none; }
  .table-wrap thead th.col-marca {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: 0;
    border: 0;
  }
  .table-wrap thead th.col-marca::after {
    content: "Marcar tudo";
    font-size: .85rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
    color: var(--text);
  }
  .table-wrap tr {
    display: block;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: .35rem .85rem;
    margin: 0 0 .75rem;
  }
  .table-wrap tr:last-child { margin-bottom: 0; }
  .table-wrap tr:has(.marca-input:checked) {
    background: color-mix(in srgb, var(--primary-b) 12%, var(--bg-2));
    border-color: var(--primary-b);
  }
  .table-wrap td {
    display: block;
    padding: .55rem 0;
    border-bottom: 1px solid var(--border);
    text-align: left;
    word-break: break-word;
  }
  .table-wrap td:last-child { border-bottom: 0; }
  .table-wrap td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: .15rem;
    color: var(--muted);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
  }
  .table-wrap td.td-plain {
    border-bottom: 0;
    color: var(--muted);
  }
  .table-wrap td.td-plain::before { content: none; }
  .table-wrap td.col-marca {
    display: flex;
    align-items: center;
    border-bottom: 0;
    padding-bottom: 0;
  }
  .table-wrap td.td-actions { padding-top: .7rem; }
  .table-wrap td.td-actions::before { content: none; }
  .table-wrap .enc-row-acoes,
  .table-wrap td.td-actions.actions,
  .table-wrap td.actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: .5rem;
  }
  .table-wrap td.actions .btn { flex: 1 1 8rem; }
  .wa-log-erro { max-width: none; }
  .wa-logs [data-wa-view-msg] { white-space: normal; }
  .lupa-ver { width: 44px; height: 44px; }
  .btn-sm { min-height: 44px; }
  .pagination a, .pagination span, .pagination button { min-width: 44px; min-height: 44px; }
  .wa-tool, .wa-phone-back { width: 44px; height: 44px; }
  .unidade-pill-clear { width: 44px; height: 44px; }
  .marca { min-width: 44px; min-height: 44px; align-items: center; justify-content: center; }
  .filters a, .filters .chip { min-height: 44px; display: inline-flex; align-items: center; }
  .wa-test-chip button { min-width: 44px; min-height: 44px; padding: 0 .35rem; }
  .table-wrap thead:has(.marca-input) tr,
  .table-wrap thead:has(.marca-input) tr:has(.marca-input:checked) {
    display: flex;
    margin: 0 0 .35rem;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
  }
}

@media print {
  .sidebar, .topbar, .toast-host, .modal-backdrop, .confirm-backdrop, .no-print, .sidebar-overlay {
    display: none !important;
  }
  .print-only { display: block !important; }
  .shell-main { margin: 0; margin-left: 0 !important; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border: 1px solid #ccc; }
  .table-wrap { overflow: visible; }
  .table-wrap table { display: table !important; width: 100%; }
  .table-wrap thead { display: table-header-group !important; }
  .table-wrap tbody { display: table-row-group !important; }
  .table-wrap tr {
    display: table-row !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
  }
  .table-wrap th,
  .table-wrap td { display: table-cell !important; text-align: left; }
  .table-wrap thead th.col-marca::after,
  .table-wrap td[data-label]::before { content: none !important; }
}
