/* 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 {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid var(--sidebar-border);
  margin-bottom: 0.5rem;
}

.sidebar-brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--brand-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}

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

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

.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: 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-section-label {
  padding: 1rem 0.85rem 0.35rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  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: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  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%;
}

/* ---------- 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;
}

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

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

/* ---------- 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;
}

/* ---------- 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;
}

/* ---------- 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);
}

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

/* ---------- 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-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);
  overflow: hidden;
}

.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;
}

.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;
}

.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;
}

/* 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;
}

/* 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;
  gap: 6px;
  justify-content: flex-end;
  align-items: center;
}

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

/* 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: two columns that collapse to one on narrow viewports — same
   auto-fit/minmax technique as every other card grid in this app. */
.detail-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 18px;
  align-items: start;
  margin-top: 18px;
}

/* 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: 262px;
  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 - 250px);
  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;
}

/* 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-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;
}

/* 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);
}
