:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --surface: rgba(255, 255, 255, 0.76);
  --surface-solid: #ffffff;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: rgba(29, 29, 31, 0.12);
  --line-strong: rgba(29, 29, 31, 0.2);
  --blue: #0a84ff;
  --green: #30a46c;
  --amber: #b26a00;
  --rose: #d92d5c;
  --indigo: #4f46e5;
  --cyan: #0f9fbc;
  --shadow: 0 24px 80px rgba(29, 29, 31, 0.11);
  --shadow-soft: 0 12px 34px rgba(29, 29, 31, 0.08);
  --radius: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 16% 0%, rgba(10, 132, 255, 0.12), transparent 25rem),
    radial-gradient(circle at 84% 8%, rgba(48, 164, 108, 0.10), transparent 25rem),
    linear-gradient(135deg, #f6f7fa 0%, #eef0f4 48%, #f7f4ef 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

textarea {
  resize: vertical;
}

.is-hidden {
  display: none !important;
}

.login-screen {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 480px);
  gap: 42px;
  align-items: center;
  min-height: 100vh;
  padding: 56px;
}

.login-copy h1 {
  max-width: 780px;
  margin: 14px 0 18px;
  font-size: clamp(42px, 6vw, 78px);
  line-height: 0.98;
  letter-spacing: 0;
}

.login-copy p {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
  font-size: 19px;
  line-height: 1.55;
}

.login-logo {
  width: 60px;
  height: 60px;
  margin-bottom: 18px;
}

.login-panel,
.intro-panel,
.surface,
.metric-card,
.dialog,
.building-card {
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.login-panel {
  display: grid;
  gap: 14px;
  padding: 22px;
}

.panel-heading h2,
.section-heading h3,
.dialog h3,
.topbar-title h1 {
  margin: 0;
  line-height: 1.08;
  letter-spacing: 0;
}

.panel-heading h2 {
  margin-top: 4px;
  font-size: 28px;
}

.login-option {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 14px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
}

.login-option:hover {
  border-color: rgba(10, 132, 255, 0.36);
  box-shadow: var(--shadow-soft);
}

.option-icon,
.nav-icon,
.metric-token,
.service-badge,
.doc-icon {
  display: grid;
  place-items: center;
  color: #ffffff;
  font-weight: 800;
}

.option-icon {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, #111113, var(--blue));
}

.login-option strong,
.login-option small {
  display: block;
}

.login-option small,
.login-note,
.muted,
.item-meta,
.row-meta,
.section-copy {
  color: var(--muted);
}

.login-option small {
  margin-top: 4px;
  line-height: 1.4;
}

.login-note {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 4px 0;
  font-size: 13px;
}

.app-shell {
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  height: 100vh;
  padding: 22px 16px;
  border-right: 1px solid rgba(255, 255, 255, 0.7);
  background: rgba(245, 245, 247, 0.75);
  backdrop-filter: blur(24px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
}

.brand-mark {
  width: 42px;
  height: 42px;
}

.brand strong,
.brand span,
.sidebar-footer strong,
.sidebar-footer span,
.building-card strong,
.building-card small {
  display: block;
}

.brand strong {
  font-size: 18px;
  line-height: 1.1;
}

.brand span,
.section-kicker,
.eyebrow,
.topbar-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  text-transform: uppercase;
  letter-spacing: 0;
}

.building-card {
  display: grid;
  gap: 6px;
  padding: 14px;
  box-shadow: var(--shadow-soft);
}

.building-card strong {
  font-size: 16px;
}

.building-card small {
  color: var(--muted);
  line-height: 1.35;
}

.nav-list {
  display: grid;
  gap: 7px;
  overflow-y: auto;
}

.nav-item {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 6px 10px;
  color: #343438;
  text-align: left;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
}

.nav-item:hover,
.nav-item.is-active {
  border-color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow-soft);
}

.nav-icon {
  width: 28px;
  height: 28px;
  color: var(--blue);
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.75);
}

.nav-badge {
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  color: #ffffff;
  border-radius: 999px;
  background: var(--rose);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  line-height: 22px;
}

.sidebar-footer {
  display: grid;
  grid-template-columns: 12px 1fr;
  gap: 10px;
  align-items: start;
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.58);
}

.sidebar-footer span {
  color: var(--muted);
  font-size: 12px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(48, 164, 108, 0.14);
}

.sidebar-footer .status-dot {
  margin-top: 5px;
}

.main-area {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(280px, 520px) auto;
  gap: 18px;
  align-items: center;
  padding: 20px 28px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.7);
  background: rgba(245, 245, 247, 0.78);
  backdrop-filter: blur(24px);
}

.topbar-title h1 {
  margin-top: 2px;
  font-size: 28px;
}

.search-box {
  display: grid;
  grid-template-columns: 24px 1fr;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 14px;
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 0 0 1px rgba(29, 29, 31, 0.03);
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.topbar-actions,
.section-heading,
.dialog-header,
.dialog-actions,
.toolbar,
.inline-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.segmented,
.status-filter {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.84);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.54);
}

.segment,
.filter-chip {
  min-height: 32px;
  padding: 0 12px;
  color: var(--muted);
  border: 0;
  border-radius: 6px;
  background: transparent;
  white-space: nowrap;
}

.segment.is-active,
.filter-chip.is-active {
  color: var(--ink);
  background: #ffffff;
  box-shadow: 0 5px 18px rgba(29, 29, 31, 0.10);
}

.primary-button,
.ghost-button,
.icon-button,
.row-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-weight: 800;
}

.primary-button {
  color: #ffffff;
  background: linear-gradient(135deg, #111113, #3b3b42);
  box-shadow: 0 12px 28px rgba(29, 29, 31, 0.2);
}

.ghost-button,
.row-button {
  color: var(--ink);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.7);
}

.icon-button {
  width: 38px;
  padding: 0;
  font-size: 26px;
  color: var(--muted);
  border-color: var(--line);
  background: #ffffff;
}

.row-button {
  min-height: 34px;
  padding: 0 11px;
  font-size: 13px;
}

.row-button:disabled {
  cursor: default;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.46);
}

.workspace {
  display: grid;
  gap: 20px;
  padding: 24px 28px 36px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(440px, 0.75fr);
  gap: 18px;
}

.intro-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 168px;
  gap: 22px;
  align-items: center;
  min-height: 250px;
  padding: 28px;
  overflow: hidden;
}

.intro-panel h2 {
  max-width: 690px;
  margin: 10px 0 14px;
  font-size: clamp(34px, 4.3vw, 56px);
  line-height: 1;
  letter-spacing: 0;
}

.intro-panel p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.5;
}

.health-ring {
  display: grid;
  place-items: center;
}

.ring {
  display: grid;
  place-items: center;
  width: 154px;
  height: 154px;
  border-radius: 50%;
  background:
    radial-gradient(circle, #ffffff 0 56%, transparent 57%),
    conic-gradient(var(--green) 0deg, var(--green) 300deg, rgba(29, 29, 31, 0.1) 300deg 360deg);
  box-shadow: inset 0 0 0 1px rgba(29, 29, 31, 0.08), 0 20px 46px rgba(48, 164, 108, 0.18);
}

.ring strong,
.ring span {
  grid-column: 1;
  grid-row: 1;
}

.ring strong {
  margin-top: -12px;
  font-size: 32px;
}

.ring span {
  margin-top: 42px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.metric-card {
  display: grid;
  gap: 14px;
  min-height: 118px;
  padding: 18px;
  box-shadow: var(--shadow-soft);
}

.metric-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-weight: 800;
}

.metric-card strong {
  font-size: 30px;
  line-height: 1;
}

.metric-card small {
  color: var(--muted);
  line-height: 1.35;
}

.metric-token {
  width: 30px;
  height: 30px;
  border-radius: 50%;
}

.token-blue {
  background: var(--blue);
}

.token-green {
  background: var(--green);
}

.token-amber {
  background: var(--amber);
}

.token-rose {
  background: var(--rose);
}

.token-indigo {
  background: var(--indigo);
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 18px;
}

.surface {
  padding: 20px;
}

.surface-large {
  grid-column: span 8;
}

.surface-half {
  grid-column: span 6;
}

.surface-side {
  grid-column: span 4;
}

.surface-full {
  grid-column: 1 / -1;
}

.section-heading {
  margin-bottom: 18px;
}

.section-heading h3,
.dialog h3 {
  margin-top: 4px;
  font-size: 22px;
}

.section-copy {
  max-width: 720px;
  margin: 6px 0 0;
  line-height: 1.5;
}

.finance-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  gap: 18px;
}

.bar-chart {
  display: grid;
  grid-template-columns: repeat(6, minmax(44px, 1fr));
  gap: 12px;
  align-items: end;
  min-height: 250px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.58));
}

.bar-item {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 10px;
  height: 100%;
  min-width: 0;
}

.bar-stack {
  display: grid;
  grid-template-rows: 1fr auto;
  align-items: end;
  height: 190px;
  border-radius: 8px;
  background: rgba(29, 29, 31, 0.06);
  overflow: hidden;
}

.bar-stack span {
  display: block;
  min-height: 8px;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, var(--blue), #55a9ff);
}

.bar-item:nth-child(2n) .bar-stack span {
  background: linear-gradient(180deg, var(--green), #7bdcb5);
}

.bar-item:nth-child(3n) .bar-stack span {
  background: linear-gradient(180deg, var(--indigo), #8b8cf6);
}

.bar-item small {
  color: var(--muted);
  text-align: center;
  font-weight: 800;
}

.summary-list,
.row-list,
.timeline,
.document-grid,
.message-list {
  display: grid;
  gap: 10px;
}

.summary-row,
.data-row,
.timeline-item,
.document-item,
.message-item,
.resident-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.66);
}

.summary-row {
  display: grid;
  gap: 5px;
  padding: 14px;
}

.summary-row span,
.item-meta,
.row-meta,
.timeline-item span,
.document-item small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.summary-row strong {
  font-size: 22px;
}

.data-row {
  display: grid;
  grid-template-columns: minmax(190px, 1.25fr) repeat(4, minmax(92px, 0.55fr)) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
}

.data-row.compact {
  grid-template-columns: minmax(180px, 1fr) auto auto;
}

.data-row.incident {
  grid-template-columns: minmax(220px, 1.25fr) 120px 120px 110px auto;
}

.data-row.receipt {
  grid-template-columns: minmax(170px, 1fr) 120px 110px 110px auto;
}

.row-title {
  min-width: 0;
}

.row-title strong {
  display: block;
  overflow-wrap: anywhere;
}

.row-meta {
  display: block;
  margin-top: 5px;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.pill-open {
  color: #7a3b00;
  background: rgba(178, 106, 0, 0.12);
}

.pill-active {
  color: #075aa8;
  background: rgba(10, 132, 255, 0.12);
}

.pill-done {
  color: #137447;
  background: rgba(48, 164, 108, 0.13);
}

.pill-debt {
  color: #9f1239;
  background: rgba(217, 45, 92, 0.12);
}

.pill-neutral {
  color: #45454a;
  background: rgba(29, 29, 31, 0.08);
}

.priority-alta {
  color: var(--rose);
}

.priority-media {
  color: var(--amber);
}

.priority-baixa {
  color: var(--green);
}

.timeline-item {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 12px;
  padding: 12px;
}

.date-tile {
  display: grid;
  place-items: center;
  min-height: 58px;
  color: var(--blue);
  border-radius: var(--radius);
  background: rgba(10, 132, 255, 0.1);
  font-weight: 800;
}

.timeline-item strong,
.message-item strong,
.document-item strong {
  display: block;
  margin-bottom: 4px;
}

.document-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.document-item {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  align-items: center;
  min-height: 86px;
  padding: 12px;
}

.doc-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--indigo);
}

.document-item:nth-child(2n) .doc-icon {
  background: var(--green);
}

.document-item:nth-child(3n) .doc-icon {
  background: var(--amber);
}

.message-item {
  display: grid;
  gap: 7px;
  padding: 13px;
}

.resident-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 16px;
}

.resident-card strong {
  display: block;
  font-size: 24px;
  margin-top: 4px;
}

.vote-options {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.vote-option {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.68);
}

.progress {
  height: 8px;
  border-radius: 999px;
  background: rgba(29, 29, 31, 0.08);
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--green));
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 180px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.42);
}

.dialog {
  width: min(640px, calc(100vw - 32px));
  padding: 0;
  border-color: rgba(255, 255, 255, 0.88);
}

.dialog::backdrop {
  background: rgba(29, 29, 31, 0.32);
  backdrop-filter: blur(12px);
}

.dialog form {
  display: grid;
  gap: 16px;
  padding: 22px;
}

.dialog label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.dialog input,
.dialog select,
.dialog textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  outline: 0;
}

.dialog textarea {
  line-height: 1.45;
}

.dialog input:focus,
.dialog select:focus,
.dialog textarea:focus,
.search-box:focus-within {
  border-color: rgba(10, 132, 255, 0.58);
  box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.14);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 50;
  max-width: min(420px, calc(100vw - 44px));
  padding: 13px 16px;
  color: #ffffff;
  border-radius: var(--radius);
  background: rgba(29, 29, 31, 0.92);
  box-shadow: var(--shadow);
  transform: translateY(18px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1220px) {
  .app-shell,
  .login-screen {
    grid-template-columns: 1fr;
  }

  .login-screen {
    padding: 36px 20px;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 16px 20px;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.66);
  }

  .nav-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .sidebar-footer {
    display: none;
  }

  .topbar {
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .metric-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 940px) {
  .workspace,
  .topbar {
    padding-left: 16px;
    padding-right: 16px;
  }

  .nav-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .intro-panel,
  .finance-layout,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .health-ring {
    justify-content: start;
  }

  .metric-grid,
  .content-grid,
  .document-grid {
    grid-template-columns: 1fr;
  }

  .surface,
  .surface-large,
  .surface-half,
  .surface-side,
  .surface-full {
    grid-column: auto;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .bar-chart {
    overflow-x: auto;
  }

  .data-row,
  .data-row.compact,
  .data-row.incident,
  .data-row.receipt,
  .resident-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .login-copy h1 {
    font-size: 38px;
  }

  .brand {
    min-height: 42px;
  }

  .nav-item {
    grid-template-columns: 28px 1fr auto;
    font-size: 14px;
  }

  .topbar-title h1 {
    font-size: 24px;
  }

  .intro-panel,
  .surface,
  .metric-card {
    padding: 16px;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .segmented,
  .status-filter {
    width: 100%;
    overflow-x: auto;
  }
}
