/* Connected apps.
 *
 * A control panel, not a report. The light is the first thing on each card because the
 * whole value of the panel is that the lights are true; the permissions are checkboxes
 * because they are decisions, and a decision should look like one. */

.cx {
  --cx-green: #1a7f4b;
  --cx-amber: #8a5a00;
  --cx-red:   #9a3412;
  --cx-yes:   #1a7f4b;
  --cx-no:    #55605e;

  max-width: 68rem;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.cx-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; }
.cx h1 { margin: 0; font-size: 1.6rem; text-wrap: balance; }
.cx h2 { margin: 0; font-size: 1.1rem; }
.cx h3 { margin: 0; font-size: 1rem; }
.cx-sub { margin: .3rem 0 0; opacity: .72; font-size: .92rem; max-width: 46rem; }
.cx-back { font-size: .9rem; opacity: .8; text-decoration: none; color: inherit; }
.cx-back:hover { opacity: 1; text-decoration: underline; }

.cx-block { display: flex; flex-direction: column; gap: 1rem; }
.cx-block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.cx-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.cx-count { font-size: .85rem; opacity: .65; }

.cx-fault, .cx-notice {
  margin: 0;
  padding: .85rem 1rem;
  border-left: 3px solid var(--cx-red);
  background: color-mix(in srgb, var(--cx-red) 12%, transparent);
  font-size: .92rem;
  line-height: 1.5;
}
.cx-notice { border-left-color: var(--cx-amber); background: color-mix(in srgb, var(--cx-amber) 10%, transparent); }
.cx-empty { margin: 0; opacity: .65; font-size: .92rem; }
.cx-rule { margin: 0; font-size: .85rem; opacity: .7; line-height: 1.5; max-width: 52rem; }

.cx-btn {
  padding: .45rem .9rem;
  font: inherit;
  font-size: .88rem;
  border: 1px solid color-mix(in srgb, currentColor 30%, transparent);
  border-radius: .4rem;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.cx-btn:hover:not(:disabled) { border-color: color-mix(in srgb, currentColor 60%, transparent); }
.cx-btn:disabled { opacity: .45; cursor: not-allowed; }
.cx-btn:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.cx-btn-primary { border-color: currentColor; font-weight: 600; }
.cx-btn-quiet { border-color: transparent; opacity: .7; }
.cx-btn-quiet:hover:not(:disabled) { opacity: 1; }

/* the cards */
.cx-apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr)); gap: 1rem; }
.cx-app {
  display: flex; flex-direction: column; gap: .75rem;
  padding: 1rem 1.1rem;
  border: 1px solid color-mix(in srgb, currentColor 14%, transparent);
  border-radius: .6rem;
}
.cx-app-head { display: flex; gap: .7rem; align-items: flex-start; }
.cx-light { flex: none; width: .8rem; height: .8rem; margin-top: .3rem; border-radius: 50%; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 8%, transparent); }
.cx-light-green { background: var(--cx-green); }
.cx-light-amber { background: var(--cx-amber); }
.cx-light-red   { background: var(--cx-red); }
.cx-app-reason, .cx-app-counts, .cx-app-run { margin: 0; font-size: .85rem; opacity: .75; line-height: 1.45; }
.cx-app-run { min-height: 1.2em; }
.cx-perms { display: flex; flex-direction: column; gap: .3rem; font-size: .88rem; }
.cx-perm { display: flex; align-items: center; gap: .5rem; cursor: pointer; }
.cx-perm input { margin: 0; }
.cx-app-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: auto; }
.cx-plan { font-size: .84rem; opacity: .8; }
.cx-plan-head { margin: 0 0 .3rem; font-weight: 600; }
.cx-plan ul { margin: 0; padding-left: 1.2rem; }
.cx-plan-maybe { opacity: .7; }

/* the documents */
.cx-scroll { overflow-x: auto; }
.cx-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.cx-table th, .cx-table td {
  text-align: left;
  padding: .6rem .7rem;
  border-bottom: 1px solid color-mix(in srgb, currentColor 12%, transparent);
  vertical-align: baseline;
}
.cx-table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; opacity: .6; font-weight: 600; white-space: nowrap; }
.cx-table .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.cx-doc-name { font-weight: 600; }
.cx-doc-why { opacity: .75; font-size: .85rem; max-width: 24rem; }
.pill { display: inline-block; padding: .16rem .5rem; border-radius: 2rem; font-size: .74rem; font-weight: 600; white-space: nowrap; color: #fff; }
.pill-yes { background: var(--cx-yes); }
.pill-no  { background: var(--cx-no); }

/* ask */
.cx-ask { display: flex; gap: .5rem; flex-wrap: wrap; }
.cx-ask input { flex: 1 1 22rem; padding: .55rem .75rem; font: inherit; border: 1px solid color-mix(in srgb, currentColor 30%, transparent); border-radius: .4rem; background: transparent; color: inherit; }
.cx-hits { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .9rem; }
.cx-hit { padding: .8rem 1rem; border-left: 3px solid color-mix(in srgb, currentColor 25%, transparent); }
.cx-hit-from { margin: 0 0 .3rem; font-size: .85rem; opacity: .8; }
.cx-hit-text { margin: 0; font-size: .9rem; line-height: 1.5; white-space: pre-wrap; }

@media (max-width: 40rem) {
  .cx { padding: 1.25rem 1rem 3rem; }
  .cx-apps { grid-template-columns: 1fr; }
}
