/* App Bridge (docs/APP_BRIDGE.md): "Open in…" dialog, status toast and the "Continue in a premium app" box of tool
   result pages. Self-contained colours (--ub-*): app workspaces bring their own UI styles, so nothing here relies on
   the page tokens, and every rule is scoped to .uw-bridge-* / .tool-send. Light by default, dark with the site theme. */
.uw-bridge-dialog, .uw-bridge-toast {
  --ub-bg: #ffffff; --ub-bg-2: #f1f3f6; --ub-ink: #101828; --ub-muted: #4b5565; --ub-line: #cdd2da; --ub-accent: #1346cc;
  --ub-on-accent: #ffffff; --ub-focus: #b45309; --ub-shadow: 0 18px 48px rgba(15, 23, 42, .28);
  color-scheme: light;
}
:root[data-theme="dark"] :is(.uw-bridge-dialog, .uw-bridge-toast) {
  --ub-bg: #151920; --ub-bg-2: #1c2129; --ub-ink: #e8ebf0; --ub-muted: #b4bcc8; --ub-line: #3b4350; --ub-accent: #8fb4ff;
  --ub-on-accent: #0b0e14; --ub-focus: #fbbf24; --ub-shadow: 0 18px 48px rgba(0, 0, 0, .6);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) :is(.uw-bridge-dialog, .uw-bridge-toast) {
    --ub-bg: #151920; --ub-bg-2: #1c2129; --ub-ink: #e8ebf0; --ub-muted: #b4bcc8; --ub-line: #3b4350; --ub-accent: #8fb4ff;
    --ub-on-accent: #0b0e14; --ub-focus: #fbbf24; --ub-shadow: 0 18px 48px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
.uw-bridge-frame { display: none; }

.uw-bridge-dialog {
  width: min(32rem, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); overflow: auto; box-sizing: border-box;
  padding: 1.25rem 1.25rem 1rem; border: 1px solid var(--ub-line); border-radius: 14px;
  background: var(--ub-bg); color: var(--ub-ink); box-shadow: var(--ub-shadow);
  font: 400 1rem/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; text-align: start;
}
.uw-bridge-dialog::backdrop { background: rgba(15, 23, 42, .55); }
.uw-bridge-dialog :focus-visible { outline: 3px solid var(--ub-focus); outline-offset: 2px; }
.uw-bridge-dialog h2 { margin: 0 0 .35rem; font-size: 1.2rem; line-height: 1.3; color: var(--ub-ink); }
.uw-bridge-lede { margin: 0 0 .75rem; color: var(--ub-muted); overflow-wrap: anywhere; }
.uw-bridge-status { margin: 0; color: var(--ub-ink); }
.uw-bridge-status:empty { display: none; }
.uw-bridge-list { list-style: none; margin: .5rem 0 1rem; padding: 0; display: grid; gap: .5rem; }
.uw-bridge-list:empty { display: none; }
.uw-bridge-target {
  display: flex; align-items: center; gap: .75rem; min-height: 48px; padding: .6rem .75rem; box-sizing: border-box;
  border: 1px solid var(--ub-line); border-radius: 10px; background: var(--ub-bg-2); color: var(--ub-ink); text-decoration: none;
}
.uw-bridge-target:hover { border-color: var(--ub-accent); }
.uw-bridge-logo { flex: none; width: 32px; height: 32px; }
.uw-bridge-text { display: grid; min-width: 0; }
.uw-bridge-name { font-weight: 700; color: var(--ub-accent); }
.uw-bridge-kind { font-size: .875rem; color: var(--ub-muted); overflow-wrap: anywhere; }
.uw-bridge-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; margin-top: .75rem; }
:where(.uw-bridge-actions) button {
  width: auto; min-height: 44px; margin: 0; padding: .5rem 1rem; border-radius: 8px; font: 600 .95rem/1.2 inherit; cursor: pointer;
  border: 1.5px solid var(--ub-accent); background: var(--ub-bg); color: var(--ub-accent);
}
:where(.uw-bridge-actions) button.uw-bridge-cancel { background: var(--ub-accent); color: var(--ub-on-accent); }

.uw-bridge-toast {
  position: fixed; inset: 56px 1rem auto 1rem; z-index: 2147483000; width: auto; max-width: 28rem; margin: 0 auto; box-sizing: border-box;
  padding: .75rem 1rem; border: 1px solid var(--ub-line); border-radius: 10px; background: var(--ub-bg); color: var(--ub-ink);
  box-shadow: var(--ub-shadow); font: 400 .95rem/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow: visible; pointer-events: none;
}
.uw-bridge-toast[hidden] { display: none; }

/* "Continue in a premium app" under a tool result (server-rendered links; JS hands the result over). */
.tool-send { margin: 1.5rem 0; padding: 1rem 1.25rem; border: 1px solid var(--line, #e2e5ea); border-radius: var(--r-lg, 14px); background: var(--surface, #fff); }
.tool-send h2 { margin: 0 0 .25rem; font-size: 1.15rem; }
.tool-send > p { margin: 0 0 .75rem; }
.tool-send-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.tool-send-list li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; }
.tool-send-what { overflow-wrap: anywhere; font-weight: 600; }
.tool-send-apps { display: flex; flex-wrap: wrap; gap: .5rem; }
@media (prefers-reduced-motion: no-preference) {
  .uw-bridge-dialog[open] { animation: uw-bridge-in .14s ease-out; }
  @keyframes uw-bridge-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
}
