@font-face {
  font-family: "Familjen Grotesk";
  src: url("/assets/FamiljenGrotesk-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --purple-950: #061633;
  --purple-900: #0a2e73;
  --purple-800: #0f4db8;
  --purple-700: #1264e3;
  --purple-600: #1b78ff;
  --purple-100: #dcecff;
  --purple-50: #f2f8ff;
  --ink: #071a3d;
  --muted: #65748b;
  --line: #dbe7f5;
  --surface: #ffffff;
  --soft: #f6faff;
  --green: #18a06b;
  --amber: #d58b00;
  --blue: #3267d6;
  --shadow: 0 18px 48px rgba(6, 22, 51, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--soft);
  color: var(--ink);
  font-family: "Familjen Grotesk", Arial, sans-serif;
  letter-spacing: 0;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow-y: auto;
  background:
    linear-gradient(135deg, rgba(6, 22, 51, 0.96), rgba(18, 100, 227, 0.86)),
    var(--purple-950);
}

.login-screen.hidden {
  display: none;
}

.login-card {
  display: grid;
  gap: 14px;
  width: min(420px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 28px;
  background: white;
  box-shadow: var(--shadow);
}

.login-card img {
  width: min(280px, 100%);
  height: auto;
  justify-self: center;
  border-radius: 8px;
}

.login-card h1 {
  color: var(--purple-900);
}

.auth-register-card {
  width: min(860px, 100%);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 22px;
  row-gap: 12px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}

.auth-register-card > img,
.auth-register-card > h1,
.auth-register-card > .muted,
.auth-register-card > .auth-privacy-note,
.auth-register-card > .login-error,
.auth-register-card > #back-to-login-button {
  grid-column: 1 / -1;
}

.auth-register-card > img {
  width: min(220px, 100%);
}

.auth-register-card > h1 {
  margin: 2px 0 0;
}

.auth-register-card > .muted {
  margin: 0;
}

.auth-register-card > .auth-divider {
  display: none;
}

.auth-register-card > .primary-button,
.auth-register-card > .google-auth-button {
  align-self: end;
  width: 100%;
}

.login-error {
  min-height: 20px;
  margin: 0;
  color: #b42318;
}

.auth-message {
  display: none;
  border: 1px solid #a7d7b5;
  border-radius: 6px;
  padding: 10px 12px;
  background: #ecfdf3;
  color: #166534;
}

.auth-message.active {
  display: block;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.google-auth-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  border: 1px solid #b8c4d6;
  border-radius: 6px;
  padding: 9px 14px;
  background: white;
  color: #26344d;
  font-weight: 700;
  text-decoration: none;
}

.google-auth-button:hover {
  border-color: #4285f4;
  background: #f7faff;
}

.google-mark {
  color: #4285f4;
  font: 700 20px Arial, sans-serif;
}

.auth-link-button {
  border: 0;
  padding: 4px;
  background: transparent;
  color: var(--purple-700);
  font-weight: 700;
}

.auth-privacy-note {
  margin: 0;
  border-left: 3px solid #4285f4;
  padding: 8px 10px;
  background: #f4f8ff;
  color: #46566e;
  font-size: 13px;
}

.access-request-list {
  display: grid;
  gap: 8px;
}

.access-request-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
}

.access-request-row span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.payment-checkout-summary {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: var(--soft);
}

.payment-checkout-summary strong {
  font-size: 24px;
  color: var(--purple-900);
}

#paymentBrick_container {
  min-height: 420px;
  margin-top: 12px;
}

.payment-feedback {
  display: none;
  margin-top: 12px;
  border: 1px solid #b8c4d6;
  border-radius: 6px;
  padding: 10px 12px;
  background: #f4f7fb;
  color: #344054;
}

.payment-feedback:not(:empty) {
  display: block;
}

.payment-feedback.success {
  border-color: #86c89b;
  background: #ecfdf3;
  color: #166534;
}

.payment-feedback.error {
  border-color: #f1a3a3;
  background: #fef2f2;
  color: #b42318;
}

.payment-feedback.success {
  display: grid;
  gap: 10px;
}

.pix-qr-code {
  width: min(260px, 100%);
  height: auto;
  justify-self: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
}

#pix-copy-code {
  min-height: 88px;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.financial-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.financial-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

.financial-table th,
.financial-table td {
  border: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: middle;
}

.financial-table th {
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.tenant-billing-history {
  display: grid;
  gap: 3px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
  font-size: 12px;
}

.invoice-receipt {
  border: 1px solid var(--line);
  padding: 18px;
}

.settings-choice-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.settings-choice-list .checkbox-row {
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
}

.app-shell {
  display: none;
}

.app-shell.authenticated {
  display: grid;
}

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

[hidden] {
  display: none !important;
}

button {
  cursor: pointer;
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  height: 100vh;
  overflow-y: auto;
  padding: 10px 11px;
  background: var(--purple-950);
  color: white;
}

.brand {
  display: grid;
  justify-items: center;
  gap: 0;
  color: white;
  text-decoration: none;
}

.brand img {
  width: min(145px, 100%);
  height: auto;
  border-radius: 8px;
}

.brand span {
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  text-transform: uppercase;
}

.nav {
  display: grid;
  gap: 1px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 28px;
  border: 0;
  border-radius: 8px;
  padding: 5px 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.74);
  text-align: left;
  font-size: 13px;
}

.nav-icon {
  flex: 0 0 18px;
  width: 18px;
  color: rgba(255, 255, 255, 0.9);
  text-align: center;
}

.nav-label {
  min-width: 0;
  line-height: 1.15;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.12);
  color: white;
}

.visibility-box {
  margin-top: 3px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.visibility-box span {
  display: block;
  color: rgba(255, 255, 255, 0.64);
  font-size: 11px;
}

.language-picker {
  display: grid;
  gap: 5px;
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
}

.language-picker select {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  padding: 6px;
  background: #fff;
  color: #172033;
}

.lost-report-panel {
  margin-top: 14px;
}

.message-template-panel {
  margin-top: 14px;
}

.workspace {
  min-width: 0;
  width: min(1660px, 100%);
  margin: 0 auto;
  padding: 24px 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--purple-700);
  font-size: 13px;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 32px;
  line-height: 1.05;
}

h2 {
  margin-bottom: 0;
  font-size: 19px;
}

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

.search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(360px, 36vw);
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: white;
  color: var(--muted);
}

.search input {
  width: 100%;
  border: 0;
  outline: 0;
}

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 8;
  display: none;
  width: min(520px, 90vw);
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.search-results.active {
  display: grid;
}

.search-results button {
  display: grid;
  gap: 3px;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  background: #fff;
  text-align: left;
}

.search-results button:hover {
  background: var(--soft);
}

.search-results span,
.empty-search {
  color: var(--muted);
  font-size: 13px;
}

.empty-search {
  padding: 12px;
}

.primary-button,
.secondary-button,
.whatsapp-button,
.danger-button,
.icon-button {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 14px;
}

.primary-button {
  background: var(--purple-700);
  color: white;
}

.secondary-button,
.icon-button {
  border-color: var(--line);
  background: white;
  color: var(--ink);
}

.whatsapp-button {
  border-color: #bfe8d7;
  background: #e8f8f1;
  color: var(--green);
}

.danger-button {
  border-color: #f4c7c3;
  background: #fff7f6;
  color: #b42318;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.icon-button {
  width: 42px;
  padding: 0;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric {
  padding: 18px;
}

.metric-detail {
  cursor: zoom-in;
}

.metric span,
.metric small {
  color: var(--muted);
}

.metric strong {
  display: block;
  margin: 8px 0 2px;
  color: var(--purple-900);
  font-size: 30px;
}

.goal-meter-card {
  min-height: 226px;
}

.goal-meter-card canvas {
  display: block;
  width: 100%;
  max-width: 260px;
  height: 150px;
  margin: 4px auto 0;
}

.goal-meter-card strong {
  margin-top: 0;
  text-align: center;
}

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

.dashboard-charts {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
  gap: 14px;
  margin-bottom: 14px;
}

.dashboard-charts .chart-panel:last-child {
  grid-column: 1 / -1;
}

.panel {
  min-width: 0;
  padding: 18px;
}

.chart-panel canvas {
  width: 100%;
  max-height: 340px;
  margin-top: 14px;
}

.deal-notes-field,
.dashboard-detail {
  grid-column: 1 / -1;
}

.insight-list,
.task-list,
.table-list,
.timeline,
.playbook-list,
.ranking {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.insight,
.task,
.table-row,
.timeline-item,
.playbook-item,
.ranking div,
.tenant-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.table-row,
.task.action-row,
.timeline-item.action-row,
.playbook-item.action-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.data-header,
.product-row,
.deal-product-header,
.deal-product-row {
  display: grid;
  align-items: center;
  gap: 10px;
}

.data-header,
.deal-product-header {
  margin-top: 14px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
}

.product-header,
.product-row {
  grid-template-columns: minmax(220px, 1fr) 140px 140px 140px 130px 110px;
}

.product-row {
  cursor: pointer;
}

.table-row > div:first-child,
.action-row > div:first-child {
  min-width: 0;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.row-actions.compact {
  justify-content: flex-start;
  margin-top: 12px;
}

.row-actions .secondary-button,
.row-actions .whatsapp-button,
.row-actions .danger-button {
  min-height: 34px;
  padding: 0 10px;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  background: white;
  color: var(--muted);
}

.insight strong,
.task strong,
.table-row strong,
.timeline-item strong,
.playbook-item strong,
.ranking strong {
  display: block;
  margin-bottom: 4px;
}

.muted,
.task span,
.table-row span,
.timeline-item span,
.playbook-item span,
.tenant-card span {
  color: var(--muted);
}

.segmented {
  display: inline-flex;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  background: white;
}

.segmented button {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
}

.segmented button.active {
  background: var(--purple-700);
  color: white;
}

.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(230px, 1fr));
  gap: 12px;
  margin-top: 14px;
  overflow-x: auto;
  padding-bottom: 10px;
}

.kanban-column {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 560px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f2f8ff;
}

.column-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.deal-list {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 420px;
  padding: 12px;
}

.deal-card {
  border: 1px solid #c9dcf2;
  border-left: 4px solid var(--purple-700);
  border-radius: 8px;
  padding: 12px;
  background: white;
  box-shadow: 0 8px 20px rgba(6, 22, 51, 0.08);
  cursor: pointer;
}

.deal-card.deal-won {
  border-left-color: var(--green);
  background: #f7fffb;
}

.deal-card.deal-lost {
  border-left-color: #b42318;
  background: #fff8f7;
}

.deal-card.dragging {
  opacity: 0.52;
}

.deal-card strong {
  display: block;
  font-size: 16px;
}

.deal-card-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.deal-temperature {
  display: inline-grid;
  place-items: center;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 18px;
}

.deal-temperature.cold {
  background: #e0f2fe;
}

.deal-temperature.medium {
  background: #fef3c7;
}

.deal-temperature.hot {
  background: #fee2e2;
}

.deal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.deal-status-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.deal-status-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  min-height: 42px;
  border-radius: 8px;
  padding: 0 10px;
  background: white;
  line-height: 1;
  font-weight: 700;
  white-space: nowrap;
}

.deal-status-button span {
  font-size: 20px;
  line-height: 1;
}

.deal-status-button small {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
}

.deal-status-button.won {
  border: 1px solid #bfe8d7;
  color: var(--green);
}

.deal-status-button.lost {
  border: 1px solid #f4c7c3;
  color: #b42318;
}

.editable-card {
  cursor: pointer;
}

.editable-card:hover {
  border-color: #9ec5f3;
}

.pill {
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--purple-100);
  color: var(--purple-800);
  font-size: 12px;
}

.send-box {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.ai-box {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.ai-box textarea {
  min-height: 130px;
}

.ai-answer {
  white-space: pre-wrap;
  color: var(--ink);
}

.report-filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 12px;
  align-items: end;
  margin-top: 14px;
}

.import-summary,
.pipeline-form,
.pipeline-stages-editor,
.pipeline-lost-settings {
  display: grid;
  gap: 12px;
}

.import-summary {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--soft);
}

.mapping-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 12px;
}

.settings-grid {
  align-items: start;
}

.settings-category-picker {
  max-width: 520px;
  margin-bottom: 14px;
}

.settings-category-picker label {
  display: grid;
  gap: 6px;
}

.settings-category-picker select {
  background: #fff;
  font-weight: 700;
}

.settings-grid > [data-settings-category][hidden],
[data-settings-category][hidden] {
  display: none !important;
}

.settings-table {
  display: grid;
  gap: 8px;
  overflow-x: auto;
}

.settings-header,
.settings-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) repeat(5, minmax(120px, 1fr));
  gap: 8px;
  align-items: center;
  min-width: 780px;
}

.settings-header {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
}

.settings-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.settings-check {
  display: flex;
  justify-content: center;
}

.settings-goal {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.report-invoice {
  margin-top: 16px;
  overflow-x: auto;
}

.report-invoice-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.report-invoice table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.report-invoice th,
.report-invoice td {
  border: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

.report-invoice th,
.report-invoice tfoot td {
  background: var(--soft);
  font-weight: 700;
}

.contact-custom-fields {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.compact-heading {
  margin: 0;
}

.compact-heading h2 {
  font-size: 16px;
}

.contact-custom-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(160px, 1.2fr) 90px;
  gap: 8px;
  margin-bottom: 8px;
}

.import-preview {
  display: grid;
  gap: 8px;
  overflow-x: auto;
}

.import-preview > div {
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: white;
}

.pipeline-stage-header,
.pipeline-stage-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 90px 90px 110px;
  align-items: center;
  gap: 10px;
}

.pipeline-stage-header {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
}

.pipeline-stage-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: white;
}

.pipeline-stage-row input[type="checkbox"] {
  justify-self: start;
  width: auto;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: white;
  color: var(--ink);
}

textarea {
  min-height: 100px;
  resize: vertical;
}

.tenant-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(190px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.tenant-grid-wide {
  grid-template-columns: repeat(2, minmax(280px, 1fr));
}

.tenant-card strong {
  display: block;
  color: var(--purple-900);
  font-size: 18px;
}

.tenant-card .status {
  display: inline-block;
  margin-top: 12px;
  border-radius: 999px;
  padding: 5px 10px;
  background: #e8f8f1;
  color: var(--green);
}

.tenant-demo-line {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.tenant-demo-line input[type="date"] {
  min-height: 34px;
}

.tenant-card {
  cursor: pointer;
}

.tenant-card.selected {
  border-color: var(--purple-700);
  box-shadow: 0 0 0 2px var(--purple-100), var(--shadow);
}

.tenant-users {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.tenant-users-modal {
  max-height: 48vh;
  overflow: auto;
}

.tenant-detail-summary {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--soft);
}

.tenant-detail-summary strong,
.tenant-detail-summary span {
  display: block;
}

.tenant-detail-actions {
  margin-top: 0;
}

.tenant-users-heading {
  color: var(--purple-800);
  font-size: 13px;
  text-transform: uppercase;
}

.tenant-user-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--soft);
}

.tenant-user-row strong,
.tenant-user-row span {
  display: block;
}

dialog {
  width: min(560px, calc(100vw - 32px));
  border: 0;
  border-radius: 8px;
  padding: 22px;
  box-shadow: var(--shadow);
}

dialog.large-dialog {
  width: calc(100vw - 48px);
  height: calc(100vh - 48px);
  max-width: 1880px;
  max-height: 1032px;
  overflow: auto;
}

dialog.compact-dialog {
  width: min(460px, calc(100vw - 32px));
  padding: 18px;
}

dialog.compact-dialog .table-list {
  max-height: 320px;
  overflow: auto;
}

dialog::backdrop {
  background: rgba(6, 22, 51, 0.48);
}

dialog form,
dialog menu {
  display: grid;
  gap: 12px;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.deal-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 12px;
}

.deal-form .deal-products-editor {
  grid-column: 1 / -1;
}

.task-contact-actions,
.deal-contact-box {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--soft);
}

.deal-contact-box strong,
.deal-contact-box span {
  display: block;
}

.deal-form-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
}

.deal-notes-history {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--soft);
}

.deal-note-history-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.deal-note-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.deal-note-history-head span {
  color: var(--muted);
  font-size: 12px;
}

.note-delete-button {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.note-delete-button:hover {
  background: #fee2e2;
  color: #991b1b;
}

.deal-note-history-item p {
  margin-bottom: 0;
}

.loss-reason {
  display: inline-block;
  width: fit-content;
  border-radius: 999px;
  padding: 3px 8px;
  background: #fee2e2;
  color: #991b1b;
  font-size: 12px;
  font-weight: 700;
}

.deal-products-editor {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.deal-products-editor .panel-heading {
  align-items: end;
}

.deal-products-editor select {
  min-width: 220px;
}

.deal-product-header,
.deal-product-row {
  grid-template-columns: minmax(150px, 1fr) 100px 64px 120px 110px 100px 100px 100px 105px 76px;
}

.deal-product-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: white;
}

.deal-product-row input {
  padding: 8px;
}

.deal-product-row input[readonly],
#deal-form-amount {
  background: var(--purple-50);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-row input {
  width: auto;
}

dialog menu {
  grid-template-columns: 1fr 1fr 1fr;
  padding: 0;
  margin: 8px 0 0;
}

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

  .sidebar {
    position: static;
    height: auto;
  }

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

  .metric-grid,
  .dashboard-grid,
  .dashboard-charts,
  .split-grid,
  .tenant-grid {
    grid-template-columns: 1fr 1fr;
  }

  .dashboard-charts .chart-panel:last-child {
    grid-column: 1 / -1;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

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

  .search {
    width: 100%;
  }

  .deal-form {
    grid-template-columns: 1fr;
  }

  .mapping-grid,
  .pipeline-stage-header,
  .pipeline-stage-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .login-screen {
    place-items: start center;
    padding: 12px;
  }

  .auth-register-card {
    grid-template-columns: 1fr;
    max-height: none;
    padding: 22px;
  }

  .auth-register-card > * {
    grid-column: 1 !important;
  }

  .auth-register-card > .auth-divider {
    display: flex;
  }

  .workspace {
    padding: 16px;
  }

  .nav,
  .metric-grid,
  .dashboard-grid,
  .dashboard-charts,
  .split-grid,
  .tenant-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-charts .chart-panel:last-child {
    grid-column: auto;
  }

  .toolbar,
  .panel-heading,
  .table-row,
  .tenant-user-row,
  .task.action-row,
  .timeline-item.action-row,
  .playbook-item.action-row {
    align-items: stretch;
    flex-direction: column;
  }

  .row-actions {
    justify-content: flex-start;
  }

  .product-header,
  .product-row,
  .deal-product-header,
  .deal-product-row {
    grid-template-columns: 1fr;
  }

  .data-header,
  .deal-product-header {
    display: none;
  }

  .segmented {
    display: grid;
  }

  .kanban-board {
    grid-template-columns: repeat(4, minmax(240px, 82vw));
  }
}

@media print {
  body:not(.printing-invoice-receipt) * {
    visibility: hidden;
  }

  body:not(.printing-invoice-receipt) #reports,
  body:not(.printing-invoice-receipt) #reports * {
    visibility: visible;
  }

  body:not(.printing-invoice-receipt) #reports {
    position: absolute;
    inset: 0;
    background: #fff;
  }

  body.printing-invoice-receipt * {
    visibility: hidden !important;
  }

  body.printing-invoice-receipt .invoice-receipt,
  body.printing-invoice-receipt .invoice-receipt * {
    visibility: visible !important;
  }

  body.printing-invoice-receipt .invoice-receipt {
    position: absolute;
    inset: 0;
    border: 0;
    background: #fff;
    color: #111;
  }

  body.printing-invoice-receipt .invoice-receipt button {
    display: none !important;
  }

  .app-shell,
  .main-area,
  .content,
  .panel {
    display: block;
    box-shadow: none;
    border: 0;
  }

  .report-filters,
  .topbar,
  .sidebar {
    display: none;
  }

  .report-invoice th,
  .report-invoice td {
    border: 1px solid #222;
  }
}

.dashboard-actions { display: flex; justify-content: flex-end; margin: 0 0 14px; }
.report-chart-wrap canvas { width: 100%; max-width: 100%; height: auto; }





.report-filters {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  margin-top: 14px;
}
.report-type-menu {
  width: min(360px, 100%);
  max-width: 360px;
}
.report-dynamic-filters {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 10px;
  width: 100%;
  overflow-x: auto;
  padding-bottom: 6px;
}
.report-dynamic-filters[hidden] {
  display: none;
}
.report-dynamic-filters label {
  flex: 0 0 170px;
  min-width: 170px;
}
.report-dynamic-filters label[data-report-visual="chart"] {
  flex-basis: 185px;
}
.report-dynamic-filters label[data-report-filter="lost"] {
  flex-basis: 175px;
}
.report-dynamic-filters button {
  flex: 0 0 auto;
  min-height: 42px;
  white-space: nowrap;
}

:root { --brand: #f5bd12; --brand-dark: #0b0b0d; --accent: #ffd447; --soft: #fff8dc; }
.login-screen { grid-template-columns: minmax(360px, 0.95fr) minmax(360px, 460px); background: radial-gradient(circle at 20% 20%, rgba(245,189,18,.26), transparent 28%), linear-gradient(135deg,#050505,#18130a 48%,#f5bd12 160%); color:#fff; }
.login-hero { max-width: 780px; padding: 48px; align-self: center; }
.login-hero img { width: 220px; max-width: 60%; margin-bottom: 30px; }
.login-hero h1 { font-size: 54px; line-height: 1; margin: 0 0 18px; color:#fff; }
.login-hero p, .login-hero li { color: rgba(255,255,255,.82); font-size: 18px; }
.login-hero ul { display:grid; gap:10px; padding-left: 20px; }
.login-card { border: 1px solid rgba(245,189,18,.35); box-shadow: 0 24px 80px rgba(0,0,0,.3); }
.primary-button { background: linear-gradient(135deg,#f5bd12,#ffd447); color:#15110a; }
.register-choice { display:grid; grid-template-columns: 1fr 1fr; gap:10px; }
.register-choice .active { border-color:#f5bd12; background:#fff8dc; color:#111; }
.app-shell.authenticated { display:grid; grid-template-columns: 1fr; grid-template-rows:auto 1fr; }
.sidebar { position: sticky; top:0; z-index:20; height:auto; min-height:0; flex-direction:row; align-items:center; gap:12px; padding:10px 18px; border-right:0; border-bottom:1px solid var(--line); }
.sidebar .brand img { width: 132px; }
.nav { flex:1; display:flex; flex-direction:row; align-items:center; gap:6px; overflow-x:auto; }
.nav-item { width:42px; height:42px; padding:0; justify-content:center; border-radius:10px; }
.nav-item .nav-label { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); }
.nav-icon { font-size:20px; }
.visibility-box { display:flex; flex-direction:row; align-items:center; gap:10px; padding:0; border:0; background:transparent; }
.workspace { padding: 18px 26px 34px; }
.manual-content { display:grid; gap:10px; max-height:65vh; overflow:auto; }
.whatsapp-settings-grid { grid-template-columns: repeat(auto-fit,minmax(240px,1fr)); }
@media (max-width: 920px) { .login-screen { grid-template-columns:1fr; } .login-hero { padding:28px; } .login-hero h1 { font-size:38px; } .sidebar { flex-wrap:wrap; } .visibility-box { width:100%; justify-content:space-between; } }
.utility-button {
  width: auto;
  min-width: 88px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 12px;
  font-weight: 700;
}
.nav-icon svg,
.icon-button svg {
  width: 20px;
  height: 20px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-item {
  color: #1f2937;
}
.nav-item.active .nav-icon,
.nav-item:hover .nav-icon,
.icon-button:hover svg {
  color: #111827;
}
.utility-button svg {
  width: 18px;
  height: 18px;
}
/* Ajustes 2.0 - login compacto, topo limpo e WhatsApp QR */
.login-screen {
  grid-template-columns: minmax(320px, 0.9fr) minmax(320px, 390px);
  gap: 42px;
  padding: 32px;
}
.login-hero {
  max-width: 640px;
  padding: 28px 40px;
}
.login-hero h1 {
  font-size: 42px;
  max-width: 620px;
}
.login-hero p,
.login-hero li {
  font-size: 16px;
}
.login-card {
  width: min(390px, 100%);
  gap: 10px;
  padding: 22px;
  border-radius: 12px;
  box-shadow: 0 22px 70px rgba(0,0,0,.28);
}
.login-card img {
  display: none !important;
}
.login-card h1 {
  margin: 0 0 4px;
  font-size: 26px;
}
.auth-register-card {
  width: min(430px, 100%);
}
.nav-logout {
  margin-left: auto;
  color: #7f1d1d;
}
.nav-logout:hover {
  background: #fee2e2;
  color: #991b1b;
}
.whatsapp-connect-panel {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 220px;
  gap: 18px;
  align-items: stretch;
}
.whatsapp-qr-box {
  min-height: 220px;
  border: 1px dashed #d1d5db;
  border-radius: 12px;
  background: #fffdf2;
  color: #5f4b04;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 18px;
}
.qr-placeholder {
  display: grid;
  gap: 8px;
}
.qr-placeholder strong {
  color: #111827;
}
@media (max-width: 920px) {
  .login-screen {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .login-hero {
    padding: 10px 8px;
  }
  .login-hero h1 {
    font-size: 32px;
  }
  .whatsapp-connect-panel {
    grid-template-columns: 1fr;
  }
}
.auth-register-card {
  grid-template-columns: 1fr !important;
  max-height: 92vh;
  overflow-y: auto;
}
.auth-register-card > * {
  grid-column: 1 !important;
}
.auth-register-card > .auth-divider {
  display: flex;
}
.auth-register-card > .primary-button,
.auth-register-card > .google-auth-button,
.auth-register-card > .secondary-button {
  align-self: auto;
  width: 100%;
}
.whatsapp-inbox {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  gap: 16px;
  min-height: 420px;
}
.whatsapp-conversation-list,
.whatsapp-message-list {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  overflow: auto;
}
.whatsapp-conversation-list {
  display: flex;
  flex-direction: column;
  max-height: 520px;
}
.whatsapp-conversation-item {
  display: grid;
  gap: 4px;
  padding: 12px;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.whatsapp-conversation-item.active {
  background: rgba(245, 183, 0, 0.16);
  box-shadow: inset 3px 0 0 var(--accent);
}
.whatsapp-conversation-item span,
.whatsapp-conversation-item small {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.whatsapp-conversation-detail {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 12px;
  min-height: 420px;
}
.whatsapp-message-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
}
.whatsapp-message {
  max-width: 78%;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.whatsapp-message.outbound {
  align-self: flex-end;
  background: rgba(245, 183, 0, 0.22);
}
.whatsapp-message.inbound {
  align-self: flex-start;
}
.whatsapp-message p {
  margin: 0 0 6px;
  white-space: pre-wrap;
}
.whatsapp-message span {
  color: var(--muted);
  font-size: 12px;
}
.whatsapp-media,
.whatsapp-media-link {
  display: block;
  margin: 4px 0 8px;
}
.whatsapp-media {
  max-width: 100%;
}
.whatsapp-media-image {
  display: block;
  max-width: 260px;
  max-height: 220px;
  border-radius: 6px;
  object-fit: contain;
}
.whatsapp-media-link {
  color: var(--brand-dark);
  font-weight: 700;
  word-break: break-word;
}
.whatsapp-media-note {
  display: block;
  color: var(--muted);
  margin: 4px 0 8px;
}
.whatsapp-reply-box {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}
.whatsapp-reply-status {
  grid-column: 1 / -1;
  margin: -2px 0 0;
  min-height: 18px;
  color: var(--muted);
  font-size: 13px;
}
.whatsapp-reply-status.error {
  color: #c62828;
}
.whatsapp-reply-status.success {
  color: #1b7f3a;
}
.whatsapp-automation-row {
  grid-template-columns: minmax(180px, 260px) minmax(180px, 260px) 1fr;
}
@media (max-width: 900px) {
  .whatsapp-inbox,
  .whatsapp-automation-row {
    grid-template-columns: 1fr;
  }
  .whatsapp-reply-box {
    grid-template-columns: 1fr;
  }
}
.login-footer {
  grid-column: 1 / -1;
  justify-self: center;
  align-self: end;
  margin-top: -16px;
}
.privacy-link {
  color: rgba(255,255,255,.86);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.privacy-policy-dialog {
  width: min(780px, calc(100vw - 32px));
  max-height: min(86vh, 760px);
  border: 0;
  border-radius: 12px;
  padding: 0;
  box-shadow: 0 28px 90px rgba(0,0,0,.35);
}
.privacy-policy-dialog::backdrop {
  background: rgba(3, 7, 18, .62);
}
.privacy-policy-dialog form {
  display: grid;
  gap: 14px;
  padding: 24px;
}
.privacy-policy-content {
  max-height: 60vh;
  overflow: auto;
  display: grid;
  gap: 10px;
  color: #334155;
  line-height: 1.5;
}
.privacy-policy-content h3,
.privacy-policy-content p {
  margin: 0;
}
.privacy-policy-content h3 {
  color: #0f172a;
  font-size: 15px;
  margin-top: 6px;
}


.report-columns-wrap {
  grid-column: 1 / -1;
}

.report-columns-wrap > summary {
  cursor: pointer;
  font-weight: 700;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.report-columns-wrap[open] > summary {
  margin-bottom: 8px;
}

.report-columns-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px 14px;
  max-height: 220px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}


.report-checkbox-list {
  display: grid;
  gap: 8px;
  max-height: 180px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.report-checkbox-list[hidden] {
  display: none;
}
