/* The operator's Channels tab (js/admin-channels.js,
   js/admin-channel-sheets.js). Loaded by index.html after admin-ops.css. Only
   what the tab needs beyond app.css's and components.css's shared parts: a
   grid of cards, the lines inside a card, and the webhook field of the
   sheets. Colours, spaces and type sizes are tokens from app.css or from
   the block below.

   A card, wide or narrow, is one column of lines:
     [ icon  name                          ]
     [ kind: where the messages go         ]
     [ target, in the mono face            ]
     [ route tags, wrapping                ]
     [ last test, when there has been one  ]
     [ actions, wrapping                   ]
   and the grid puts as many cards side by side as fit. */

:root {
  --admin-channel-card-min: 340px;  /* two cards side by side on a desktop, one on a phone */
  --admin-channel-icon: 32px;       /* the same square as a sheet's close button */
}

.channel-toolbar { margin-bottom: var(--space-4); }
[data-part="channels"] > .callout { margin-bottom: var(--space-4); }

.channel-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--admin-channel-card-min)), 1fr));
  gap: var(--space-4);
}

.channel-card .panel-head { margin-bottom: var(--space-2); }
.channel-card h2 { overflow-wrap: anywhere; }

.channel-icon {
  display: grid;
  place-items: center;
  width: var(--admin-channel-icon);
  height: var(--admin-channel-icon);
  border-radius: var(--radius-control);
  background: var(--sunken);
  color: var(--ink2);
}

.channel-kind { margin: 0; color: var(--ink2); }

/* A variable's name, an address or a hint: an identifier, so the mono face,
   and one that can be long, so it wraps wherever it must. */
.channel-target {
  margin: var(--space-1) 0 0;
  color: var(--mute);
  font: 400 var(--text-m)/18px var(--font-mono);
  overflow-wrap: anywhere;
}

.channel-routes {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: var(--space-3) 0 0;
  padding: 0;
  list-style: none;
}

/* The reason is a sentence: it wraps inside its lamp instead of widening the
   card. */
.channel-result { margin: var(--space-3) 0 0; color: var(--ink2); }
.channel-result .tag { white-space: normal; }

.channel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.channel-hint { margin: var(--space-2) 0 0; }
.channel-note { margin: var(--space-4) 0 0; }

/* A thumb, not a pointer: the phone's full-size control, as the Users tab
   does. */
@media (max-width: 820px) {
  .channel-actions .btn { min-height: var(--control); }
  .channel-toolbar .btn { flex: 1 1 auto; }
}

/* --- the sheets --------------------------------------------------- */

/* components.css takes the top margin off the first field of a body, and
   `first-of-type` counts the route list (a fieldset) as one: it needs the
   gap back, below the name line of the routes sheet and below the last
   input. */
.sheet .body > fieldset.checks:first-of-type { margin-top: var(--space-4); }

/* A pasted webhook is long and unbroken; the field scrolls it, the sheet does
   not widen. */
.sheet input[name="webhook_url"] { min-width: 0; font-family: var(--font-mono); }
.sheet .field .err { margin-bottom: 0; }
