/* CORA hub — Slack-style two-pane layout. Uses ONLY shared design-system tokens (design-system.css),
   so it is theme-aware in BOTH light and dark (light is the :root default; dark via
   prefers-color-scheme + [data-theme="dark"]). No hardcoded colors; focus is always visible. */
.cora-hub { display: flex; gap: 0; min-height: 60vh; }

.cora-rail {
  flex: 0 0 200px; display: flex; flex-direction: column; gap: 4px;
  padding: 16px 12px; border-right: 1px solid var(--border);
}
.cora-rail .ds-eyebrow { margin: 0 8px 8px; color: var(--ds-text-mute); }
.cora-rail__item {
  appearance: none; -webkit-appearance: none;   /* use our background, not the native control chrome */
  text-align: left; background: transparent; color: var(--ds-text-lo);
  border: 1px solid transparent; border-radius: 10px; padding: 9px 12px; cursor: pointer;
  font: inherit; transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.cora-rail__item:hover { background: var(--surface-hover); color: var(--ds-text-hi); }
.cora-rail__item.is-active { background: var(--surface-hover); border-color: var(--border); color: var(--gold); }
/* Unavailable areas (Messages / Files & Brand): keep the label READABLE in both themes (ds-text-lo
   meets WCAG AA on the hub background) - status is conveyed by a non-contrast cue (italic) + the panel's
   "not available yet" state, not by dimming the text below legibility. */
.cora-rail__item.is-muted { color: var(--ds-text-lo); font-style: italic; }

.cora-main { flex: 1 1 auto; min-width: 0; padding: 18px 22px; }
.cora-main__head { margin-bottom: 14px; }
.cora-main__head .view-title { color: var(--gold); }
.cora-scope { color: var(--ds-text-lo); }
.cora-scope b { color: var(--ds-text-hi); }

/* Contextual create/import launches (open the existing Content Agent / Content Pipeline engines). */
.cora-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.cora-action {
  appearance: none; -webkit-appearance: none; background: transparent; color: var(--gold);
  border: 1px solid var(--border); border-radius: 10px; padding: 7px 14px; font: inherit;
  font-weight: 600; cursor: pointer; transition: background .15s ease, border-color .15s ease;
}
.cora-action:hover { background: var(--surface-hover); border-color: var(--gold); }
.cora-action:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.cora-action:focus { outline: 2px solid var(--gold); outline-offset: 2px; }

/* Engine subview (Content Agent / Content Pipeline / Content Ops opened inside the hub). */
.cora-hub--subview { display: block; }
.cora-subview { padding: 2px; }
.cora-subview__head { margin-bottom: 14px; }
.cora-subview__head .view-title { color: var(--gold); margin-top: 6px; }
.cora-subview__back {
  appearance: none; -webkit-appearance: none; background: transparent; color: var(--ds-text-lo);
  border: 1px solid var(--border); border-radius: 10px; padding: 6px 12px; font: inherit; cursor: pointer;
}
.cora-subview__back:hover { background: var(--surface-hover); color: var(--gold); border-color: var(--gold); }
.cora-subview__back:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.cora-subview__back:focus { outline: 2px solid var(--gold); outline-offset: 2px; }
.cora-subview__body { min-width: 0; }

.cora-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.cora-list { display: flex; flex-direction: column; gap: 8px; }

/* A row is either a non-interactive div (no item to open) or a semantic button (opens the item).
   Both share the card look; the button carries full-width/left-align resets + a pointer + hover +
   a visible focus ring so keyboard users see where they are. */
.cora-row {
  display: flex; flex-direction: column; gap: 4px;
  border: 1px solid var(--border); border-radius: var(--radius-card, 14px);
  padding: 12px 14px; background: var(--surface); color: var(--ds-text);
}
button.cora-row { appearance: none; -webkit-appearance: none; width: 100%; text-align: left; font: inherit; color: var(--ds-text); background: var(--surface); cursor: pointer; transition: border-color .15s ease, background .15s ease; }
button.cora-row:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.cora-row:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.cora-rail__item:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
/* Fallback for engines without :focus-visible (keyboard + mouse both get a ring; acceptable). */
.cora-row:focus { outline: 2px solid var(--gold); outline-offset: 2px; }
.cora-rail__item:focus { outline: 2px solid var(--gold); outline-offset: 2px; }
.cora-row__title { color: var(--ds-text-hi); }
.cora-row__meta { font-size: 0.82em; color: var(--ds-text-lo); }   /* -lo (not -mute) for readable small secondary text in both themes */

@media (max-width: 720px) {
  .cora-hub { flex-direction: column; }
  .cora-rail { flex-basis: auto; flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); }
}

/* ---- Messages (team messaging: channels + threads + compose) ---- token-driven, theme-aware ---- */
.cora-msgs { display: flex; gap: 16px; align-items: flex-start; }
.cora-chan-rail { flex: 0 0 150px; display: flex; flex-direction: column; gap: 4px; }
.cora-ch { position: relative; text-align: left; background: transparent; color: var(--ds-text-lo); border: 1px solid transparent; border-radius: 9px; padding: 8px 10px; font: inherit; cursor: pointer; }
.cora-ch:hover { background: var(--surface-hover); color: var(--ds-text-hi); }
.cora-ch.is-active { background: var(--surface-hover); border-color: var(--border); color: var(--gold); }
.cora-ch:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.cora-ch__badge { display: inline-block; margin-left: 8px; min-width: 18px; text-align: center; background: var(--surface-hover); color: var(--gold); border: 1px solid var(--border); border-radius: 999px; font-size: 0.72em; font-weight: 700; padding: 1px 6px; }
.cora-msgs__main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.cora-stream { display: flex; flex-direction: column; gap: 14px; max-height: 52vh; overflow-y: auto; }
.cora-thread { display: flex; flex-direction: column; gap: 6px; }
.cora-msg { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--surface); }
.cora-msg--reply { margin-left: 22px; border-left: 2px solid var(--border); background: transparent; }
.cora-msg__head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 3px; }
.cora-msg__who { color: var(--gold); font-weight: 600; font-size: 0.9em; }
.cora-msg__at { color: var(--ds-text-lo); font-size: 0.78em; }
.cora-msg__body { color: var(--ds-text-hi); white-space: pre-wrap; font-size: 0.95em; }
.cora-msg__reply { margin-top: 6px; background: transparent; border: 0; color: var(--ds-text-lo); font: inherit; font-size: 0.8em; cursor: pointer; padding: 0; }
.cora-msg__reply:hover { color: var(--gold); }
.cora-msg__reply:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.cora-compose { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; border-top: 1px solid var(--border); padding-top: 12px; }
.cora-compose__replying { flex: 1 0 100%; color: var(--ds-text-lo); font-size: 0.82em; }
.cora-compose__cancel { background: transparent; border: 0; color: var(--gold); font: inherit; cursor: pointer; padding: 0; }
.cora-compose__input { flex: 1 1 auto; min-width: 200px; box-sizing: border-box; background: var(--surface); color: var(--ds-text-hi); border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; font: inherit; resize: vertical; }
.cora-compose__input:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-color: var(--gold); }
.cora-compose__send { background: transparent; color: var(--gold); border: 1px solid var(--border); border-radius: 10px; padding: 9px 18px; font: inherit; font-weight: 700; cursor: pointer; align-self: stretch; }
.cora-compose__send:hover { background: var(--surface-hover); border-color: var(--gold); }
.cora-compose__send:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.cora-compose__send:disabled { opacity: .5; cursor: not-allowed; }
.cora-compose__err { flex: 1 0 100%; margin: 0; color: var(--gold); font-size: 0.82em; min-height: 14px; }
@media (max-width: 720px) { .cora-msgs { flex-direction: column; } .cora-chan-rail { flex-basis: auto; flex-direction: row; flex-wrap: wrap; } }

/* ---- Files & Brand (read-only brand library: approved founder photos + b-roll) ---- token-driven ---- */
.cora-files { display: flex; flex-direction: column; gap: 6px; }
.cora-files__acct { margin: 0 0 2px; color: var(--ds-text-lo); font-size: 0.86em; }
.cora-files__acct b { color: var(--ds-text-hi); }
.cora-files__lead { margin: 0 0 10px; color: var(--ds-text-lo); font-size: 0.9em; }
.cora-files__h { margin: 14px 0 8px; color: var(--ds-text-hi); font-size: 1em; display: flex; align-items: center; gap: 8px; }
.cora-files__count { display: inline-block; min-width: 20px; text-align: center; background: var(--surface-hover); color: var(--gold); border: 1px solid var(--border); border-radius: 999px; font-size: 0.72em; font-weight: 700; padding: 1px 7px; }
.cora-files__note { margin: 0 0 6px; color: var(--ds-text-lo); font-size: 0.88em; }
.cora-files__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.cora-file { border: 1px solid var(--border); border-radius: var(--radius-card, 14px); padding: 11px 13px; background: var(--surface); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cora-file__name { color: var(--ds-text-hi); font-size: 0.92em; overflow-wrap: anywhere; }
.cora-file__meta { color: var(--ds-text-lo); font-size: 0.78em; }
