/*
 * Connected Apps: the boxed tabs of settings.css (.set-tabs--boxed). deals.css restyles every
 * .set-tabs / .set-tab with !important (underline tabs), which the design page does not load,
 * so the design's look is restored here, scoped to this page.
 */
.ca-scope .set-tabs.set-tabs--boxed {
  display: flex !important;
  align-items: stretch !important;
  gap: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  border-bottom: 1px solid var(--border-strong) !important;
  margin-bottom: var(--sp-5);
  overflow-x: auto !important;
  overflow-y: hidden !important;
}
.ca-scope .set-tabs--boxed .set-tab {
  display: inline-block !important;
  padding: 12px 22px !important;
  margin-bottom: -1px !important;
  border: 1px solid var(--border-strong) !important;
  border-left-width: 0 !important;
  border-bottom-width: 1px !important;
  border-radius: 0;
  background: var(--surface-2) !important;
  color: var(--text-muted) !important;
  font-size: 14.5px !important;
  font-weight: 500 !important;
}
.ca-scope .set-tabs--boxed .set-tab:first-child {
  border-left-width: 1px !important;
  border-top-left-radius: var(--radius-sm);
}
.ca-scope .set-tabs--boxed .set-tab:last-child {
  border-top-right-radius: var(--radius-sm);
}
.ca-scope .set-tabs--boxed .set-tab:hover {
  background: var(--surface-hover) !important;
  color: var(--text) !important;
}
.ca-scope .set-tabs--boxed .set-tab.active {
  background: var(--bg) !important;
  color: var(--text) !important;
  border-bottom-color: var(--bg) !important;
  font-weight: 600 !important;
}
.ca-scope .set-tabs--boxed .set-tab.active::after {
  content: none !important;
  display: none !important;
}

/* "Coming soon — sample data" banner above screens with no backend yet. */
.ca-scope .ca-sample-banner {
  margin-bottom: var(--sp-4);
}

/* Unavailable menu actions (e.g. Disconnect on people's own Gmail): shown, not clickable. */
.ca-scope .dropdown__item[aria-disabled='true'] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Loading / error / empty rows of the My Apps table and the detail page. */
.ca-scope .ca-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-6) var(--sp-4);
  color: var(--text-muted);
  text-align: center;
}

/* Connections listed under the "Needs attention" / "Disconnected" summary. */
.ca-scope .ca-attention-list {
  padding: 0 var(--sp-5) var(--sp-4);
}
.ca-scope .ca-attention-list .ca-expired-icon--warning {
  border-color: var(--warning, #fde68a);
  background: var(--warning-bg);
  color: var(--warning);
}
.ca-scope .ca-attention-more {
  margin: var(--sp-2) 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

/* Real usage numbers (calls / errors / rate limited, last 24 hours) on the detail page. */
.ca-scope .cad-usage-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 0;
}
@media (max-width: 700px) {
  .ca-scope .cad-usage-grid {
    grid-template-columns: 1fr;
  }
}

/* Keep app names readable next to the date / owner columns of the real data. */
.ca-scope #connected-apps-table td:first-child {
  min-width: 160px;
}

/* App info: a long installer name or email stays inside the card (QA #439); hover shows it all. */
.ca-scope .cad-info-sidebar,
.ca-scope .cad-info-card,
.ca-scope .cad-info-val--user {
  min-width: 0;
}
.ca-scope .cad-user-name {
  flex: 1 1 auto;
  min-width: 0;
}
.ca-scope .cad-user-name__line {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* A key's or app's scopes on the detail page (QA #436). */
.ca-scope .cad-scope-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin: 0 0 var(--sp-3);
  padding: 0;
  list-style: none;
}
.ca-scope .cad-scope-list code {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 12px;
}

/* "Review all" filter notice above the My Apps table (QA #424). */
.ca-scope .ca-filter-note {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin: 0 0 var(--sp-3);
  font-size: 13px;
  color: var(--text-muted);
}

/* Days after today can't be picked (reports run up to today). */
.seq-dp__body .seq-dp__day:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* HUB-745 (QA #924): why Disconnect is off, under it in the row's Actions menu. */
.ca-menu-note {
  max-width: 220px;
  margin: 0;
  padding: 2px 12px 8px;
  white-space: normal;
}

/* HUB-745 (QA #928): at 1280px My Apps was 884px wide in a 649px card, so Last Activity Date,
   Actions and emails ran off to the right. Laptop widths let headers and cells wrap. */
@media (max-width: 1439.98px) {
  .set-table-card .su-table th,
  .set-table-card .su-table td {
    padding-inline: 6px;
    white-space: normal;
  }
  .set-table-card .su-table td:first-child .crm-gap-3 {
    gap: 8px;
  }
  .set-table-card .su-table th:first-child,
  .set-table-card .su-table td:first-child {
    min-width: 128px;
  }
  .set-table-card .su-table td .crm-text-subtle {
    overflow-wrap: anywhere;
  }
  .set-table-card .su-table td[data-cell='actions'] {
    white-space: nowrap;
  }
}
