/* CRM Vendas — design system.
   CSS custom properties, not hardcoded colors, so white-label tenant theming
   (Tenant.PrimaryColor) can override --brand-* per request via an inline
   <style> block in _Layout.cshtml without touching this file. */

:root {
  --brand-primary: #4f46e5;
  --brand-primary-rgb: 79, 70, 229;
  --brand-primary-hover: #4338ca;
  --brand-primary-light: #eef2ff;

  --sidebar-bg: #111827;
  --sidebar-text: #9ca3af;
  --sidebar-text-hover: #f3f4f6;
  --sidebar-active-bg: rgba(255, 255, 255, 0.08);
  --sidebar-border: rgba(255, 255, 255, 0.08);

  --content-bg: #f8f9fc;
  --card-bg: #ffffff;
  --card-border: #e9ebf1;
  --text-primary: #111827;
  --text-muted: #6b7280;
  --radius-sm: 8px;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.12);

  --sidebar-width: 248px;
  --sidebar-width-collapsed: 76px;

  --ok: #0e7c66;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --warn-bg: #fff7ed;
  --warn-line: #fed7aa;
  --row-hover: #f8fafc;
  --track: #eef2f7;
  --info: #0369a1;
  --accent-alt: #7c3aed;
  --kanban-bg: #edf1f6;

  --transition: all 0.18s ease-in-out;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--content-bg);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--brand-primary);
  text-decoration: none;
}

a:hover {
  color: var(--brand-primary-hover);
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  letter-spacing: -0.01em;
}

.text-muted {
  color: var(--text-muted) !important;
}

/* ---------- App shell: sidebar + main ---------- */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  transition: var(--transition);
}

/* Collapsed: icon-only rail — desktop only, toggled by #sidebarToggleBtn and
   persisted in localStorage (see site.js) so it survives a page reload. */
.app-shell.sidebar-collapsed .app-sidebar {
  width: var(--sidebar-width-collapsed);
}

.app-shell.sidebar-collapsed .sidebar-brand-name,
.app-shell.sidebar-collapsed .sidebar-section-label,
.app-shell.sidebar-collapsed .sidebar-subsection-label,
.app-shell.sidebar-collapsed .sidebar-nav-link-text {
  display: none;
}

/* Icon-only rail mode always shows every icon regardless of each section's
   own collapsed/expanded state — there's no long list to shorten once the
   text labels are already hidden, so per-section collapse would just hide
   items without saving any space. */
.app-shell.sidebar-collapsed .sidebar-section-body {
  display: flex !important;
}

.app-shell.sidebar-collapsed .sidebar-brand {
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.app-shell.sidebar-collapsed .sidebar-brand-mark {
  max-height: 40px;
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding: 1.5rem 1.25rem 1.15rem;
  border-bottom: 1px solid var(--sidebar-border);
  margin-bottom: 0.5rem;
  text-align: center;
}

/* Sized to fit its content (logo or fallback initial), not a fixed square —
   a fixed box + object-fit:cover was cropping/distorting real (non-square)
   tenant logos. min-height/min-width only apply to the no-logo fallback
   letter, so a real logo can be genuinely bigger than the old 34px mark. */
.sidebar-brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  max-height: 64px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 10px;
  background: var(--brand-primary);
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
  padding: 4px;
}

/* A real uploaded logo drops the brand-color fallback square entirely —
   forcing a white (or any other) card behind it fought with logos that are
   light-colored/white themselves (transparent PNG meant to sit on a dark
   background, like the sidebar already is), making them unreadable. No
   background here means the logo's own file — transparent or with its own
   baked-in background color — renders exactly as authored. */
.sidebar-brand-mark-has-logo {
  background: transparent;
  padding: 0;
  min-width: 0;
  min-height: 0;
}

.sidebar-brand-mark img {
  display: block;
  max-width: 100%;
  max-height: 56px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.sidebar-brand-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: #fff;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.sidebar-nav {
  flex: 1;
  padding: 0.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.sidebar-nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: var(--sidebar-nav-font-size, 12.5px);
  font-weight: 500;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.sidebar-nav-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.85;
}

.sidebar-nav-link:hover {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-text-hover);
  text-decoration: none;
}

.sidebar-nav-link.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  box-shadow: inset 2px 0 0 var(--brand-primary);
}

.sidebar-nav-link.active svg {
  opacity: 1;
}

.sidebar-nav-badge {
  margin-left: auto;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #fff;
  background: var(--brand-primary);
  flex-shrink: 0;
}

.sidebar-section-label {
  padding: 1rem 0.85rem 0.35rem;
  font-size: var(--sidebar-section-font-size, 0.7rem);
  font-weight: var(--sidebar-section-weight, 700);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sidebar-section-color, rgba(var(--brand-primary-rgb), 0.9));
}

.sidebar-section-toggle:hover {
  color: #fff;
}

/* A lighter-weight label nested inside a section (e.g. "Integrações" under
   "Parâmetros do Sistema"), grouping one or more sidebar-nav-link-nested
   items without opening a whole new top-level section. */
.sidebar-subsection-label {
  padding: 0.6rem 0.85rem 0.2rem 1.15rem;
  font-size: var(--sidebar-section-font-size, 0.68rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--sidebar-section-color, rgba(var(--brand-primary-rgb), 0.75));
}

.sidebar-nav-link-nested {
  padding-left: 1.15rem;
}

/* Collapsible sections: each top-level group (CRM, Vendas, CPQ, Parâmetros do
   Sistema) and the nested "Integrações" subsection can be toggled shut so a
   tenant with every module enabled doesn't end up scrolling through a long
   sidebar just to reach the item they actually use. State is per-section,
   persisted in localStorage by site.js. */
.sidebar-section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: transparent;
  border: 0;
  cursor: pointer;
  font: inherit;
}

.sidebar-section-chevron {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.6;
  transition: transform 0.15s ease;
}

.sidebar-section.collapsed .sidebar-section-body,
.sidebar-subsection.collapsed .sidebar-section-body {
  display: none;
}

.sidebar-section.collapsed > .sidebar-section-toggle .sidebar-section-chevron,
.sidebar-subsection.collapsed > .sidebar-section-toggle .sidebar-section-chevron {
  transform: rotate(-90deg);
}

.sidebar-section-body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

/* Bulk collapse/expand for every section at once (site.js) — literal
   #2A3446 border color, no equivalent token today, only used here. */
.sidebar-footer-actions {
  display: flex;
  gap: 6px;
  padding: 0.5rem 0.75rem 0.25rem;
}

.sidebar-footer-actions button {
  flex: 1;
  height: 27px;
  border: 1px solid #2a3446;
  background: transparent;
  border-radius: 7px;
  color: var(--sidebar-text);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  transition: var(--transition);
}

.sidebar-footer-actions button:hover {
  border-color: var(--brand-primary);
  color: #fff;
}

.app-shell.sidebar-collapsed .sidebar-footer-actions {
  display: none;
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1.75rem;
  background: var(--card-bg);
  border-bottom: 1px solid var(--card-border);
  position: sticky;
  top: 0;
  z-index: 1020;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.sidebar-toggle-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
}

.sidebar-toggle-btn:hover {
  background: var(--content-bg);
  color: var(--text-primary);
}

.sidebar-toggle-btn svg {
  width: 20px;
  height: 20px;
}

.tenant-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--brand-primary-light);
  color: var(--brand-primary);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  width: auto;
  max-width: 260px;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tenant-badge svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.topbar-user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--brand-primary-light);
  color: var(--brand-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border: none;
  background: transparent;
  padding: 0.3rem 0.6rem 0.3rem 0.3rem;
  border-radius: 999px;
  transition: var(--transition);
}

.user-menu-btn:hover {
  background: var(--content-bg);
}

.user-menu-btn::after {
  margin-left: 0.15rem;
}

.lang-switcher-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  height: 34px;
  padding: 0 0.6rem;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.lang-switcher-btn:hover {
  background: var(--content-bg);
}

.lang-menu {
  width: 260px;
  padding: 10px 0;
}

.lang-menu-title {
  padding: 2px 14px 8px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.lang-menu-row {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 10px;
  padding: 8px 14px;
  border: none;
  background: transparent;
  font-size: 0.85rem;
  color: var(--text-primary);
  text-align: left;
}

.lang-menu-row:hover {
  background: var(--content-bg);
}

.lang-menu-check {
  width: 14px;
  flex-shrink: 0;
  color: var(--brand-primary);
  font-weight: 700;
}

.lang-menu-name {
  flex: 1;
  min-width: 0;
}

.lang-menu-row.selected .lang-menu-name {
  font-weight: 600;
}

.lang-menu-code {
  flex-shrink: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.lang-menu-footer {
  margin-top: 6px;
  padding: 10px 14px 0;
  border-top: 1px solid var(--card-border);
}

.lang-menu-footer-note {
  margin: 0 0 8px;
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--text-muted);
}

.app-content {
  flex: 1;
  padding: 1.75rem;
  max-width: 1200px;
  width: 100%;
}

/* Opt-in via ViewData["WideContent"] (_Layout.cshtml) — pages whose content
   genuinely needs more than 1200px, e.g. the Kanban board's multi-column
   track, without loosening the cap for every other page (forms/tables were
   designed around it). */
.app-content-wide {
  max-width: none;
}

/* ---------- Cards, tables, badges ---------- */

.card {
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card-body {
  padding: 1.25rem 1.35rem;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
}

.table {
  --bs-table-bg: transparent;
}

.table thead th {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom-width: 1px;
  padding-bottom: 0.65rem;
}

.table td {
  vertical-align: middle;
  padding-top: 0.7rem;
  padding-bottom: 0.7rem;
}

.badge {
  font-weight: 600;
  font-size: 0.72rem;
  padding: 0.35em 0.65em;
  border-radius: 999px;
}

/* ---------- Buttons ---------- */

.btn-primary {
  background-color: var(--brand-primary);
  border-color: var(--brand-primary);
}

.btn-primary:hover,
.btn-primary:focus {
  /* Darken the tenant's own brand color at request time — works for any
     custom --brand-primary without needing a precomputed hover shade. */
  background-color: color-mix(in srgb, var(--brand-primary) 85%, black);
  border-color: color-mix(in srgb, var(--brand-primary) 85%, black);
}

.btn-outline-primary {
  color: var(--brand-primary);
  border-color: var(--brand-primary);
}

.btn-outline-primary:hover {
  background-color: var(--brand-primary);
  border-color: var(--brand-primary);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 0.2rem rgba(var(--brand-primary-rgb), 0.15);
}

.rich-text-editor {
  min-height: 260px;
  overflow-y: auto;
}

/* Used where the editor is one of several repeatable rows (Sequences step
   body) rather than a single full-page field (Proposal Templates) — same
   component, shorter default height. */
.rich-text-editor-compact {
  min-height: 120px;
}

.rich-text-editor ul,
.rich-text-editor ol {
  padding-left: 1.5rem;
}

.rich-text-editor:empty::before {
  content: attr(data-placeholder);
  color: #6c757d;
}

.rich-text-editor img {
  max-width: 100%;
}

.rich-text-editor a {
  color: var(--brand-primary);
}

/* Table inserted via the "Tabela" toolbar button (execCommand insertHTML) —
   visible grid while editing; same look wherever the section's raw HTML is
   dumped read-only (the per-row/document live previews). */
.rich-text-table,
.template-preview-section-body table {
  border-collapse: collapse;
  margin: 4px 0;
}

.rich-text-table td,
.rich-text-table th,
.template-preview-section-body table td,
.template-preview-section-body table th {
  border: 1px solid var(--card-border);
  padding: 4px 8px;
  min-width: 24px;
}

/* Small vertical separator between toolbar button groups (formatting /
   alignment / insert / merge variables). */
.toolbar-divider {
  width: 1px;
  align-self: stretch;
  background: var(--card-border);
  margin: 2px 4px;
}

/* Rich-text section toolbar (Proposal Templates) — flat icon buttons in one
   borderless strip, closer to a Gmail/Docs-style compose toolbar than the
   boxed btn-outline-secondary look this replaced. */
.rich-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1px;
  padding: 4px 6px;
  margin-bottom: 6px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
}

.rich-toolbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border: none;
  background: transparent;
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.rich-toolbar-btn:hover {
  background: rgba(15, 23, 42, 0.06);
}

.rich-toolbar-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rich-toolbar-select {
  height: 28px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 12.5px;
  padding: 0 4px;
  color: var(--text-primary);
  cursor: pointer;
  max-width: 150px;
}

.rich-toolbar-select:hover {
  background: rgba(15, 23, 42, 0.06);
}

/* ---------- Page header ---------- */

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.page-header h1 {
  font-size: 1.4rem;
  margin: 0;
}

.agenda-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.agenda-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.agenda-day-label {
  font-size: 14px;
  font-weight: 600;
  text-transform: capitalize;
  min-width: 220px;
}

/* ---------- Stat cards (dashboard) ---------- */

.stat-card {
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  background: var(--card-bg);
  padding: 1.35rem 1.5rem;
  box-shadow: var(--shadow-sm);
}

.stat-card-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stat-card-value {
  font-size: 2.1rem;
  font-weight: 700;
  margin: 0.35rem 0 0.85rem;
}

/* Proposal total stat card (Details): replaces .stat-card-value with one row
   per billing frequency when a proposal mixes one-time and recurring items —
   see ProposalSummary.Subtotals. */
.proposal-total-breakdown {
  margin: 0.4rem 0 0.7rem;
}

.proposal-total-breakdown-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.proposal-total-breakdown-row + .proposal-total-breakdown-row {
  margin-top: 2px;
}

.proposal-total-breakdown-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.proposal-total-breakdown-value {
  font-size: 1.3rem;
  font-weight: 700;
}

/* ---------- Auth pages (no sidebar) ---------- */

.auth-shell {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f7f8fa;
  padding: 1.5rem;
}

.auth-lang-slot {
  position: absolute;
  top: 20px;
  right: 20px;
}

.auth-column {
  width: 100%;
  max-width: 412px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-brand-mark {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 10px;
  background: var(--brand-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  overflow: hidden;
}

.auth-brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.auth-brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.auth-brand-name {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-primary);
}

.auth-brand-domain {
  font-size: 10.5px;
  line-height: 1.2;
  color: #94a3b8;
}

.auth-card {
  width: 100%;
  background: #fff;
  border: 1px solid #e4e9f0;
  border-radius: 14px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-card-title {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.4px;
  color: var(--text-primary);
}

.auth-card-subtitle {
  margin: 4px 0 0;
  font-size: 12px;
  color: #64748b;
}

.auth-alert {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 10px;
  padding: 11px 13px;
  font-size: 11.5px;
  font-weight: 500;
  color: #b91c1c;
}

.auth-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.auth-field-label {
  font-size: 11.5px;
  font-weight: 600;
  color: #334155;
}

.auth-input {
  height: 40px;
  padding: 0 12px;
  border: 1px solid #e4e9f0;
  border-radius: 9px;
  font-size: 13px;
  color: var(--text-primary);
  background: #fff;
}

.auth-input:focus {
  outline: none;
  border-color: var(--brand-primary);
}

.auth-field-hint {
  font-size: 10.5px;
  color: #94a3b8;
}

.auth-submit {
  width: 100%;
  height: 42px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
}

.auth-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  font-size: 11.5px;
}

.auth-links a {
  color: var(--brand-primary);
  font-weight: 600;
  text-decoration: none;
}

.auth-links a:hover {
  text-decoration: underline;
}

/* ---------- Responsive: sidebar becomes an overlay drawer ---------- */

.sidebar-backdrop {
  display: none;
}

@media (max-width: 991.98px) {
  .app-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1030;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }

  .app-shell.sidebar-mobile-open .app-sidebar {
    transform: translateX(0);
    width: var(--sidebar-width);
  }

  /* On mobile the collapsed/expanded desktop state doesn't apply — the
     drawer is either fully open (above) or fully hidden. */
  .app-shell.sidebar-collapsed .app-sidebar {
    width: var(--sidebar-width);
  }

  .app-shell.sidebar-mobile-open .sidebar-brand-name,
  .app-shell.sidebar-mobile-open .sidebar-section-label,
  .app-shell.sidebar-mobile-open .sidebar-nav-link-text {
    display: block;
  }

  .app-shell.sidebar-mobile-open .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 1025;
  }

  .app-content {
    padding: 1.25rem;
  }

  .tenant-badge span {
    display: none;
  }
}

/* ---------- Shared page header slot (Views/Shared/_PageHeader.cshtml) ----------
   Opt-in via ViewData["PageHeading"]/ViewData["Breadcrumb"] — a view that sets
   neither renders nothing here, so the topbar looks exactly as it did before
   this was added. */

.page-header-slot {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 120px;
  min-width: 0;
}

.page-header-breadcrumb {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-header-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   Formulários de Edit/Create — mesma linguagem das listas: um cartão só,
   campos em duas colunas (rótulo + dica à esquerda, controle à direita),
   separador entre linhas, ações no pé alinhadas à direita.
   ========================================================================== */

.form-panel {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px 18px;
  max-width: 860px;
}

.form-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 16px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid #f1f5f9;
}

.form-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.form-row-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.form-row-label > label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.form-row-hint {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  text-wrap: pretty;
}

/* Campo que ocupa a linha inteira (textarea longa, editor, tabela de itens). */
.form-row-wide {
  grid-template-columns: minmax(0, 1fr);
}

/* Duas colunas de campo lado a lado (label em cima do input em cada uma),
   diferente de .form-row (um único par label-esquerda/valor-direita). */
.form-row-2col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid #f1f5f9;
}

.form-row-2col:first-child {
  border-top: 0;
  padding-top: 0;
}

.form-row-2col .form-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-primary);
}

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

.plan-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--card-border);
  border-radius: 9px;
  cursor: pointer;
  transition: var(--transition);
}

.plan-card:hover {
  border-color: #cbd5e1;
}

.plan-card:has(input:checked) {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 2px var(--brand-primary);
}

.plan-card-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.plan-card-detail {
  font-size: 10.5px;
  color: var(--text-muted);
}

/* Wider variant of .form-panel for forms with a 2-column body (.form-cols)
   — additive modifier, kept separate so the ~20 other single-column forms
   sharing .form-panel are untouched. */
.form-panel-wide {
  max-width: 1080px;
}

/* Two independent stacks of .form-row side by side (e.g. Activities'
   Tipo/Assunto/Notas/Vencimento on the left, Empresa/Contato/Negócio on the
   right) — each column keeps its own .form-row:first-child border reset
   since it's a separate flex/grid child. */
.form-cols {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 0 32px;
}

@media (max-width: 760px) {
  .form-cols {
    grid-template-columns: minmax(0, 1fr);
  }
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 16px;
  margin-top: 4px;
  border-top: 1px solid #f1f5f9;
}

/* Cancel is marked up as .btn-link (bare text, Bootstrap default) so it
   doesn't compete with the primary Save button, but that leaves it looking
   like a stray hyperlink instead of a clickable action — give it real
   button chrome (border + padding) while keeping it visually secondary. */
.form-actions .btn-link {
  color: var(--text-muted);
  text-decoration: none;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 6px 16px;
}

.form-actions .btn-link:hover,
.form-actions .btn-link:focus {
  color: var(--text-primary);
  background: var(--row-hover);
  text-decoration: none;
}

/* ---------- Topbar icon buttons (search / notifications) ----------
   Inert this round (real `disabled` attribute) — no unified search endpoint
   or notification model exists yet. See design_handoff_crm_vendas_ui/README. */

.topbar-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  height: 34px;
  width: 34px;
  border: 1px solid var(--card-border);
  background: #fff;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.topbar-icon-btn svg {
  width: 18px;
  height: 18px;
}

.topbar-icon-btn:hover:not(:disabled) {
  background: #f1f5f9;
  color: var(--text-primary);
}

.topbar-icon-btn:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

/* ---------- Dashboard ---------- */

.dash-col {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(212px, 1fr));
  gap: 14px;
}

.kpi-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 15px 16px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  transition: var(--transition);
}

.kpi-card:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-md);
}

.kpi-card-label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
}

.kpi-card-value {
  font-size: 25px;
  font-weight: 600;
  letter-spacing: -0.8px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.kpi-card-delta-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.kpi-card-delta {
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.kpi-card-delta-positive {
  color: var(--ok);
}

.kpi-card-delta-negative {
  color: #b91c1c;
}

.kpi-card-delta-label {
  font-size: 10.5px;
  color: #94a3b8;
  white-space: nowrap;
}

.kpi-card-track {
  height: 4px;
  border-radius: 4px;
  background: var(--track);
  overflow: hidden;
}

.kpi-card-track-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--brand-primary);
}

.dash-row-2col {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-start;
}

.dash-panel {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
}

.dash-panel-funnel {
  flex: 1.55 1 420px;
  padding: 16px 18px 10px;
}

.dash-panel-goals {
  flex: 1 1 380px;
  padding: 16px 18px;
}

.dash-panel-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.dash-panel-heading {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dash-panel-title {
  font-size: 13px;
  font-weight: 600;
}

.dash-panel-subtitle {
  font-size: 11px;
  color: #94a3b8;
}

.dash-panel-highlight {
  font-size: 11px;
  font-weight: 600;
  color: var(--brand-primary);
  white-space: nowrap;
}

.dash-funnel-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding-bottom: 8px;
}

.dash-funnel-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  text-align: left;
}

.dash-funnel-row:hover {
  opacity: 0.82;
}

.dash-funnel-label {
  min-width: 84px;
  flex: 0 1 auto;
  font-size: 12px;
  font-weight: 500;
  color: #334155;
  white-space: nowrap;
}

.dash-funnel-bar {
  flex: 1 1 auto;
  min-width: 70px;
  height: 22px;
  border-radius: 5px;
  background: var(--track);
  overflow: hidden;
}

.dash-funnel-value {
  width: 84px;
  flex: none;
  text-align: right;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.dash-funnel-count {
  width: 52px;
  flex: none;
  text-align: right;
  font-size: 11px;
  color: #94a3b8;
  white-space: nowrap;
}

.dash-panel-agenda {
  padding: 16px 18px;
}

.dash-agenda-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dash-agenda-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 4px;
  border-radius: 6px;
  text-decoration: none;
  color: inherit;
}

.dash-agenda-row:hover {
  background: var(--track);
}

.dash-agenda-time {
  width: 52px;
  flex: none;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--brand-primary);
}

.dash-agenda-subject {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-agenda-with {
  flex: none;
  font-size: 11px;
  color: var(--text-muted);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-agenda-tag {
  flex: none;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.dash-agenda-connect {
  display: inline-block;
  margin-top: 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--brand-primary);
}

.dash-goals-list {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.dash-goal-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dash-goal-row-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dash-goal-avatar {
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 50%;
  background: var(--track);
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
}

.dash-goal-name {
  flex: 1;
  font-size: 12px;
  font-weight: 500;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-goal-meta {
  font-size: 11px;
  color: #64748b;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.dash-goal-track {
  height: 5px;
  border-radius: 5px;
  background: var(--track);
  overflow: hidden;
}

.dash-goal-fill {
  height: 100%;
  border-radius: 5px;
}

.dash-attention {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.dash-attention-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.dash-attention-title {
  font-size: 13px;
  font-weight: 600;
}

.dash-attention-more {
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  white-space: nowrap;
}

.dash-alert-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(262px, 1fr));
  gap: 12px;
}

.dash-alert-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  text-align: left;
  padding: 13px 14px;
  border: 1px solid var(--card-border);
  border-left: 3px solid var(--brand-primary);
  border-radius: 10px;
  background: #fdfcfb;
  cursor: pointer;
  transition: var(--transition);
}

.dash-alert-card:hover {
  background: var(--warn-bg);
  border-color: var(--warn-line);
  border-left-color: var(--brand-primary);
}

.dash-alert-tag {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand-primary);
}

.dash-alert-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.dash-alert-body {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.45;
}

.dash-footer {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.dash-footer-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  color: inherit;
  text-decoration: none;
  transition: var(--transition);
}

.dash-footer-link:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-sm);
  color: inherit;
}

.dash-footer-link-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dash-footer-link-value {
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.dash-footer-link-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.dash-footer-link-arrow {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: #94a3b8;
}

/* List pattern (Companies/Index and, per the UI redesign roadmap, every
   other list screen going forward): filter pills + a fixed-grid table.
   UI redesign round 3. */

.list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.filter-pill-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  height: 31px;
  padding: 0 13px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text-primary);
  text-decoration: none;
  white-space: nowrap;
  transition: var(--transition);
}

.filter-pill:hover {
  border-color: #cbd5e1;
  color: var(--text-primary);
}

.filter-pill.active {
  background: #101725;
  border-color: #101725;
  color: #fff;
}

.filter-pill-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  margin-left: 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: #eef2f7;
  color: var(--text-muted);
}

.filter-pill.active .filter-pill-count {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

/* Footer bar inside a .list-table card: record range + per-page selector +
   prev/next — lives as the last child of .list-table so its own overflow:
   hidden clips the corners into the card, same trick the head row uses. */
.list-table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  padding: 11px 18px;
  background: #f8fafc;
  border-top: 1px solid #f1f5f9;
}

.list-table-footer-count {
  font-size: 11.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.list-table-footer-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.list-table-page-size {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
}

.list-table-page-size select {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-primary);
  padding: 3px 22px 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--card-border);
  background: #fff;
}

.list-table-pagination {
  display: flex;
  align-items: center;
  gap: 4px;
}

.list-table-pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--card-border);
  background: #fff;
  color: var(--text-primary);
  transition: var(--transition);
}

.list-table-pagination-btn svg {
  width: 15px;
  height: 15px;
}

.list-table-pagination-btn:hover {
  background: var(--row-hover);
}

.list-table-pagination-btn.disabled {
  color: var(--text-muted);
  pointer-events: none;
  opacity: 0.5;
}

.list-table-pagination-current {
  font-size: 11.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  padding: 0 4px;
}

/* Header and rows MUST share the exact same grid-template-columns string —
   with a floor (minmax(96px, Xfr)), not minmax(0, Xfr) — or the two drift
   apart and the borders stop lining up (README's "armadilha #1"). */
.list-table {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  /* Sem overflow:hidden de propósito — cortava o menu suspenso "⋮" (Editar/
     Suspender/Renovar/etc.) sempre que ele precisava aparecer perto da borda
     da tabela, em qualquer lista que usa esse componente. O arredondamento
     do topo é feito diretamente no cabeçalho (única parte com fundo
     diferente do card) em vez de depender do clip do container. */
}

.list-table-head,
.list-row {
  display: grid;
  grid-template-columns: 28px minmax(160px, 2.1fr) minmax(96px, 1.1fr) minmax(96px, 1.2fr) minmax(120px, 1.3fr);
  align-items: center;
  gap: 12px;
  padding: 11px 18px;
}

.list-table-head {
  background: #f8fafc;
  border-radius: var(--radius) var(--radius) 0 0;
}

.list-table-head-cell {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.list-row {
  border-top: 1px solid #f1f5f9;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  color: inherit;
  /* Sem isso, qualquer clique com o menor microarrasto do mouse (comum em
     touchpad) vira uma seleção de texto em vez de um clique — e o navegador
     cancela silenciosamente o evento de clique nesse caso, sem erro nenhum.
     Foi a causa raiz de "⋮ não abre" reportado em produção 2026-08-14: o
     clique nem chegava a disparar o listener do Bootstrap. */
  user-select: none;
}

.list-row:hover {
  background: var(--row-hover);
  color: inherit;
}

.list-cell {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-cell-checkbox {
  min-width: 0;
}

.list-cell-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.list-cell-sub {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 1px;
}

.list-cell-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
}

.list-cell-stage-value {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.list-cell-value {
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Sort/filter header — Views/Shared/_ListTableHeader.cshtml. Same grid rule
   as .list-table-head/.list-row above: this element's grid-template-columns
   is passed in as a parameter and must match the row grid exactly. */
.list-table-head-cell.sortable a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.list-table-head-cell.sortable a:hover {
  color: var(--text-primary);
}

.list-table-sort-arrow {
  font-size: 8px;
}

.list-table-filter-row {
  display: grid;
  align-items: center;
  gap: 12px;
  padding: 6px 18px 10px;
  background: #f8fafc;
  border-bottom: 1px solid #f1f5f9;
}

.list-table-filter-cell .form-control,
.list-table-filter-cell .form-select {
  font-size: 11.5px;
  padding: 3px 8px;
  height: auto;
}

/* Integrações (IntegrationsHub\Index): grid de cards, um por serviço. */
.integrations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 16px;
}

.integration-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.integration-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.integration-card-name {
  font-size: 13.5px;
  font-weight: 600;
}

.integration-card-description {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.integration-card-facts {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.integration-card-actions {
  margin-top: auto;
  padding-top: 4px;
}

/* Assinatura de e-mail (/PersonalEmail) — mesmo tom visual de .integration-card
   (borda + raio + padding generosos) mas com mais respiro, para não parecer
   um textarea qualquer dentro do hub. */
.signature-editor-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 20px 22px;
  max-width: 720px;
}

.signature-editor-card-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.signature-preview {
  border: 1px dashed var(--card-border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  background: #fafafa;
  min-height: 60px;
}

/* Ações por linha nas listas de cadastro de Configurações. As listas
   operacionais (Empresas, Contatos) navegam pela linha inteira; estas têm
   Editar/Excluir explícitos, então a linha não é clicável. */
.list-row-static {
  cursor: default;
}

.list-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  align-items: center;
}

.list-row-actions form {
  margin: 0;
}

/* Proposals/Index: up to 6 buttons per row (PDF+link always, plus up to 4
   status actions) read as one crowded cluster with plain flex-wrap. Grouping
   them visually (utility vs. status-changing) plus a divider keeps the row
   scannable even when it wraps on narrower widths. */
.list-row-actions-grouped {
  gap: 10px;
}

.list-row-action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.list-row-action-group + .list-row-action-group {
  padding-left: 10px;
  border-left: 1px solid var(--card-border);
}

/* Base color comes in via the inline custom property --stage-color — same
   color-mix() technique .btn-primary already uses for its hover/active
   shades, just mixed toward white instead of black so the pill stays light. */
.stage-pill {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  max-width: 100%;
  color: var(--stage-color, var(--text-muted));
  background: color-mix(in srgb, var(--stage-color, var(--text-muted)) 14%, white);
  border: 1px solid color-mix(in srgb, var(--stage-color, var(--text-muted)) 33%, white);
}

.list-cell-no-deal {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* ==========================================================================
   Ficha 360 (Companies/Edit) — UI redesign round 4
   ========================================================================== */

/* Header card: avatar + name/stage pill + facts row (left), two stacked
   action buttons in a fixed 172px column (right). #101725 is a literal value
   from the design handoff (README 4.3) — it reads close to --sidebar-bg
   (#111827) but is a distinct swatch chosen for this one card, not the same
   token, so it's kept as a literal rather than reused. */
.detail-header {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  flex-wrap: wrap;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.detail-avatar {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: #101725;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  font-weight: 600;
  flex-shrink: 0;
}

.detail-header-main {
  flex: 1 1 320px;
  min-width: 0;
}

.detail-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.detail-name {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.4px;
  color: var(--text-primary);
}

.detail-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.detail-fact {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.detail-fact-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  white-space: nowrap;
}

.detail-fact-value {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.detail-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 172px;
  flex-shrink: 0;
}

.detail-actions .btn {
  width: 100%;
}

/* Body: 3 columns (summary / tabs / contacts+next-action), collapsing to a
   single stacked column on narrow viewports. Only used by Companies/Edit —
   fixed-width side columns (unlike the auto-fit/minmax technique used by
   card grids elsewhere) because the left summary specifically needs to stay
   narrow regardless of viewport width. */
.detail-body {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 300px;
  gap: 18px;
  align-items: start;
  margin-top: 18px;
}

@media (max-width: 1100px) {
  .detail-body {
    grid-template-columns: minmax(0, 1fr);
  }
}

.detail-summary-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.detail-summary-avatar {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--brand-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
}

.detail-summary-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-summary-field-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.detail-summary-field-value {
  font-size: 12.5px;
  color: var(--text-primary);
  word-break: break-word;
}

.detail-summary-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Tab strip: nowrap buttons + overflow-x:auto on the container (README 5,
   armadilha #4) so a tenant with a long custom pipeline never breaks the
   layout. Active tab reads #0F172A with an inset bottom border in the brand
   color instead of a background change. */
.detail-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--card-border);
  overflow-x: auto;
  white-space: nowrap;
  margin-bottom: 14px;
}

.detail-tab {
  padding: 9px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  box-shadow: inset 0 -2px 0 transparent;
  white-space: nowrap;
  flex-shrink: 0;
}

.detail-tab:hover {
  color: var(--text-primary);
}

.detail-tab.active {
  color: #0f172a;
  box-shadow: inset 0 -2px 0 var(--brand-primary);
}

.detail-tab-panel {
  display: none;
}

.detail-tab-panel.active {
  display: block;
}

/* Timeline: 22px rail, 9px dot with a soft glow ring via color-mix(), a
   vertical --card-border line connecting items. Dot color comes in via
   --dot-color, same "inline custom property + color-mix()" technique
   .stage-pill already uses for the Companies list's stage pill. */
.timeline-item {
  display: flex;
  gap: 12px;
}

.timeline-rail {
  width: 22px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.timeline-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-top: 4px;
  flex-shrink: 0;
  background: var(--dot-color, var(--brand-primary));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--dot-color, var(--brand-primary)) 22%, white);
}

.timeline-line {
  flex: 1;
  width: 1px;
  min-height: 18px;
  margin-top: 4px;
  background: var(--card-border);
}

.timeline-item:last-child .timeline-line {
  display: none;
}

.timeline-content {
  flex: 1;
  min-width: 0;
  padding-bottom: 18px;
}

.timeline-item:last-child .timeline-content {
  padding-bottom: 0;
}

.timeline-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.timeline-timestamp {
  font-size: 10.5px;
  color: var(--text-muted);
  white-space: nowrap;
}

.timeline-body {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: 2px;
}

/* "Próxima ação" — the most important element of the right column
   (README 4.3). #9A3412/#7C2D12 are literal one-off colors used only here,
   on top of the already-existing --warn-bg/--warn-line tokens from round 1 —
   not worth a named token for a combination used exactly once. */
.next-action-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  border-radius: 10px;
  padding: 14px;
}

.next-action-title {
  font-size: 12.5px;
  font-weight: 600;
  color: #9a3412;
}

.next-action-subtitle {
  font-size: 11.5px;
  color: #7c2d12;
}

.next-action-card .btn {
  width: 100%;
}

/* Calm, neutral counterpart shown when there's no pending action — must NOT
   look like the urgent orange card above. */
.next-action-empty {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--content-bg);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 14px;
}

.next-action-empty-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.next-action-empty-subtitle {
  font-size: 11.5px;
  color: var(--text-muted);
}

.next-action-empty .btn {
  width: 100%;
}

/* Contacts list under "Próxima ação" — no role pill (Decisor/Influencia/
   Bloqueio from the mockup has no real data source on Contact, same
   "don't fabricate UI" call as every prior round). */
.contact-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.contact-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.contact-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand-primary-light);
  color: var(--brand-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

.contact-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-meta {
  font-size: 10.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   Kanban de Negócios (Deals/Index) — UI redesign round 5
   ========================================================================== */

.kanban-track {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 10px;
}

.kanban-column {
  width: 288px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Header lives outside the column's shaded track background — dot in the
   stage's color (same inline --dot-color + color-mix() technique used by
   .stage-pill/the Ficha 360 timeline dot), name, then the column total. */
.kanban-column-header {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 2px;
}

.kanban-column-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--dot-color, var(--text-muted));
}

.kanban-column-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.kanban-column-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #eef2f7;
  color: #64748b;
  font-size: 10.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.kanban-column-total {
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  white-space: nowrap;
  margin-left: auto;
}

.kanban-column-body {
  background: var(--kanban-bg);
  border-radius: var(--radius);
  padding: 9px;
  min-height: 180px;
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: var(--transition);
}

.kanban-load-more {
  display: block;
  flex-shrink: 0;
  margin-top: 2px;
  padding: 8px;
  border: 1px dashed var(--card-border);
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
}

.kanban-load-more:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

/* Visual highlight while a dragged card is over this column (drop target). */
.kanban-column-body.is-drop-target {
  box-shadow: inset 0 0 0 2px var(--brand-primary);
}

.deal-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 11px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: grab;
  transition: var(--transition);
}

.deal-card:hover {
  border-color: var(--brand-primary);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.07);
}

/* Reduced opacity on the card being dragged, applied by site.js's dragstart
   handler — the card stays in the DOM (not removed) until the page reloads
   after a successful drop, so a failed/cancelled drag just needs this class
   removed to look exactly like it did before. */
.deal-card.is-dragging {
  opacity: 0.5;
}

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

.deal-card-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.deal-card-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.deal-card-days {
  font-size: 10.5px;
  font-weight: 400;
  color: var(--text-muted);
}

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

.deal-card-owner {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.deal-card-owner-name {
  font-size: 10.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* 20px variant of .contact-avatar's same "initials on a tinted circle"
   technique, sized down for the card's tight bottom row. */
.deal-card-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--brand-primary-light);
  color: var(--brand-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9.5px;
  font-weight: 600;
  flex-shrink: 0;
}

.deadline-pill {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 20px;
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}

.deadline-pill.is-overdue {
  background: var(--danger-bg);
  color: #b91c1c;
}

.deadline-pill.is-today {
  background: var(--warn-bg);
  color: #9a3412;
}

.deadline-pill.is-ontrack {
  background: #f1f5f9;
  color: #64748b;
}

/* Deliberately calmer than .is-ontrack — a deal with no pending activity at
   all isn't "on track" (that would fabricate reassurance the data doesn't
   support), just neutral/unremarkable. */
.deadline-pill.is-none {
  background: #f8fafc;
  color: var(--text-muted);
}

/* ---------- Roadmap placeholder (Views/Roadmap/Index.cshtml) ----------
   Empty/preview screens for sidebar groups that don't have a real module
   behind them yet (Atendimento/Financeiro/Análise) — shown per the
   mockup's menu structure, but honest that there's no data or
   functionality here. */

.roadmap-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  max-width: 420px;
  margin: 64px auto;
  padding: 40px 32px;
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 12px;
}

.roadmap-placeholder svg {
  width: 32px;
  height: 32px;
  color: var(--text-muted);
}

.roadmap-placeholder h2 {
  font-size: 15.5px;
  font-weight: 600;
  margin: 0;
}

.roadmap-placeholder p {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

.roadmap-placeholder-badge {
  margin-top: 6px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 3px 10px;
  border-radius: 20px;
  background: #f1f5f9;
  color: #64748b;
}

/* Rodada 6 — Configurações (hub mestre-detalhe): _SettingsLayout.cshtml
   wraps the 10 existing settings screens with a fixed left-hand list +
   right-hand content panel, both flowing inside .app-content already
   provided by _Layout.cshtml. */
.settings-shell {
  display: grid;
  grid-template-columns: minmax(200px, 264px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 8px;
  position: sticky;
  top: 16px;
}

.settings-nav-item {
  display: block;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-nav-item:hover {
  background: var(--row-hover);
}

.settings-nav-item.active {
  background: #f8fafc;
  color: var(--brand-primary);
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--brand-primary);
}

.settings-detail {
  min-width: 0;
}

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

  .settings-nav {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
  }
}

/* Marca (Branding/Index): curated primary-color swatches next to the
   existing native <input type="color">. */
.color-swatch {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--card-border);
  cursor: pointer;
  padding: 0;
}

.color-swatch.selected {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--brand-primary);
}

/* Marca (Branding\Index): slots de upload de logo/favicon. */
.upload-slot-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.upload-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 82px;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  background: #f8f9fc;
  padding: 8px 14px;
  cursor: pointer;
  overflow: hidden;
}

.upload-slot-preview {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
}

.upload-slot-placeholder {
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
}

/* Marca (Branding\Index): pré-visualização ao vivo reagindo à cor/nome
   antes de publicar — puramente client-side, sem novo campo no tenant. */
.branding-preview {
  display: flex;
  height: 172px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.branding-preview-sidebar {
  width: 96px;
  flex-shrink: 0;
  background: #111827;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding-top: 16px;
}

.branding-preview-mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
}

.branding-preview-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.branding-preview-name {
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  text-align: center;
  padding: 0 6px;
}

.branding-preview-section-label {
  margin-top: 8px;
  text-transform: uppercase;
  letter-spacing: .05em;
  text-align: center;
  padding: 0 6px;
}

.branding-preview-nav-item {
  margin-top: 4px;
  font-size: 10px;
  font-weight: 500;
  text-align: center;
  padding: 0 6px;
}

.branding-preview-content {
  flex: 1;
  background: #f4f5f9;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 14px;
}

.branding-preview-button {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
}

/* Papéis (Roles/Index): permission matrix — 5 real PermissionCatalog codes
   + MaxDiscountPercent, not the fabricated categories from the original
   design mockup. */
.role-matrix {
  display: grid;
  min-width: 640px;
}

.role-matrix-header {
  padding: 10px 12px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--card-border);
}

.role-matrix-cell {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--card-border);
}

.role-matrix-cell.text-center {
  justify-content: center;
}

.role-matrix-name {
  display: flex;
  align-items: center;
  gap: 8px;
}

.role-matrix-clickable {
  cursor: pointer;
}

.role-matrix-clickable:hover {
  background: var(--row-hover);
}

.role-matrix-check {
  color: var(--ok);
  font-weight: 700;
  font-size: 15px;
}

.role-matrix-dot {
  color: var(--text-muted);
  font-size: 18px;
}

/* Roles Index — one summary card per role (replaces the old hardcoded
   5-column matrix, which doesn't scale to ~86 granular permissions). */
.role-summary-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.role-summary-card {
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 12px 16px;
  background: var(--card-bg, #fff);
}

.role-summary-card-clickable {
  cursor: pointer;
}

.role-summary-card-clickable:hover {
  background: var(--row-hover);
}

.role-summary-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.role-summary-card-name {
  font-weight: 700;
  font-size: 14.5px;
}

.role-summary-card-total {
  margin-left: auto;
  font-size: 12.5px;
  color: var(--text-muted);
}

.role-summary-card-delete {
  margin: 0;
}

.role-summary-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.role-summary-module-badge {
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-subtle, #F1F5F9);
  color: var(--text-default);
  font-variant-numeric: tabular-nums;
}

.role-summary-module-badge-empty {
  color: var(--text-muted);
}

.role-summary-module-badge-discount {
  background: transparent;
  border: 1px dashed var(--card-border);
}

/* Grouped module/resource/action checkbox matrix (Roles Create/Edit) — see
   _RolePermissionMatrix.cshtml. Chips per resource instead of a rigid
   fixed-column grid, since resources have varying action sets (2-4). */
.role-permission-standalone {
  padding: 10px 12px;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  background: var(--surface-subtle, #F8FAFC);
}

.role-permission-module {
  border: 1px solid var(--card-border);
  border-radius: 10px;
  margin-bottom: 12px;
  overflow: hidden;
}

.role-permission-module-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface-subtle, #F8FAFC);
  border-bottom: 1px solid var(--card-border);
}

.role-permission-module-title {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.role-permission-select-all {
  padding: 0;
  font-size: 12px;
}

.role-permission-resource-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--card-border);
}

.role-permission-resource-row:last-child {
  border-bottom: none;
}

.role-permission-resource-name {
  min-width: 160px;
  font-size: 13.5px;
  font-weight: 600;
}

.role-permission-resource-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
}

/* Command palette (Ctrl+K / Cmd+K) — global overlay, see site.js. */
.topbar-shortcut-hint {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  border: 1px solid var(--card-border);
  border-radius: 6px;
  padding: 1px 6px;
  margin-left: -4px;
}

.command-palette-overlay {
  position: fixed;
  inset: 0;
  z-index: 1050;
  background: rgba(15, 23, 42, 0.34);
  backdrop-filter: blur(2px);
  display: flex;
  justify-content: center;
  padding-top: 14vh;
}

.command-palette-panel {
  width: 520px;
  max-width: calc(100% - 32px);
  max-height: 60vh;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: command-palette-pop 180ms ease-out;
}

@keyframes command-palette-pop {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.command-palette-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--card-border);
  flex-shrink: 0;
}

.command-palette-input-icon {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.command-palette-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 14.5px;
  color: var(--text-primary);
  background: transparent;
}

.command-palette-esc-hint {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  border: 1px solid var(--card-border);
  border-radius: 6px;
  padding: 1px 6px;
  font-family: inherit;
}

.command-palette-results {
  overflow-y: auto;
  padding: 8px;
}

.command-palette-section-label {
  padding: 8px 8px 4px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.command-palette-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.command-palette-item:hover {
  background: var(--row-hover);
}

.command-palette-item-icon {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 8px;
  background: #f1f5f9;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
}

.command-palette-item-text {
  min-width: 0;
  flex: 1;
}

.command-palette-item-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.command-palette-item-sublabel {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.command-palette-item-type {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
}

.command-palette-empty {
  padding: 24px 12px;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-muted);
}

/* ==========================================================================
   Editor de Modelo de Proposta — layout de 2 colunas (formulário + preview
   ao vivo do documento, com dados fictícios no lugar das {{variáveis}}).
   ========================================================================== */

/* Mock da capa real do PDF (ProposalPdfDocument.ComposeCoverPage) — sempre
   presente, nunca editável aqui (dado vem de Marca + do Negócio, nunca
   digitado no modelo). Existe pra fechar a lacuna de "não consigo gerar
   capa": antes disso, nada no editor sequer mencionava que uma capa existe. */
.template-cover-block {
  position: relative;
  color: #ffffff;
  border-radius: var(--radius);
  padding: 28px 24px;
  margin-bottom: 20px;
  overflow: hidden;
  max-width: 860px;
}

.template-cover-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.82);
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.template-cover-hint a {
  color: #ffffff;
  font-weight: 600;
  text-decoration: underline;
  white-space: nowrap;
}

.template-cover-logo {
  max-width: 140px;
  max-height: 60px;
  object-fit: contain;
  margin-bottom: 16px;
}

.template-cover-title {
  font-size: 22px;
  font-weight: 700;
}

.template-cover-formal-number {
  font-size: 12px;
  opacity: 0.9;
  margin-bottom: 14px;
}

.template-cover-meta-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  opacity: 0.85;
}

.template-cover-meta-value {
  font-size: 13px;
}

.template-cover-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.35);
  margin: 16px 0;
}

.template-cover-issuer-name {
  font-size: 13px;
  font-weight: 700;
}

.template-cover-issuer-line {
  font-size: 11.5px;
  opacity: 0.92;
}

.template-cover-recipient-company {
  font-size: 14px;
  font-weight: 700;
  margin-top: 2px;
}

.template-cover-recipient-name {
  font-size: 12px;
  opacity: 0.92;
}

/* Cover color picker — reuses the same .color-swatch/.color-swatch.selected
   classes Marca (Branding/Index) defines, so both screens share one visual
   language for "pick a brand color". Sits inside .template-cover-block, on
   top of whatever color is currently chosen, so contrast is deliberately
   loose (works acceptably against light and dark swatch colors alike). */
.template-cover-color-picker {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.template-cover-color-picker-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: rgba(255, 255, 255, 0.85);
  margin-right: 2px;
}

.template-cover-color-hex {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.85);
  font-variant-numeric: tabular-nums;
}

.template-cover-color-reset {
  border: none;
  background: none;
  padding: 0;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: underline;
  cursor: pointer;
  margin-left: 4px;
}

.template-cover-color-reset.is-active {
  color: #ffffff;
  font-weight: 700;
}

/* Editor de Modelo de Proposta — formulário à esquerda, prévia do documento
   montado à direita (lado antes livre). Ordem visual fixada via `order`
   (não pela ordem no DOM — ver _ProposalTemplateDocumentPreview.cshtml). */
.template-editor-doc {
  display: grid;
  grid-template-columns: minmax(0, 860px) minmax(380px, 620px);
  gap: 24px;
  align-items: start;
}

.template-editor-doc .form-panel {
  order: 1;
}

.template-editor-doc .template-preview-panel {
  order: 2;
}

@media (max-width: 1320px) {
  .template-editor-doc {
    grid-template-columns: minmax(0, 860px);
  }

  .template-editor-doc .template-preview-panel {
    position: static;
    max-height: none;
  }
}

.template-preview-panel {
  position: sticky;
  top: 84px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px 18px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
}

.template-preview-panel-header h2 {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 4px;
}

.template-preview-panel-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  margin: 0 0 14px;
}

.template-preview-page {
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 20px 18px;
  box-shadow: 0 1px 3px rgba(17, 24, 39, 0.06);
}

.template-preview-section {
  min-width: 0;
}

.template-preview-section + .template-preview-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #f1f5f9;
}

.template-preview-page-empty {
  font-size: 12px;
  font-style: italic;
  color: var(--text-muted);
  text-align: center;
  padding: 24px 8px;
}

/* One .section-row per template section — renders as a card that's either
   showing its final rendered form (".section-row-preview", the default —
   this IS the live preview now, not a separate synced copy) or its edit
   form (".section-row-form", shown only while ".is-editing"). Reuses the
   same white-paper look the old separate preview panel had
   (.template-preview-page), just per-row instead of one big scrolling
   panel. */
.section-row {
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 3px rgba(17, 24, 39, 0.06);
  margin-bottom: 12px;
  overflow: hidden;
}

.section-row.is-dragging {
  opacity: 0.5;
}

.section-row-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--card-border);
  font-size: 11px;
}

.section-row-drag-handle {
  cursor: grab;
  color: var(--text-muted);
  user-select: none;
}

.section-row-kind-badge {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

.section-row-toolbar-actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
}

.section-row-preview {
  padding: 16px 18px;
  cursor: pointer;
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-primary);
  min-height: 24px;
}

.section-row-preview:hover {
  background: var(--card-bg);
}

.section-row-form {
  display: none;
  padding: 14px 16px 16px;
}

.section-row.is-editing .section-row-preview {
  display: none;
}

.section-row.is-editing .section-row-form {
  display: block;
}

.section-row-form-actions {
  margin-top: 10px;
}

.template-preview-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--brand-primary);
  margin: 0 0 6px;
}

.template-preview-section-body p {
  margin: 0 0 6px;
}

.template-preview-section-body ul,
.template-preview-section-body ol {
  margin: 0 0 6px;
  padding-left: 18px;
}

/* Lets a wide pricing table scroll on its own inside a narrow container
   (the new right-side document preview panel, ~300-400px) instead of
   squeezing cell text onto 2-3 lines or pushing the whole page sideways —
   the per-row accordion preview (much wider, up to 860px) rarely needs the
   scrollbar at all, so this is purely additive there. */
.template-preview-table-wrap {
  overflow-x: auto;
  max-width: 100%;
}

.template-preview-table {
  width: 100%;
  min-width: 360px;
  border-collapse: collapse;
  font-size: 11.5px;
}

.template-preview-table th {
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--card-border);
  padding: 4px 6px;
  white-space: nowrap;
}

.template-preview-table td {
  padding: 4px 6px;
  border-bottom: 1px solid #f5f5f7;
  white-space: nowrap;
}

.template-preview-table th:last-child,
.template-preview-table td:last-child {
  text-align: right;
}

.template-preview-auto-note {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 4px;
}

/* One bold line per billing frequency in the products-table mock — mirrors
   ComposeProductsTableWithTotal's real rule (never a combined grand total
   when one-time and recurring amounts are both present). */
.template-preview-totals {
  text-align: right;
  margin-top: 6px;
}

.template-preview-totals div {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}

.template-preview-tl-item {
  margin-bottom: 6px;
}

.template-preview-tl-item:last-child {
  margin-bottom: 0;
}

.owner-filter-menu {
  min-width: 240px;
  max-height: 320px;
  overflow-y: auto;
}

.template-preview-section-empty {
  font-size: 11.5px;
  font-style: italic;
  color: var(--text-muted);
  border: 1px dashed var(--card-border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

/* ---------- Entity picker (search-as-you-type Contact/Company/Deal field) ---------- */

.entity-picker {
  position: relative;
}

.entity-picker-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1050;
  max-height: 260px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  margin-top: 2px;
}

.entity-picker-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
  text-align: left;
}

/* ---------- Projetos: Gantt Nível 2/3 (setas de dependência + arrastar) ---------- */

.gantt-ruler-row {
  font-size: 0.7rem;
  color: var(--text-muted, #8896a6);
}

.gantt-ruler-track {
  height: 16px;
}

.gantt-week-mark {
  position: absolute;
  top: 0;
  transform: translateX(-1px);
  border-left: 1px solid #e5e9f2;
  padding-left: 3px;
  white-space: nowrap;
}

.gantt-rows {
  /* Anchor for .gantt-arrows-overlay — every row's bar position is read via
     getBoundingClientRect() relative to this container's own rect. */
}

.gantt-arrows-overlay {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  overflow: visible;
}

.gantt-arrow {
  fill: none;
  stroke: #94a3b8;
  stroke-width: 1.4;
}

.gantt-bar-draggable {
  cursor: grab;
  touch-action: none;
}

.gantt-bar-draggable.is-dragging {
  cursor: grabbing;
  opacity: 0.85;
  box-shadow: 0 2px 6px rgba(20, 28, 48, 0.25);
}
