/* ==========================================================================
   Porteiro Virtual — design system
   Base visual: projeto-modelo (React/Tailwind). Um único arquivo, sem build.
   Índice:
   1. Tokens          6. Badges e status     11. Modal, drawer, toasts
   2. Base            7. Cards e KPIs        12. Shell (sidebar/topbar)
   3. Utilitários     8. Gráficos            13. Landing
   4. Botões          9. Tabelas e listas    14. Login / cadastro
   5. Formulários    10. Toolbar/paginação   15. Portaria pública e chat
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */
:root {
  --background: #faf9f6;
  --foreground: #29332f;
  --card: #ffffff;
  --primary: #527561;
  --primary-hover: #476855;
  --primary-fg: #ffffff;
  --secondary: #dce9df;
  --secondary-fg: #29332f;
  --muted: #f5f2eb;
  --muted-fg: #78817b;
  --accent: #dce8f5;
  --border: #e7e9e4;
  --input: #e7e9e4;
  --ring: #527561;
  --destructive: #b5452b;
  --destructive-bg: #f8e5d8;
  --sidebar: #f5f2eb;
  --sidebar-accent: #dce9df;
  --code-bg: #1c2420;
  --code-fg: #dce9df;

  --tone-green-bg: #dce9df;  --tone-green-fg: #527561;
  --tone-blue-bg: #dce8f5;   --tone-blue-fg: #3a6a9a;
  --tone-purple-bg: #eae3f5; --tone-purple-fg: #6b4fa0;
  --tone-orange-bg: #f8e5d8; --tone-orange-fg: #a05020;
  --tone-yellow-bg: #f6efcf; --tone-yellow-fg: #8b7430;

  --font-sans: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-serif: "DM Serif Display", ui-serif, Georgia, serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --radius-sm: 0.5rem;
  --radius: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.25rem;
  --shadow-sm: 0 1px 2px rgb(41 51 47 / 0.05);
  --shadow: 0 4px 16px -4px rgb(41 51 47 / 0.12);
  --shadow-lg: 0 24px 48px -12px rgb(41 51 47 / 0.25);
  --sidebar-width: 16rem;
  --topbar-height: 3.5rem;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* 2. Base ------------------------------------------------------------------ */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--foreground);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.5rem 0; }
code, pre, kbd { font-family: var(--font-mono); font-size: 0.85em; }
[hidden] { display: none !important; }
::selection { background: var(--secondary); }

:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 4px; }

.icon {
  display: inline-block;
  vertical-align: -0.2em;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.serif { font-family: var(--font-serif); font-weight: 400; }
h1 em, h2 em, .serif-em { font-family: var(--font-serif); font-style: italic; font-weight: 400; color: var(--primary); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* 3. Utilitários ------------------------------------------------------------ */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted-fg); }
.small { font-size: 0.8125rem; }
.xsmall { font-size: 0.75rem; }
.strong { font-weight: 600; }
.mono { font-family: var(--font-mono); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.row { display: flex; align-items: center; gap: 0.75rem; }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.grow { flex: 1; min-width: 0; }
.stack { display: grid; gap: 1rem; }
.stack-sm { display: grid; gap: 0.5rem; }
.stack-lg { display: grid; gap: 1.5rem; }
.stack-xl { display: grid; gap: 2rem; }
.stack, .stack-sm, .stack-lg, .stack-xl, .page { grid-template-columns: minmax(0, 1fr); }
.grid-2, .grid-3, .grid-4 { display: grid; gap: 1rem; }
@media (min-width: 640px) { .grid-2, .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.span-2 { grid-column: 1 / -1; }
@media (min-width: 1024px) { .split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1.5rem; } .span-2 { grid-column: span 2; } }
.split { display: grid; gap: 1.5rem; }

/* 4. Botões ----------------------------------------------------------------- */
.btn {
  --btn-bg: var(--card);
  --btn-fg: var(--foreground);
  --btn-border: var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.5rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--btn-border);
  border-radius: var(--radius);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none !important;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; pointer-events: none; }
.btn-primary { --btn-bg: var(--primary); --btn-fg: var(--primary-fg); --btn-border: var(--primary); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { --btn-bg: var(--secondary); --btn-fg: var(--primary); --btn-border: transparent; }
.btn-secondary:hover { background: #cfe0d3; }
.btn-outline { --btn-bg: transparent; }
.btn-ghost { --btn-bg: transparent; --btn-border: transparent; --btn-fg: var(--muted-fg); }
.btn-ghost:hover { color: var(--foreground); }
.btn-danger { --btn-bg: var(--card); --btn-fg: var(--destructive); --btn-border: #efc9b5; }
.btn-danger:hover { background: var(--destructive-bg); }
.btn-condo { --btn-bg: var(--condo-color, var(--primary)); --btn-fg: #fff; --btn-border: var(--condo-color, var(--primary)); box-shadow: var(--shadow-sm); }
.btn-condo:hover { background: var(--btn-bg); filter: brightness(0.92); }
.btn-whatsapp { --btn-bg: #25d366; --btn-fg: #fff; --btn-border: #25d366; }
.btn-whatsapp:hover { background: #1fbd5a; }
.btn-sm { min-height: 2rem; padding: 0.3rem 0.7rem; font-size: 0.8125rem; border-radius: var(--radius-sm); }
.btn-lg { min-height: 3rem; padding: 0.75rem 1.5rem; font-size: 0.9375rem; border-radius: var(--radius-lg); }
.btn-block { width: 100%; }
.btn-icon { min-height: 0; width: 2.25rem; height: 2.25rem; padding: 0; }
.btn-icon.btn-sm { width: 2rem; height: 2rem; }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: ""; position: absolute; width: 1rem; height: 1rem; border-radius: 50%;
  border: 2px solid var(--btn-fg); border-right-color: transparent; animation: spin 0.6s linear infinite;
}
.link-btn { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0; border: 0; background: none; color: var(--primary); font-weight: 600; font-size: 0.875rem; }
.link-btn:hover { text-decoration: underline; }

@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 0.9s linear infinite; }

/* 5. Formulários ------------------------------------------------------------ */
.form { display: grid; gap: 1.1rem; }
.form-grid { display: grid; gap: 1.1rem; }
@media (min-width: 640px) {
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid > .field-wide, .form-grid > .field-choices, .form-grid > .field-check, .form-grid > .form-errors { grid-column: 1 / -1; }
}
.form-section { display: grid; gap: 1.1rem; padding: 1.25rem; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card); }
.form-section-head { display: flex; align-items: flex-start; gap: 0.75rem; }
.form-section-head h2 { font-size: 0.9375rem; }
.form-section-head p { font-size: 0.8125rem; color: var(--muted-fg); }
.form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.5rem; padding-top: 0.25rem; }
.form-actions.sticky { position: sticky; bottom: 0; padding: 1rem 0; background: linear-gradient(transparent, var(--background) 35%); }

.field { display: grid; gap: 0.4rem; min-width: 0; align-content: start; }
.field-label { font-size: 0.8125rem; font-weight: 600; color: var(--foreground); }
.field-label .req { color: var(--destructive); margin-left: 0.15rem; }
.field-label .opt { color: var(--muted-fg); font-weight: 500; margin-left: 0.25rem; }
.field-help { font-size: 0.75rem; color: var(--muted-fg); }
.field-errors, .form-errors { margin: 0; padding: 0; list-style: none; font-size: 0.8125rem; color: var(--destructive); font-weight: 500; }
.form-errors { padding: 0.75rem 1rem; border-radius: var(--radius); background: var(--destructive-bg); border: 1px solid #efc9b5; }

.control {
  display: block;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--input);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--foreground);
  font-size: 0.9375rem;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
}
.control::placeholder { color: #a3aaa5; }
.control:hover { border-color: #d4d8d1; }
.control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgb(82 117 97 / 0.15); }
.control[aria-invalid="true"] { border-color: var(--destructive); }
.control[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgb(181 69 43 / 0.15); }
.control:disabled { background: var(--muted); color: var(--muted-fg); }
textarea.control { min-height: 6rem; resize: vertical; line-height: 1.5; }
select.control {
  padding-right: 2.25rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2378817B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
}
input[type="color"].control { padding: 0.25rem; width: 4rem; height: 2.75rem; cursor: pointer; }
.control-sm { min-height: 2.25rem; padding: 0.4rem 0.75rem; font-size: 0.875rem; }
select.control-sm { padding-right: 2rem; }

.input-icon { position: relative; }
.input-icon > .icon { position: absolute; left: 0.85rem; top: 50%; transform: translateY(-50%); color: var(--muted-fg); pointer-events: none; }
.input-icon > .control { padding-left: 2.5rem; }
.input-icon > .input-addon { position: absolute; right: 0.4rem; top: 50%; transform: translateY(-50%); }

.field-check { display: flex; align-items: flex-start; gap: 0.65rem; padding: 0.75rem 0.9rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); cursor: pointer; }
.field-check:hover { border-color: #d4d8d1; }
.field-check .field-label { font-weight: 600; }
.field-choices { margin: 0; padding: 0; border: 0; min-width: 0; }
.field-choices legend { padding: 0; margin-bottom: 0.4rem; }
.choice-list { display: grid; gap: 0.4rem; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); max-height: 15rem; overflow: auto; padding: 0.15rem; }
.choice-list label, .choice { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.7rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card); font-size: 0.875rem; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.choice-list label:has(input:checked), .choice:has(input:checked) { border-color: var(--primary); background: #f1f7f2; }
.choice-list div { display: contents; }

input[type="checkbox"], input[type="radio"] { width: 1.05rem; height: 1.05rem; margin: 0.15rem 0 0; accent-color: var(--primary); flex-shrink: 0; cursor: pointer; }

/* Switch: <label class="switch"><input type="checkbox" role="switch"><span></span></label> */
.switch { position: relative; display: inline-flex; align-items: center; gap: 0.6rem; cursor: pointer; font-size: 0.875rem; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { position: relative; width: 2.5rem; height: 1.4rem; border-radius: 999px; background: #d0cfc9; transition: background 0.2s; flex-shrink: 0; }
.switch-track::after { content: ""; position: absolute; top: 0.2rem; left: 0.2rem; width: 1rem; height: 1rem; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform 0.2s var(--ease); }
.switch input:checked + .switch-track, button.switch-track[aria-checked="true"] { background: var(--primary); }
.switch input:checked + .switch-track::after, button.switch-track[aria-checked="true"]::after { transform: translateX(1.1rem); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--ring); outline-offset: 2px; }
button.switch-track { border: 0; padding: 0; }
button.switch-track.htmx-request { opacity: 0.6; }

/* 6. Badges e status -------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.15rem 0.6rem; border-radius: 999px; border: 1px solid transparent;
  font-size: 0.75rem; font-weight: 600; line-height: 1.5; white-space: nowrap;
  background: var(--muted); color: var(--muted-fg);
}
.badge-dot::before { content: ""; width: 0.4rem; height: 0.4rem; border-radius: 50%; background: currentColor; }
.badge-green { background: #dce9df; color: #2d5c3d; border-color: #8bc49a; }
.badge-blue { background: #dce8f5; color: #3a6a9a; border-color: #8baac9; }
.badge-yellow, .badge-demo { background: #f6efcf; color: #8b7430; border-color: #e8d87a; }
.badge-orange, .badge-red { background: #f8e5d8; color: #8b3a1a; border-color: #e0a080; }
.badge-purple { background: #eae3f5; color: #6b4fa0; border-color: #d0c4e8; }
.badge-neutral { background: var(--muted); color: var(--muted-fg); border-color: #d0cfc9; }

.status-aguardando_resposta { background: #f6efcf; color: #8b7430; border-color: #e8d87a; }
.status-morador_a_caminho { background: #dce8f5; color: #3a6a9a; border-color: #8baac9; }
.status-entrada_autorizada { background: #dce9df; color: #2d5c3d; border-color: #8bc49a; }
.status-morador_indisponivel { background: #f8e5d8; color: #8b3a1a; border-color: #e0a080; }
.status-finalizado { background: #f5f2eb; color: #527561; border-color: #d0cfc9; }
.status-cancelado { background: #f5f2eb; color: #78817b; border-color: #d0cfc9; }
.status-aguardando_resposta::before { animation: pulse 1.6s ease-in-out infinite; }

@keyframes pulse { 50% { opacity: 0.35; } }

.avatar {
  display: inline-grid; place-items: center; flex-shrink: 0;
  width: 2.25rem; height: 2.25rem; border-radius: 50%;
  background: var(--secondary); color: var(--primary);
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.02em;
}
.avatar-sm { width: 1.75rem; height: 1.75rem; font-size: 0.65rem; }
.avatar-lg { width: 3.5rem; height: 3.5rem; font-size: 1rem; }
.avatar-xl { width: 5rem; height: 5rem; font-size: 1.5rem; border-radius: 1.25rem; }
.condo-avatar { border-radius: 0.75rem; background: var(--condo-color, var(--primary)); color: #fff; }

.tone-green { background: var(--tone-green-bg); color: var(--tone-green-fg); }
.tone-blue { background: var(--tone-blue-bg); color: var(--tone-blue-fg); }
.tone-purple { background: var(--tone-purple-bg); color: var(--tone-purple-fg); }
.tone-orange { background: var(--tone-orange-bg); color: var(--tone-orange-fg); }
.tone-yellow { background: var(--tone-yellow-bg); color: var(--tone-yellow-fg); }

/* 7. Cards e KPIs ------------------------------------------------------------ */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-xl); min-width: 0; }
.card-body { padding: 1.25rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.card-head h2, .card-head h3, .card-title { font-size: 0.9375rem; font-weight: 600; }
.card-head p { font-size: 0.8125rem; color: var(--muted-fg); }
.card-foot { padding: 0.85rem 1.25rem; border-top: 1px solid var(--border); background: #fcfbf8; border-radius: 0 0 var(--radius-xl) var(--radius-xl); }
.card-flush { overflow: hidden; }
.card-link { display: block; color: inherit; transition: box-shadow 0.15s, border-color 0.15s; }
.card-link:hover { text-decoration: none; border-color: #d4d8d1; box-shadow: var(--shadow); }
.card-muted { background: var(--muted); border-color: transparent; }

.kpi-grid { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1023.98px) { .kpi-grid > :last-child:nth-child(odd) { grid-column: 1 / -1; } }
@media (min-width: 1024px) { .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } .kpi-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.kpi { display: flex; flex-direction: column; gap: 0.75rem; padding: 1.25rem; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-xl); transition: box-shadow 0.2s; min-width: 0; }
.kpi:hover { box-shadow: var(--shadow-sm); }
.kpi-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; }
.kpi-icon { display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: var(--radius); }
.kpi-value { font-size: 1.6rem; font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; }
.kpi-label { font-size: 0.8125rem; font-weight: 500; color: var(--muted-fg); margin-top: 0.15rem; }
.kpi-sub { font-size: 0.75rem; color: var(--muted-fg); margin-top: 0.25rem; }
.trend { display: inline-flex; align-items: center; gap: 0.2rem; padding: 0.1rem 0.5rem; border-radius: 999px; font-size: 0.7rem; font-weight: 600; white-space: nowrap; }
.trend.up { background: #dce9df; color: #2d5c3d; }
.trend.down { background: #f8e5d8; color: #8b3a1a; }
.trend.flat { background: var(--muted); color: var(--muted-fg); }

.insight-list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.insight-list li { display: flex; align-items: center; gap: 0.75rem; padding: 0.8rem 0; border-bottom: 1px dashed var(--border); font-size: 0.875rem; }
.insight-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.insight-list li:first-child { padding-top: 0; }
.insight-list .icon-box { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 0.6rem; flex-shrink: 0; }
.insight-list strong { margin-left: auto; font-weight: 700; white-space: nowrap; }

.progress { height: 0.45rem; border-radius: 999px; background: var(--muted); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--primary); }

/* 8. Gráficos (CSS puro, dados vindos do servidor) ------------------------- */
.bar-chart { display: flex; align-items: flex-end; gap: 0.5rem; height: 11rem; padding-top: 1.25rem; }
.bar-chart.dense { gap: 0.3rem; }
.bar { position: relative; flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; min-width: 0; }
.bar-fill { width: 100%; max-width: 2rem; min-height: 3px; height: var(--h, 0%); border-radius: 6px 6px 2px 2px; background: var(--primary); opacity: 0.85; transition: opacity 0.15s, height 0.6s var(--ease); }
.bar.is-today .bar-fill { opacity: 1; background: linear-gradient(180deg, #6b9a7e, var(--primary)); }
.bar:hover .bar-fill { opacity: 1; }
.bar-value { position: absolute; top: calc(100% - var(--h, 0%) - 1.25rem); font-size: 0.7rem; font-weight: 600; color: var(--muted-fg); opacity: 0; transition: opacity 0.15s; }
.bar:hover .bar-value, .bar.is-today .bar-value { opacity: 1; }
.bar-labels { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.bar-chart.dense + .bar-labels { gap: 0.3rem; }
.bar-labels span { flex: 1; text-align: center; font-size: 0.7rem; color: var(--muted-fg); text-transform: capitalize; min-width: 0; overflow: hidden; }
.bar-labels span.is-today { color: var(--foreground); font-weight: 700; }

.donut-wrap { display: grid; gap: 1rem; justify-items: center; }
.donut { position: relative; width: 9.5rem; aspect-ratio: 1; border-radius: 50%; background: var(--gradient, var(--muted)); }
.donut::after { content: ""; position: absolute; inset: 1.4rem; border-radius: 50%; background: var(--card); }
.donut-center { position: absolute; inset: 0; z-index: 1; display: grid; place-content: center; text-align: center; }
.donut-center strong { font-size: 1.4rem; line-height: 1; }
.donut-center span { font-size: 0.7rem; color: var(--muted-fg); }
.legend { display: grid; gap: 0.4rem; width: 100%; margin: 0; padding: 0; list-style: none; }
.legend li { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; }
.legend .swatch { width: 0.6rem; height: 0.6rem; border-radius: 50%; flex-shrink: 0; background: var(--c); }
.legend .label { color: var(--muted-fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend .value { margin-left: auto; font-weight: 600; }
.legend .pct { width: 2.6rem; text-align: right; color: var(--muted-fg); font-size: 0.72rem; }

.hbar-list { display: grid; gap: 0.85rem; margin: 0; padding: 0; list-style: none; }
.hbar-list li { display: grid; gap: 0.35rem; font-size: 0.8125rem; }

/* 9. Tabelas e listas -------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.table th { padding: 0.75rem 1rem; text-align: left; font-size: 0.75rem; font-weight: 600; color: var(--muted-fg); text-transform: uppercase; letter-spacing: 0.04em; background: #faf8f4; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 0.85rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th:first-child, .table td:first-child { padding-left: 1.25rem; }
.table th:last-child, .table td:last-child { padding-right: 1.25rem; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background 0.12s; }
.table tbody tr:hover { background: #fcfbf8; }
.table tr.is-clickable { cursor: pointer; }
.table .cell-main { font-weight: 600; color: var(--foreground); }
.table .cell-sub { display: block; font-size: 0.75rem; color: var(--muted-fg); font-weight: 400; }
.table .cell-actions { text-align: right; white-space: nowrap; }
.table .cell-actions .row-wrap { justify-content: flex-end; flex-wrap: nowrap; }

/* Abaixo de 720px a mesma tabela vira lista de cartões (td[data-label]). */
@media (max-width: 719.98px) {
  .table-responsive thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table-responsive, .table-responsive tbody, .table-responsive tr, .table-responsive td { display: block; width: 100%; }
  .table-responsive tr { padding: 0.9rem 1.1rem; border-bottom: 1px solid var(--border); }
  .table-responsive tbody tr:last-child { border-bottom: 0; }
  .table-responsive td { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.2rem 0 !important; border: 0; text-align: right; }
  .table-responsive td::before { content: attr(data-label); font-size: 0.75rem; font-weight: 500; color: var(--muted-fg); text-align: left; flex-shrink: 0; }
  .table-responsive td.cell-primary { display: block; text-align: left; margin-bottom: 0.3rem; }
  .table-responsive td.cell-primary::before, .table-responsive td:not([data-label])::before { display: none; }
  .table-responsive td.cell-actions { justify-content: flex-end; padding-top: 0.6rem !important; }
}

.list { margin: 0; padding: 0; list-style: none; }
.list-item { display: flex; align-items: center; gap: 0.85rem; padding: 0.85rem 1.25rem; border-bottom: 1px solid var(--border); color: inherit; }
.list-item:last-child { border-bottom: 0; }
a.list-item:hover { background: #fcfbf8; text-decoration: none; }

.dl { display: grid; gap: 0.85rem; margin: 0; }
.dl > div { display: grid; gap: 0.1rem; }
.dl dt { font-size: 0.75rem; color: var(--muted-fg); font-weight: 500; }
.dl dd { margin: 0; font-size: 0.875rem; font-weight: 600; overflow-wrap: anywhere; }
.dl-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.empty { display: grid; justify-items: center; gap: 0.5rem; padding: 3rem 1.5rem; text-align: center; color: var(--muted-fg); }
.empty-icon { display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: 1rem; background: var(--muted); color: var(--muted-fg); margin-bottom: 0.25rem; }
.empty h3 { color: var(--foreground); font-size: 0.9375rem; }
.empty p { font-size: 0.8125rem; max-width: 22rem; }

/* 10. Página, toolbar e paginação -------------------------------------------- */
.page { width: 100%; max-width: 72rem; margin: 0 auto; padding: 1.5rem 1rem 3rem; display: grid; gap: 1.75rem; align-content: start; }
@media (min-width: 640px) { .page { padding: 2rem 1.5rem 3.5rem; } }
.page-narrow { max-width: 48rem; }
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; }
.page-header h1 { font-size: 1.5rem; }
.page-header p { color: var(--muted-fg); margin-top: 0.25rem; font-size: 0.9rem; }
.page-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.eyebrow { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--primary); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.85rem; }
.section-head h2 { font-size: 1rem; font-weight: 600; }
.back-link { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.8125rem; font-weight: 600; color: var(--muted-fg); }
.back-link:hover { color: var(--foreground); text-decoration: none; }

.toolbar { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.toolbar .search { flex: 1 1 16rem; }
.toolbar select.control { width: auto; flex: 0 1 12rem; }
@media (max-width: 639.98px) { .toolbar select.control { flex: 1 1 40%; min-width: 0; } .toolbar .btn { flex: 1 1 auto; } }
.toolbar-meta { display: flex; align-items: center; justify-content: space-between; gap: 1rem; font-size: 0.8125rem; color: var(--muted-fg); }
.results { position: relative; transition: opacity 0.15s; }
.results.htmx-request, .htmx-request > .results { opacity: 0.55; pointer-events: none; }

.tabs { display: flex; gap: 0.25rem; padding: 0.25rem; border-radius: var(--radius); background: var(--muted); width: fit-content; max-width: 100%; overflow-x: auto; }
.tabs a, .tabs button { padding: 0.4rem 0.85rem; border: 0; border-radius: 0.55rem; background: none; font-size: 0.8125rem; font-weight: 600; color: var(--muted-fg); white-space: nowrap; }
.tabs a:hover { text-decoration: none; color: var(--foreground); }
.tabs [aria-current="true"], .tabs [aria-selected="true"] { background: var(--card); color: var(--foreground); box-shadow: var(--shadow-sm); }

.pagination { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.85rem 1.25rem; border-top: 1px solid var(--border); font-size: 0.8125rem; color: var(--muted-fg); }
.pagination .row-wrap { gap: 0.35rem; }

.callout { display: flex; gap: 0.75rem; padding: 0.9rem 1rem; border-radius: var(--radius); border: 1px solid; font-size: 0.8125rem; line-height: 1.5; }
.callout .icon { margin-top: 0.1rem; }
.callout strong { display: block; font-size: 0.875rem; margin-bottom: 0.1rem; }
.callout-info { background: #eef4fa; border-color: #c6d8ea; color: #2f5a85; }
.callout-warning { background: #fbf6e2; border-color: #e8d87a; color: #7a6526; }
.callout-success { background: #eef6f0; border-color: #b8d6c0; color: #2d5c3d; }
.callout-danger { background: #fbefe8; border-color: #efc9b5; color: #8b3a1a; }

.code-block { position: relative; margin: 0; padding: 1rem 1.1rem; border-radius: var(--radius); background: var(--code-bg); color: var(--code-fg); font-size: 0.78rem; line-height: 1.6; overflow: auto; max-height: 26rem; white-space: pre; tab-size: 2; }
.code-inline { padding: 0.1rem 0.4rem; border-radius: 0.35rem; background: var(--muted); font-size: 0.8em; overflow-wrap: anywhere; }

.accordion { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card); overflow: hidden; }
.accordion + .accordion { margin-top: 0.75rem; }
.accordion > summary { display: flex; align-items: center; gap: 0.85rem; padding: 1rem 1.25rem; cursor: pointer; list-style: none; }
.accordion > summary::-webkit-details-marker { display: none; }
.accordion > summary .chev { margin-left: auto; color: var(--muted-fg); transition: transform 0.2s; }
.accordion[open] > summary .chev { transform: rotate(180deg); }
.accordion[open] > summary { border-bottom: 1px solid var(--border); }
.accordion-body { padding: 1rem 1.25rem 1.25rem; display: grid; gap: 0.85rem; }

.steps { display: grid; gap: 0.9rem; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { display: flex; gap: 0.85rem; font-size: 0.875rem; counter-increment: step; }
.steps li::before { content: counter(step); display: grid; place-items: center; width: 1.75rem; height: 1.75rem; border-radius: 50%; background: var(--secondary); color: var(--primary); font-weight: 700; font-size: 0.8rem; flex-shrink: 0; }

/* 11. Modal, drawer, toasts, notificações ------------------------------------- */
dialog { padding: 0; border: 0; color: inherit; background: transparent; max-width: none; max-height: none; }
dialog::backdrop { background: rgb(28 36 32 / 0.45); backdrop-filter: blur(2px); }
body:has(dialog[open]) { overflow: hidden; }

.modal { width: min(36rem, calc(100% - 2rem)); margin: auto; }
.modal-sm { width: min(26rem, calc(100% - 2rem)); }
.modal-panel { display: flex; flex-direction: column; max-height: calc(100dvh - 2rem); background: var(--card); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); overflow: hidden; }
.modal[open] .modal-panel { animation: modal-in 0.22s var(--ease); }
.modal-head { display: flex; align-items: flex-start; gap: 0.85rem; padding: 1.25rem 1.25rem 0.75rem; }
.modal-head h2 { font-size: 1.1rem; }
.modal-head p { font-size: 0.8125rem; color: var(--muted-fg); margin-top: 0.15rem; }
.modal-head .btn-icon { margin-left: auto; margin-top: -0.35rem; margin-right: -0.4rem; }
.modal-body { padding: 0.5rem 1.25rem 1.25rem; overflow-y: auto; }
.modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.5rem; padding: 1rem 1.25rem; border-top: 1px solid var(--border); background: #fcfbf8; }
.modal-form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.modal-icon { display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: var(--radius); flex-shrink: 0; }
@media (max-width: 639.98px) {
  .modal { width: 100%; margin: auto 0 0; }
  .modal-panel { border-radius: var(--radius-xl) var(--radius-xl) 0 0; max-height: 92dvh; }
  .modal[open] .modal-panel { animation-name: sheet-in; }
  .modal-foot .btn { flex: 1; }
}
.modal-loading { display: grid; place-items: center; min-height: 10rem; color: var(--muted-fg); }
.modal-loading .icon { animation: spin 0.8s linear infinite; }

.drawer { width: min(32rem, 100%); height: 100dvh; margin: 0 0 0 auto; }
.drawer-panel { display: flex; flex-direction: column; height: 100%; background: var(--background); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg); }
.drawer[open] .drawer-panel { animation: drawer-in 0.28s var(--ease); }
.drawer-head { display: flex; align-items: flex-start; gap: 0.85rem; padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--border); background: var(--card); }
.drawer-head h2 { font-size: 1.05rem; }
.drawer-head .btn-icon { margin-left: auto; }
.drawer-body { flex: 1; overflow-y: auto; padding: 1.25rem; display: grid; gap: 1.25rem; align-content: start; }

@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
@keyframes sheet-in { from { transform: translateY(100%); } }
@keyframes drawer-in { from { transform: translateX(100%); } }

.toasts { position: fixed; z-index: 100; right: 1rem; bottom: 1rem; display: grid; gap: 0.6rem; width: min(24rem, calc(100% - 2rem)); pointer-events: none; }
@media (max-width: 639.98px) { .toasts { left: 1rem; right: 1rem; bottom: auto; top: 0.75rem; width: auto; } }
.toast { display: flex; align-items: flex-start; gap: 0.75rem; padding: 0.85rem 0.9rem; border-radius: var(--radius-lg); background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow-lg); pointer-events: auto; animation: toast-in 0.3s var(--ease); }
.toast.is-leaving { animation: toast-out 0.2s ease forwards; }
.toast-icon { display: grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 0.6rem; flex-shrink: 0; }
.toast-success .toast-icon { background: var(--tone-green-bg); color: var(--tone-green-fg); }
.toast-error .toast-icon { background: var(--tone-orange-bg); color: #8b3a1a; }
.toast-warning .toast-icon { background: var(--tone-yellow-bg); color: var(--tone-yellow-fg); }
.toast-info .toast-icon { background: var(--tone-blue-bg); color: var(--tone-blue-fg); }
.toast-text { flex: 1; min-width: 0; padding-top: 0.15rem; }
.toast-title { font-size: 0.875rem; font-weight: 600; }
.toast-message { font-size: 0.8125rem; color: var(--muted-fg); margin-top: 0.1rem; }
.toast-close { margin: -0.25rem -0.25rem 0 0; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(0.97); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(16px); } }

.notify { position: relative; }
.notify > summary { list-style: none; }
.notify > summary::-webkit-details-marker { display: none; }
.notify-count { position: absolute; top: -0.15rem; right: -0.15rem; min-width: 1.1rem; height: 1.1rem; padding: 0 0.3rem; border-radius: 999px; background: #d86a3d; color: #fff; font-size: 0.65rem; font-weight: 700; line-height: 1.1rem; text-align: center; border: 2px solid var(--background); }
.notify-panel { position: absolute; right: 0; top: calc(100% + 0.5rem); z-index: 40; width: min(22rem, calc(100vw - 2rem)); background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden; animation: modal-in 0.18s var(--ease); }
.notify-panel header { display: flex; align-items: center; justify-content: space-between; padding: 0.85rem 1rem; border-bottom: 1px solid var(--border); font-size: 0.875rem; font-weight: 600; }
.notify-panel .list { max-height: 22rem; overflow-y: auto; }
.notify-panel .list-item { padding: 0.75rem 1rem; font-size: 0.8125rem; }
.notify-panel footer { padding: 0.65rem 1rem; border-top: 1px solid var(--border); text-align: center; font-size: 0.8125rem; }

/* 12. Shell: sidebar + topbar ------------------------------------------------- */
.shell { display: flex; min-height: 100dvh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 50; display: flex; flex-direction: column; width: var(--sidebar-width); background: var(--sidebar); border-right: 1px solid var(--border); transform: translateX(-100%); transition: transform 0.3s var(--ease); }
.sidebar.is-open { transform: none; box-shadow: var(--shadow-lg); }
.sidebar-overlay { position: fixed; inset: 0; z-index: 45; background: rgb(0 0 0 / 0.3); opacity: 0; pointer-events: none; transition: opacity 0.25s; }
.sidebar.is-open + .sidebar-overlay { opacity: 1; pointer-events: auto; }
@media (min-width: 1024px) {
  .sidebar { position: sticky; top: 0; height: 100dvh; transform: none; flex-shrink: 0; }
  .sidebar.is-open { box-shadow: none; }
  .sidebar-overlay, .sidebar .sidebar-close, .topbar .menu-toggle { display: none; }
}
.sidebar-head { display: flex; align-items: center; gap: 0.75rem; padding: 1rem; border-bottom: 1px solid var(--border); min-height: 4.25rem; }
.sidebar-brand { display: flex; align-items: center; gap: 0.75rem; min-width: 0; flex: 1; color: inherit; }
.sidebar-brand:hover { text-decoration: none; }
.sidebar-brand strong { display: block; font-size: 0.875rem; line-height: 1.25; }
.sidebar-brand small { display: block; font-size: 0.68rem; color: var(--muted-fg); }
.brand-mark { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 0.75rem; background: var(--primary); color: #fff; flex-shrink: 0; }
.sidebar-switch { padding: 0.75rem 0.75rem 0; }
.sidebar-switch select { font-size: 0.8125rem; min-height: 2.35rem; background-color: var(--card); }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 0.75rem; display: grid; gap: 0.15rem; align-content: start; }
.nav-section { padding: 0.9rem 0.75rem 0.35rem; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: #9aa19c; }
.nav-link { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0.75rem; border-radius: var(--radius); font-size: 0.875rem; font-weight: 500; color: var(--muted-fg); transition: background 0.15s, color 0.15s; }
.nav-link:hover { background: var(--sidebar-accent); color: var(--foreground); text-decoration: none; }
.nav-link[aria-current="page"] { background: var(--sidebar-accent); color: var(--foreground); font-weight: 600; }
.nav-link[aria-current="page"] .icon { color: var(--primary); }
.nav-link .nav-badge { margin-left: auto; }
.nav-link .icon-ext { margin-left: auto; opacity: 0.5; }
.sidebar-foot { padding: 0.75rem; border-top: 1px solid var(--border); }
.user-card { display: flex; align-items: center; gap: 0.75rem; padding: 0.55rem 0.6rem; border-radius: var(--radius); }
.user-card:hover { background: var(--sidebar-accent); }
.user-card strong { display: block; font-size: 0.85rem; font-weight: 600; }
.user-card small { display: block; font-size: 0.72rem; color: var(--muted-fg); }
.user-card .btn-icon:hover { color: var(--destructive); background: transparent; }

.shell-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 0.75rem; height: var(--topbar-height); padding: 0 1rem; border-bottom: 1px solid var(--border); background: rgb(250 249 246 / 0.88); backdrop-filter: saturate(1.4) blur(8px); }
@media (min-width: 640px) { .topbar { padding: 0 1.5rem; } }
.topbar-title { font-size: 0.875rem; font-weight: 600; min-width: 0; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; }
.topbar-link { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.8rem; font-weight: 600; }
@media (max-width: 479.98px) { .topbar-link span { display: none; } }
.shell-content { flex: 1; }

/* 13. Landing ----------------------------------------------------------------- */
.landing { overflow-x: clip; }
.container { width: 100%; max-width: 72rem; margin: 0 auto; padding: 0 1.25rem; }
.site-nav { position: sticky; top: 0; z-index: 40; border-bottom: 1px solid transparent; background: rgb(250 249 246 / 0.85); backdrop-filter: saturate(1.4) blur(10px); transition: border-color 0.2s; }
.site-nav.is-scrolled { border-bottom-color: var(--border); }
.site-nav .container { display: flex; align-items: center; gap: 1.5rem; height: 4rem; }
.site-brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 700; color: var(--foreground); }
.site-brand:hover { text-decoration: none; }
.site-links { display: none; gap: 1.5rem; font-size: 0.875rem; font-weight: 500; }
.site-links a { color: var(--muted-fg); }
.site-links a:hover { color: var(--foreground); text-decoration: none; }
@media (min-width: 900px) { .site-links { display: flex; } }
.site-nav .actions { margin-left: auto; display: flex; gap: 0.5rem; align-items: center; }
@media (max-width: 479.98px) { .site-nav .actions .btn-ghost { display: none; } }

.hero { position: relative; padding: 3.5rem 0 4rem; }
@media (min-width: 900px) { .hero { padding: 5rem 0 6rem; } }
.hero::before { content: ""; position: absolute; inset: -10rem -20rem auto auto; width: 40rem; height: 40rem; border-radius: 50%; background: radial-gradient(circle, rgb(220 233 223 / 0.9), transparent 65%); z-index: -1; }
.hero-grid { display: grid; gap: 3rem; align-items: center; }
@media (min-width: 900px) { .hero-grid { grid-template-columns: 1.1fr 0.9fr; } }
.hero h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); line-height: 1.08; letter-spacing: -0.03em; margin: 1rem 0 1.1rem; }
.hero-lead { font-size: 1.075rem; color: var(--muted-fg); max-width: 34rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2rem; }
.hero-checks { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; margin: 1.5rem 0 0; padding: 0; list-style: none; font-size: 0.8125rem; color: var(--muted-fg); }
.hero-checks li { display: inline-flex; align-items: center; gap: 0.35rem; }
.hero-checks .icon { color: var(--primary); }
.pill { display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.3rem 0.8rem 0.3rem 0.35rem; border-radius: 999px; background: var(--card); border: 1px solid var(--border); font-size: 0.8rem; font-weight: 600; box-shadow: var(--shadow-sm); }
.pill > span:first-child { padding: 0.1rem 0.5rem; border-radius: 999px; background: var(--secondary); color: var(--primary); font-size: 0.7rem; }

.mock-phone { position: relative; max-width: 22rem; margin: 0 auto; padding: 0.75rem; border-radius: 2.25rem; background: var(--foreground); box-shadow: var(--shadow-lg); }
.mock-phone-screen { border-radius: 1.7rem; background: var(--background); overflow: hidden; }
.mock-phone-head { display: flex; align-items: center; gap: 0.6rem; padding: 1.1rem 1rem 0.85rem; background: var(--card); border-bottom: 1px solid var(--border); }
.mock-phone-body { display: grid; gap: 0.6rem; padding: 1rem; font-size: 0.8rem; }
.mock-float { position: absolute; display: flex; align-items: center; gap: 0.6rem; padding: 0.65rem 0.85rem; border-radius: var(--radius-lg); background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow); font-size: 0.75rem; animation: float 6s ease-in-out infinite; }
.mock-float strong { display: block; font-size: 0.8rem; }
.mock-float.top { top: 12%; left: -3.5rem; }
.mock-float.bottom { bottom: 14%; right: -3rem; animation-delay: -3s; }
@media (max-width: 1099.98px) { .mock-float { display: none; } }
@keyframes float { 50% { transform: translateY(-8px); } }

.stats-band { border-block: 1px solid var(--border); background: var(--card); }
.stats-band .container { display: grid; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 768px) { .stats-band .container { grid-template-columns: repeat(4, 1fr); } }
.stat { padding: 1.75rem 1rem; text-align: center; }
.stat + .stat { border-left: 1px solid var(--border); }
@media (max-width: 767.98px) { .stat:nth-child(3) { border-left: 0; } .stat:nth-child(n + 3) { border-top: 1px solid var(--border); } }
.stat strong { display: block; font-family: var(--font-serif); font-weight: 400; font-size: 2.1rem; line-height: 1; color: var(--primary); }
.stat span { display: block; margin-top: 0.4rem; font-size: 0.8125rem; color: var(--muted-fg); }

.section { padding: 4.5rem 0; }
@media (min-width: 900px) { .section { padding: 6rem 0; } }
.section-muted { background: var(--muted); }
.section-dark { background: var(--foreground); color: #e9eee9; }
.section-intro { max-width: 40rem; margin: 0 auto 3rem; text-align: center; }
.section-intro h2 { font-size: clamp(1.7rem, 3.5vw, 2.4rem); letter-spacing: -0.02em; margin: 0.75rem 0; }
.section-intro p { color: var(--muted-fg); font-size: 1rem; }
.section-dark .section-intro p { color: #a9b5ad; }

.flow { display: grid; gap: 1rem; counter-reset: flow; }
@media (min-width: 768px) { .flow { grid-template-columns: repeat(4, 1fr); } }
.flow-step { position: relative; padding: 1.5rem; border-radius: var(--radius-xl); background: var(--card); border: 1px solid var(--border); counter-increment: flow; }
.flow-step::before { content: "0" counter(flow); position: absolute; top: 1.25rem; right: 1.25rem; font-family: var(--font-serif); font-size: 1.6rem; color: #d5dcd6; }
.flow-step h3 { font-size: 1rem; margin: 1rem 0 0.4rem; }
.flow-step p { font-size: 0.875rem; color: var(--muted-fg); }

.feature-grid { display: grid; gap: 1rem; }
@media (min-width: 640px) { .feature-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .feature-grid { grid-template-columns: repeat(3, 1fr); } }
.feature { padding: 1.5rem; border-radius: var(--radius-xl); background: var(--card); border: 1px solid var(--border); transition: transform 0.2s var(--ease), box-shadow 0.2s; }
.feature:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.feature h3 { font-size: 1rem; margin: 1rem 0 0.4rem; }
.feature p { font-size: 0.875rem; color: var(--muted-fg); }

.showcase { display: grid; gap: 2.5rem; align-items: center; }
@media (min-width: 900px) { .showcase { grid-template-columns: 0.9fr 1.1fr; gap: 4rem; } }
.showcase h2 { font-size: clamp(1.7rem, 3.5vw, 2.3rem); letter-spacing: -0.02em; margin: 0.75rem 0 1rem; }
.check-list { display: grid; gap: 0.85rem; margin: 1.5rem 0 0; padding: 0; list-style: none; }
.check-list li { display: flex; gap: 0.75rem; font-size: 0.9rem; }
.check-list .icon-box { display: grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--secondary); color: var(--primary); flex-shrink: 0; }
.mock-dashboard { padding: 1.25rem; border-radius: var(--radius-xl); background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow-lg); display: grid; gap: 1rem; }
.mock-dashboard .kpi { padding: 0.9rem; gap: 0.5rem; }
.mock-dashboard .kpi-value { font-size: 1.25rem; }
.mock-dashboard .kpi-icon { width: 2rem; height: 2rem; }

.audience { display: grid; gap: 1rem; }
@media (min-width: 768px) { .audience { grid-template-columns: repeat(3, 1fr); } }
.audience-card { padding: 1.75rem; border-radius: var(--radius-xl); background: rgb(255 255 255 / 0.04); border: 1px solid rgb(255 255 255 / 0.1); }
.audience-card h3 { font-size: 1.05rem; margin: 1rem 0 0.75rem; color: #fff; }
.audience-card ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.5rem; font-size: 0.875rem; color: #a9b5ad; }
.audience-card li { display: flex; gap: 0.5rem; }
.audience-card li .icon { color: #8bc49a; margin-top: 0.2rem; }
.audience-card .kpi-icon { background: rgb(220 233 223 / 0.12); color: #a8d0b4; }

.faq { max-width: 46rem; margin: 0 auto; display: grid; gap: 0.75rem; }
.faq .accordion + .accordion { margin-top: 0; }
.faq summary { font-weight: 600; font-size: 0.9375rem; }
.faq .accordion-body { color: var(--muted-fg); font-size: 0.9rem; }

.cta { position: relative; overflow: hidden; padding: 3rem 1.5rem; border-radius: 1.75rem; background: var(--primary); color: #fff; text-align: center; }
.cta::before, .cta::after { content: ""; position: absolute; border-radius: 50%; border: 1px solid rgb(255 255 255 / 0.14); }
.cta::before { width: 26rem; height: 26rem; top: -12rem; left: -8rem; }
.cta::after { width: 20rem; height: 20rem; bottom: -12rem; right: -6rem; }
.cta h2 { font-size: clamp(1.7rem, 3.5vw, 2.4rem); position: relative; }
.cta h2 em { color: #dce9df; }
.cta p { position: relative; margin: 0.75rem auto 1.75rem; max-width: 32rem; color: #dce9df; }
.cta .row-wrap { position: relative; justify-content: center; }
.cta .btn-light { --btn-bg: #fff; --btn-fg: var(--primary); --btn-border: #fff; }
.cta .btn-light:hover { background: #f0f5f1; }
.cta .btn-ghost-light { --btn-bg: transparent; --btn-fg: #fff; --btn-border: rgb(255 255 255 / 0.4); }
.cta .btn-ghost-light:hover { background: rgb(255 255 255 / 0.1); }

.site-footer { padding: 2.5rem 0; border-top: 1px solid var(--border); font-size: 0.8125rem; color: var(--muted-fg); }
.site-footer .container { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; }
.demo-links { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* 14. Login / cadastro ---------------------------------------------------------- */
.auth { display: grid; min-height: 100dvh; }
@media (min-width: 1024px) { .auth { grid-template-columns: 1fr 1fr; } }
.auth-brand { position: relative; display: none; overflow: hidden; padding: 3rem; background: var(--primary); color: #fff; }
@media (min-width: 1024px) { .auth-brand { display: flex; flex-direction: column; justify-content: space-between; } }
.auth-brand::before, .auth-brand::after { content: ""; position: absolute; border-radius: 50%; border: 1px solid rgb(255 255 255 / 0.12); }
.auth-brand::before { width: 34rem; height: 34rem; top: -14rem; right: -14rem; }
.auth-brand::after { width: 26rem; height: 26rem; bottom: -10rem; left: -10rem; background: rgb(255 255 255 / 0.04); }
.auth-brand > * { position: relative; z-index: 1; }
.auth-brand .site-brand { color: #fff; }
.auth-brand .brand-mark { background: rgb(255 255 255 / 0.15); }
.auth-brand h2 { font-size: 2.4rem; line-height: 1.12; letter-spacing: -0.02em; max-width: 26rem; }
.auth-brand h2 em { color: #dce9df; }
.auth-brand p { margin-top: 1rem; max-width: 26rem; color: #dce9df; }
.auth-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
.auth-stats div { padding: 1rem 1.1rem; border-radius: var(--radius-lg); background: rgb(255 255 255 / 0.08); border: 1px solid rgb(255 255 255 / 0.12); }
.auth-stats strong { display: block; font-family: var(--font-serif); font-weight: 400; font-size: 1.6rem; line-height: 1.1; }
.auth-stats span { font-size: 0.78rem; color: #dce9df; }
.auth-main { display: flex; flex-direction: column; justify-content: center; padding: 2rem 1.25rem; }
.auth-card { width: 100%; max-width: 25rem; margin: 0 auto; display: grid; gap: 1.5rem; }
.auth-card h1 { font-size: 1.6rem; }
.auth-card .lead { color: var(--muted-fg); margin-top: 0.35rem; font-size: 0.9rem; }
.auth-mobile-brand { display: flex; justify-content: center; }
@media (min-width: 1024px) { .auth-mobile-brand { display: none; } }
.divider { display: flex; align-items: center; gap: 0.75rem; font-size: 0.75rem; color: var(--muted-fg); }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.demo-accounts { display: grid; gap: 0.5rem; }
.demo-account { display: flex; align-items: center; gap: 0.75rem; width: 100%; padding: 0.65rem 0.8rem; border: 1px dashed #d4d8d1; border-radius: var(--radius); background: transparent; text-align: left; font-size: 0.8125rem; transition: background 0.15s, border-color 0.15s; }
.demo-account:hover { background: var(--card); border-color: var(--primary); }
.demo-account strong { display: block; font-size: 0.8125rem; }
.demo-account small { color: var(--muted-fg); font-size: 0.75rem; }

/* 15. Portaria pública e chat --------------------------------------------------- */
.visitor { min-height: 100dvh; display: flex; flex-direction: column; background: var(--background); }
.visitor-head { padding: 2.25rem 1.25rem 1.5rem; text-align: center; background: linear-gradient(180deg, color-mix(in srgb, var(--condo-color, var(--primary)) 12%, var(--background)), var(--background)); }
.visitor-head .avatar-xl { margin: 0 auto 1rem; box-shadow: var(--shadow); }
.visitor-head h1 { font-size: 1.35rem; }
.visitor-head .location { display: inline-flex; align-items: center; gap: 0.3rem; margin-top: 0.35rem; font-size: 0.8125rem; color: var(--muted-fg); }
.visitor-body { flex: 1; width: 100%; max-width: 30rem; margin: 0 auto; padding: 0 1.25rem 2.5rem; display: grid; gap: 1.25rem; align-content: start; }
.welcome { display: flex; gap: 0.75rem; padding: 1rem; border-radius: var(--radius-lg); background: var(--card); border: 1px solid var(--border); font-size: 0.875rem; }
.welcome strong { display: block; margin-bottom: 0.15rem; }
.visitor-foot { padding: 1.25rem; text-align: center; font-size: 0.75rem; color: var(--muted-fg); }

.combo { position: relative; }
.combo-list { position: absolute; left: 0; right: 0; top: calc(100% + 0.35rem); z-index: 20; max-height: 15rem; overflow-y: auto; margin: 0; padding: 0.35rem; list-style: none; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.combo-list li { display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem 0.7rem; border-radius: var(--radius-sm); font-size: 0.875rem; cursor: pointer; }
.combo-list li:hover, .combo-list li[aria-selected="true"] { background: var(--secondary); }
.combo-list .combo-empty { color: var(--muted-fg); cursor: default; }
.combo-list .combo-empty:hover { background: none; }
.combo-selected { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0.6rem 0.6rem 0.85rem; border: 1px solid var(--primary); border-radius: var(--radius); background: #f1f7f2; }
.combo-selected strong { font-size: 0.9rem; }

.chat { height: 100dvh; display: flex; flex-direction: column; background: var(--background); }
.chat-head { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; background: var(--card); border-bottom: 1px solid var(--border); }
.chat-head strong { display: block; font-size: 0.9rem; }
.chat-head > .grow { min-width: 0; }
.chat-head small { display: block; font-size: 0.72rem; color: var(--muted-fg); }
.chat-head small::before { content: ""; display: inline-block; vertical-align: middle; width: 0.45rem; height: 0.45rem; margin: -0.1rem 0.3rem 0 0; border-radius: 50%; background: #3fb36b; }
.chat-head .badge { margin-left: auto; flex-shrink: 0; }
.chat-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.chat-thread { width: 100%; max-width: 40rem; margin: 0 auto; padding: 1.25rem 1rem; display: grid; gap: 0.75rem; align-content: start; }
.chat-day { justify-self: center; padding: 0.2rem 0.7rem; border-radius: 999px; background: var(--muted); font-size: 0.7rem; color: var(--muted-fg); }
.msg { display: flex; align-items: flex-end; gap: 0.5rem; max-width: 85%; animation: msg-in 0.25s var(--ease); }
.msg-bubble { padding: 0.65rem 0.9rem; border-radius: 1.1rem; font-size: 0.875rem; line-height: 1.45; white-space: pre-line; overflow-wrap: anywhere; }
.msg-meta { display: block; margin-top: 0.25rem; font-size: 0.66rem; opacity: 0.7; }
.msg-concierge .msg-bubble { background: var(--card); border: 1px solid var(--border); border-bottom-left-radius: 0.35rem; }
.msg-resident .msg-bubble { background: #eae3f5; border: 1px solid #d0c4e8; border-bottom-left-radius: 0.35rem; }
.msg-resident .avatar { background: #d0c4e8; color: #6b4fa0; }
.msg-visitor { justify-self: end; flex-direction: row-reverse; }
.msg-visitor .msg-bubble { background: var(--primary); color: #fff; border-bottom-right-radius: 0.35rem; }
.msg-system { justify-self: center; max-width: 92%; }
.msg-system .msg-bubble { background: var(--muted); color: var(--muted-fg); font-size: 0.78rem; text-align: center; border-radius: 999px; padding: 0.35rem 0.85rem; }
.msg-label { display: block; font-size: 0.68rem; font-weight: 700; color: var(--muted-fg); margin-bottom: 0.15rem; }
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } }

.typing { display: inline-flex; gap: 0.25rem; padding: 0.85rem 1rem; }
.typing span { width: 0.42rem; height: 0.42rem; border-radius: 50%; background: var(--muted-fg); animation: typing 1.2s infinite ease-in-out; }
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-4px); opacity: 1; } }

.chat-dock { border-top: 1px solid var(--border); background: var(--card); padding-bottom: env(safe-area-inset-bottom); }
.chat-dock-inner { width: 100%; max-width: 40rem; margin: 0 auto; padding: 0.9rem 1rem; display: grid; gap: 0.75rem; }
.waiting-banner { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 0.9rem; border-radius: var(--radius); background: #fbf6e2; border: 1px solid #e8d87a; color: #7a6526; font-size: 0.8125rem; }
.waiting-banner .countdown { margin-left: auto; font-family: var(--font-mono); font-weight: 700; font-size: 0.9rem; }
.waiting-banner .progress { flex-basis: 100%; background: rgb(139 116 48 / 0.15); }
.waiting-banner .progress > span { background: #c9a93a; transition: width 1s linear; }
.waiting-banner { flex-wrap: wrap; }
.chat-timeout { display: grid; gap: 0.75rem; }
.whatsapp-card { display: grid; gap: 0.75rem; padding: 1rem; border-radius: var(--radius-lg); background: #e8f9ef; border: 1px solid #6fd49b; color: #1a7a3c; }
.whatsapp-card .row { gap: 0.6rem; }
.whatsapp-number { font-family: var(--font-mono); font-size: 1rem; font-weight: 700; color: #145c2d; }
.demo-panel { display: grid; gap: 0.5rem; padding: 0.75rem; border-radius: var(--radius); border: 1px dashed #e8d87a; background: #fffdf3; }
.demo-panel p { font-size: 0.75rem; color: #8b7430; font-weight: 600; }
.chat-done { text-align: center; display: grid; gap: 0.75rem; justify-items: center; padding: 0.5rem 0; }

/* Impressão: cartaz do QR Code ---------------------------------------------- */
.qr-poster { display: grid; justify-items: center; gap: 1rem; padding: 2rem 1.5rem; border-radius: var(--radius-xl); background: var(--card); border: 1px solid var(--border); text-align: center; }
.qr-poster img { width: min(15rem, 100%); height: auto; padding: 0.75rem; border-radius: var(--radius-lg); border: 1px solid var(--border); background: #fff; }
.qr-poster h2 { font-size: 1.15rem; }
@media print {
  .sidebar, .topbar, .no-print, .toasts { display: none !important; }
  body, .shell, .page { background: #fff; padding: 0; display: block; }
  .qr-poster { border: 0; page-break-inside: avoid; }
  .qr-poster img { width: 11cm; }
}
