/* Base legada do app (antigo styles.css), parte 16 (#533) · Cliente 360: área, lista configurável e lista hierárquica. Ordem de carga: scripts/helpers/styles-source.js. */

/* Cliente 360 — workspace, lista configurável e ficha lateral */
.crm-360-page {
  gap: 14px;
}

.crm-360-toolbar {
  display: grid;
  grid-template-columns: auto minmax(260px, 1fr) auto auto auto auto;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgb(var(--mix-fx-line, 219 229 240));
  border-radius: 14px;
  background: rgb(var(--mix-fx-paper, 255 255 255));
  box-shadow: 0 5px 18px rgb(42 65 96 / 5%);
}

.crm-360-search-field {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid rgb(var(--mix-fx-line, 206 219 234));
  border-radius: 10px;
  background: rgb(var(--mix-fx-paper, 251 253 255));
}

.crm-360-search-field > span {
  color: rgb(var(--mix-fx-ink-blue, 113 131 153));
  font-size: 20px;
}

.crm-360-search-field input {
  min-width: 0;
  height: 38px;
  padding: 0;
  border: 0;
  outline: 0;
  color: rgb(var(--mix-fx-ink, 16 38 63));
  background: transparent;
}

.crm-360-view-toggle {
  display: flex;
  gap: 3px;
  padding: 3px;
  border-radius: 10px;
  background: rgb(var(--mix-fx-paper, 238 244 250));
}

.crm-360-view-toggle button {
  width: 35px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  color: rgb(var(--mix-fx-ink-blue, 100 123 145));
  background: transparent;
  font-size: 18px;
  cursor: pointer;
}

.crm-360-view-toggle button.active {
  color: rgb(var(--mix-fx-ink-blue, 8 119 201));
  background: rgb(var(--mix-fx-paper, 255 255 255));
  box-shadow: 0 2px 8px rgb(42 65 96 / 12%);
}

.crm-360-columns-menu,
.crm-360-create-menu {
  position: relative;
}

.crm-360-columns-menu > summary {
  display: grid;
  min-height: 40px;
  padding: 0 13px;
  place-items: center;
  border: 1px solid rgb(var(--mix-fx-line, 206 219 234));
  border-radius: 10px;
  color: rgb(var(--mix-fx-ink-blue, 54 83 111));
  background: rgb(var(--mix-fx-paper, 255 255 255));
  font-size: 12px;
  font-weight: 800;
  list-style: none;
  cursor: pointer;
}

.crm-360-columns-menu > summary::-webkit-details-marker {
  display: none;
}

.crm-360-columns-menu > div {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  display: grid;
  gap: 7px;
  width: 260px;
  max-height: min(440px, 70vh);
  overflow-y: auto;
  padding: 13px;
  border: 1px solid rgb(var(--mix-fx-line, 215 227 238));
  border-radius: 12px;
  background: rgb(var(--mix-fx-paper, 255 255 255));
  box-shadow: 0 18px 50px rgb(26 53 82 / 20%);
}

.crm-360-columns-menu label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgb(var(--mix-fx-ink-blue, 65 93 119));
  font-size: 12px;
}

.crm-360-results {
  padding: 14px;
  border-radius: 14px;
  box-shadow: 0 5px 18px rgb(42 65 96 / 5%);
}

.crm-360-result-grid {
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: 9px;
  margin-top: 11px;
}

.crm-360-result-card {
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
}

.crm-360-result-avatar {
  width: 40px;
  height: 40px;
  border-radius: 11px;
}

.crm-360-result-avatar img {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

.crm-360-result-card dl {
  margin-top: 0;
  padding-top: 9px;
}

.crm-360-table-wrap {
  overflow: auto;
  margin-top: 10px;
  border: 1px solid rgb(var(--mix-fx-line, 225 233 241));
  border-radius: 11px;
}

.crm-360-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  color: rgb(var(--mix-fx-ink-blue, 64 90 115));
  font-size: 12px;
}

.crm-360-table th {
  padding: 10px 12px;
  border-bottom: 1px solid rgb(var(--mix-fx-line, 223 232 240));
  color: rgb(var(--mix-fx-ink-blue, 101 123 145));
  text-align: left;
  background: rgb(var(--mix-fx-paper, 247 250 252));
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.crm-360-table td {
  max-width: 280px;
  overflow: hidden;
  padding: 11px 12px;
  border-bottom: 1px solid rgb(var(--mix-fx-line, 237 242 246));
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crm-360-table tbody tr {
  cursor: pointer;
}

.crm-360-table tbody tr:last-child td {
  border-bottom: 0;
}

.crm-360-table tbody tr:hover td {
  background: rgb(var(--mix-fx-paper, 244 249 253));
}

.crm-360-table td.is-primary {
  color: rgb(var(--mix-fx-ink-blue, 8 119 201));
  font-weight: 800;
}

.crm-360-table .crm-360-row-arrow {
  width: 24px;
  color: rgb(var(--mix-fx-ink-blue, 123 145 166));
  font-size: 20px;
}

/* Cliente 360 — lista hierárquica exclusiva de empresas e contatos */
.crm-360-hierarchy-table {
  min-width: 900px;
}

.crm-360-hierarchy-table th > button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.crm-360-hierarchy-table th[data-crm-360-hierarchy-column] {
  cursor: grab;
}

.crm-360-hierarchy-table th[data-crm-360-hierarchy-column].is-dragging {
  opacity: .48;
  cursor: grabbing;
}

.crm-360-search-button {
  position: relative;
}

.crm-360-search-button.is-active {
  border-color: rgb(37 99 235 / 38%) !important;
  background: rgb(37 99 235 / 12%) !important;
  color: var(--mix-blue-deep);
}

.crm-360-search-button > span {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  padding: 0 4px;
  border: 2px solid rgb(var(--mix-fx-line, 255 255 255) / 85%);
  border-radius: 999px;
  background: var(--mix-blue);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
}

.crm-360-hierarchy-table th > button span {
  color: rgb(var(--mix-fx-muted, 145 161 177));
  font-size: 12px;
}

.crm-360-hierarchy-expander {
  width: 42px;
  min-width: 42px;
  padding-right: 4px !important;
  text-align: center !important;
}

.crm-360-hierarchy-expander > button {
  display: inline-grid;
  width: 28px;
  height: 28px;
  padding: 0;
  place-items: center;
  border: 1px solid rgb(var(--mix-fx-line, 215 226 236));
  border-radius: 8px;
  color: rgb(var(--mix-fx-ink-blue, 86 114 140));
  background: rgb(var(--mix-fx-paper, 255 255 255));
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, color .16s ease, transform .16s ease;
}

.crm-360-hierarchy-expander > button:hover:not(:disabled) {
  border-color: rgb(var(--mix-fx-line, 155 200 231));
  color: rgb(var(--mix-fx-ink-blue, 8 119 201));
  background: rgb(var(--mix-fx-paper, 238 248 255));
}

.crm-360-hierarchy-expander > button:disabled {
  opacity: .38;
  cursor: default;
}

.crm-360-hierarchy-expander svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .16s ease;
}

.crm-360-company-group.is-expanded .crm-360-hierarchy-expander > button svg {
  transform: rotate(90deg);
}

.crm-360-company-row td {
  height: 54px;
  background: rgb(var(--mix-fx-paper, 255 255 255));
}

.crm-360-company-row:hover td,
.crm-360-company-group.is-expanded .crm-360-company-row td {
  background: rgb(var(--mix-fx-paper, 242 248 252));
}

.crm-360-company-row td.is-primary small {
  display: block;
  margin-top: 3px;
  color: rgb(var(--mix-fx-muted, 130 148 166));
  font-size: 9px;
  font-weight: 700;
}

.crm-360-company-contacts-row > td {
  max-width: none;
  padding: 0 !important;
  white-space: normal;
  background: rgb(var(--mix-fx-paper, 244 247 249));
}

.crm-360-contact-sublist {
  padding: 12px 16px 16px 54px;
  border-bottom: 1px solid rgb(var(--mix-fx-line, 221 231 239));
}

.crm-360-contact-sublist > header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: rgb(var(--mix-fx-ink-blue, 54 83 111));
}

.crm-360-contact-sublist > header strong {
  font-size: 11px;
}

.crm-360-contact-sublist > header span {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  place-items: center;
  border-radius: 999px;
  color: rgb(var(--mix-fx-ink-blue, 23 106 158));
  background: rgb(var(--mix-fx-paper, 220 239 249));
  font-size: 9px;
  font-weight: 800;
}

.crm-360-contact-subtable-wrap {
  overflow: auto;
  border: 1px solid rgb(var(--mix-fx-line, 217 227 235));
  border-radius: 10px;
  background: rgb(var(--mix-fx-paper, 255 255 255));
}

.crm-360-contact-subtable {
  width: 100%;
  min-width: 790px;
  border-collapse: collapse;
  table-layout: fixed;
}

.crm-360-contact-subtable th,
.crm-360-contact-subtable td {
  padding: 9px 11px;
  border-bottom: 1px solid rgb(var(--mix-fx-line, 233 238 242));
  color: rgb(var(--mix-fx-ink-blue, 82 105 126));
  text-align: left;
  font-size: 10px;
  line-height: 1.35;
}

.crm-360-contact-subtable th {
  color: rgb(var(--mix-fx-muted, 115 134 153));
  background: rgb(var(--mix-fx-paper, 248 250 251));
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.crm-360-contact-subtable th:first-child { width: 22%; }
.crm-360-contact-subtable th:nth-child(2) { width: 16%; }
.crm-360-contact-subtable th:nth-child(3) { width: 15%; }
.crm-360-contact-subtable th:nth-child(4) { width: 20%; }
.crm-360-contact-subtable th:nth-child(5) { width: 16%; }
.crm-360-contact-subtable th:last-child { width: 112px; }

.crm-360-contact-subtable tbody tr {
  cursor: pointer;
}

.crm-360-contact-subtable tbody tr:hover td {
  background: rgb(var(--mix-fx-paper, 244 250 255));
}

.crm-360-contact-subtable tbody tr:last-child td {
  border-bottom: 0;
}

.crm-360-contact-subtable td.is-primary {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgb(var(--mix-fx-ink, 23 63 96));
  font-weight: 800;
}

.crm-360-contact-subtable td.is-primary > span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.crm-360-contact-subtable td.is-primary small {
  display: block;
  margin-top: 2px;
  color: rgb(var(--mix-fx-ink-blue, 113 135 154));
  font-size: 8px;
  font-weight: 700;
}

.crm-360-contact-avatar {
  display: inline-grid;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  overflow: hidden;
  place-items: center;
  border-radius: 9px;
  color: rgb(var(--mix-fx-ink-blue, 23 106 158));
  background: rgb(var(--mix-fx-paper, 220 239 249));
  font-size: 9px;
}

.crm-360-contact-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.crm-360-contact-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.crm-360-contact-action {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid rgb(var(--mix-fx-line, 214 226 235));
  border-radius: 8px;
  color: rgb(var(--mix-fx-ink-blue, 66 102 129));
  background: rgb(var(--mix-fx-paper, 255 255 255));
  text-decoration: none;
}

.crm-360-contact-action:hover {
  border-color: rgb(var(--mix-fx-line, 142 199 234));
  color: rgb(var(--mix-fx-ink-blue, 8 119 201));
  background: rgb(var(--mix-fx-paper, 238 248 255));
}

.crm-360-contact-action.is-disabled {
  opacity: .35;
}

.crm-360-contact-action svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 760px) {
  .crm-360-contact-sublist {
    padding-left: 12px;
  }
}

body.crm-360-drawer-open {
  overflow: hidden;
}

html[data-mix-theme="mix-fiscal-default"] body.crm-360-drawer-open .template-main {
  z-index: 21000 !important;
}
