/* Sandboxed dashboard widgets (frontend/chat/board-widget-frame.js): the frame, its loading / waiting / stalled
   states, the access prompt, the granted chip, the inline grant error and the prompt confirmation strip (the error card
   itself is board-chrome.css's). Port of the
   Control UI's styles/board.css, styles/chat/board.css (.board-widget__notice) and styles/mcp-app-confirm.css;
   Control UI tokens (--text, --muted, --ok, --warn, --danger, --border, --primary) come from composer-tokens.css. */

.dashboard-panel .board-widget__body:has(> .board-widget__frame-pane),
.dashboard-panel .board-widget__body:has(> .board-widget__mcp-app),
.dashboard-panel .board-widget__body:has(> .board-widget__grant),
.dashboard-panel .board-widget__body:has(> .board-widget__error) { display: flex; flex-direction: column; }
.dashboard-panel .board-widget__body > * { flex: 1 1 auto; }

.board-widget__mcp-app { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.board-widget__mcp-app > .board-widget__frame-pane { flex: 1 1 auto; }
.board-widget__frame-pane { position: relative; display: flex; flex-direction: column; height: 100%; min-height: 0; }
.board-widget__frame-pane > .board-widget__frame {
  /* Paint over the placeholder without waiting for host readiness. */
  position: relative; display: block; flex: 1; width: 100%; min-height: 0; border: 0; background: transparent;
}
.board-widget__confirm-slot:empty, .board-widget__overlay:empty { display: none; }
.board-widget__overlay { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.board-widget__overlay > * { pointer-events: auto; }
.board-widget__notice {
  overflow: hidden; padding: 4px 8px; color: var(--muted); font-size: 12px; white-space: nowrap; text-overflow: ellipsis;
}
.board-widget__notice .btn { margin-left: 6px; vertical-align: middle; }

/* Loading placeholder (Control UI PanelLoadingSkeleton overlay, compact). */
.board-widget__skeleton { display: grid; align-content: start; gap: 10px; padding: 16px; }
.board-widget__skeleton span {
  display: block; height: 10px; border-radius: 5px; background: rgba(var(--ink), 0.07);
  animation: board-widget-skeleton 1.4s ease-in-out infinite;
}
.board-widget__skeleton span:nth-child(1) { width: 55%; }
.board-widget__skeleton span:nth-child(2) { width: 85%; }
.board-widget__skeleton span:nth-child(3) { width: 70%; }
@keyframes board-widget-skeleton { 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) { .board-widget__skeleton span { animation: none; } }

.board-widget__disabled-plugin, .board-widget__app-loading, .board-widget__stale, .board-widget__grant {
  display: grid; align-content: center; justify-items: center; text-align: center;
}
.board-widget__disabled-plugin, .board-widget__app-loading, .board-widget__stale { color: var(--muted); font-size: 11px; }
.board-widget__disabled-plugin { gap: 10px; margin: 0; min-height: 100%; padding: 14px; box-sizing: border-box; }
.board-widget__disabled-plugin strong { color: var(--text); }
.board-widget__app-loading, .board-widget__stale { gap: 8px; min-height: 160px; padding: 16px; }
.board-widget__stale strong, .board-widget__grant strong { color: var(--text-strong); font-size: 13px; }
.board-widget__stale > span { line-height: 1.45; max-width: 34ch; }

.board-widget__grant { gap: 7px; height: 100%; min-height: 0; padding: 16px; box-sizing: border-box; overflow: auto; }
.board-widget__grant > span { color: var(--muted); font-size: 11px; line-height: 1.45; max-width: 32ch; }
.board-widget__grant-summary {
  display: grid; gap: 4px; margin: 0; padding-left: 18px; max-width: 36ch; color: var(--muted); font-size: 11px; line-height: 1.45; text-align: left;
  overflow-wrap: anywhere;
}
.board-widget__grant-groups { display: grid; gap: 8px; max-width: 100%; text-align: left; }
.board-widget__grant-groups section { display: grid; gap: 3px; }
.board-widget__grant-groups section > strong { color: var(--text-strong); font-size: 10px; text-transform: uppercase; }
.board-widget__grant-mark {
  display: flex; align-items: center; justify-content: center; width: 25px; height: 25px; border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--warn) 55%, transparent); background: color-mix(in srgb, var(--warn) 15%, transparent);
  color: var(--warn); font-size: 13px; font-weight: 700;
}
.board-widget__grant-actions { display: flex; gap: 7px; }
.board-widget__grant-actions button:disabled { cursor: progress; opacity: 0.55; }
.board-widget__grant--rejected { filter: saturate(0.35); opacity: 0.74; }

/* "Granted" chip in the widget bar (its tooltip lists the active capabilities). */
.board-widget__capabilities {
  display: inline-flex; flex: 0 0 auto; padding: 3px 6px; border: 1px solid color-mix(in srgb, var(--ok) 45%, transparent);
  border-radius: 999px; background: color-mix(in srgb, var(--ok) 13%, transparent); color: var(--ok);
  font: inherit; font-size: 9px; font-weight: 650; line-height: 1; text-transform: uppercase; cursor: pointer;
}
@container (max-width: 360px) { .dashboard-panel .board-widget__bar > .board-widget__capabilities { display: none; } }

.board-widget__error--inline { height: auto; margin-top: 4px; padding: 8px; width: min(100%, 320px); }

/* Prompt confirmation strip over a widget (Control UI mcp-app-confirm.css). */
.board-widget__frame-pane .mcp-app-confirm {
  position: relative; z-index: 3; display: flex; flex-wrap: wrap; flex-shrink: 0; align-items: center; gap: 12px; padding: 14px;
  border-bottom: 1px solid var(--border); background: var(--bg-elevated); color: var(--text-strong); font-size: 13px; line-height: 1.4;
}
.board-widget__frame-pane .mcp-app-confirm:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.mcp-app-confirm__copy { flex: 1 1 240px; min-width: 0; }
.mcp-app-confirm__title, .mcp-app-confirm__preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mcp-app-confirm__title { font-weight: 600; }
.mcp-app-confirm__preview { margin-top: 4px; color: var(--muted); }
.mcp-app-confirm__actions { display: flex; flex-shrink: 0; gap: 8px; }
.mcp-app-confirm__actions button {
  padding: 7px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text-strong); font: inherit; cursor: pointer;
}
.mcp-app-confirm__actions .mcp-app-confirm__accept { border-color: var(--primary); background: var(--primary); color: var(--primary-foreground); }
