/* Home demos: the Demo control (demo tool only). A small pill bottom left, 16px right of the Connect sidebar
 * (--dk-left from dock.js), and a popover that opens upwards over the page with its own scroll. It never takes
 * page space. Pattern: the referral demo's dock. */
.dk { position: fixed; z-index: 120; left: var(--dk-left, 1rem); bottom: 3.5rem; width: 20rem; max-width: calc(100vw - var(--dk-left, 1rem) - 1rem); max-height: calc(100vh - 5rem); max-height: calc(100dvh - 5rem); display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 24px 48px -12px rgba(0, 6, 37, 0.22), 0 2px 6px rgba(0, 6, 37, 0.06); font-size: var(--text-sm); transform-origin: bottom left; animation: dkIn 240ms cubic-bezier(0.16, 1, 0.3, 1) both; }
.dk[hidden] { display: none; }
@keyframes dkIn { from { opacity: 0; transform: translateY(6px) scale(0.985); } }

.dk-h { flex: none; display: flex; align-items: flex-start; gap: 0.5rem; padding: 0.75rem 0.625rem 0.625rem 1rem; }
.dk-h > div { flex: 1; display: flex; flex-direction: column; gap: 0.125rem; }
.dk-h b { font-family: var(--font-display); font-size: 1rem; font-weight: 600; letter-spacing: -0.01em; color: var(--ats-title); }
.dk-h small { font-size: var(--text-xs); color: var(--muted-fg); }
.dk-h .btn-icon:hover { color: var(--fg); background: var(--subtle); }
.dk-b { flex: 1; min-height: 0; overflow-y: auto; padding: 0 1rem; overscroll-behavior: contain; }
.dk-g { padding: 0.75rem 0 0.875rem; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 0.625rem; }
.dk-g:first-child { border-top: 0; padding-top: 0.125rem; }
.dk-g h4 { font-family: var(--font-sans); font-size: var(--text-xs); font-weight: 600; letter-spacing: 0; color: var(--fg); }
.dk-f { display: flex; flex-direction: column; gap: 0.3125rem; }
.dk-l { font-size: var(--text-xs); color: var(--muted-fg); }
.dk-note { font-size: var(--text-xs); line-height: 1.45; color: var(--muted-fg); }

/* the direction switcher: one segmented control, letter over name, the current one white with a blue edge */
.dk-dirs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; padding: 2px; border-radius: 9px; background: var(--subtle); border: 1px solid var(--line); }
.dk-dirs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.125rem; min-height: 2.875rem; padding: 0.25rem; border-radius: 7px; border: 1px solid transparent; color: var(--muted-fg); text-decoration: none; text-align: center; transition: color 140ms ease-out, background-color 140ms ease-out; }
.dk-dirs a small { font-family: var(--font-display); font-size: 0.6875rem; font-weight: 600; line-height: 1; opacity: 0.7; }
.dk-dirs a span { font-size: 0.75rem; font-weight: 500; line-height: 1.2; white-space: nowrap; }
.dk-dirs a:hover { color: var(--fg); background: rgba(255, 255, 255, 0.6); }
.dk-dirs a[aria-checked='true'] { background: #fff; border-color: var(--primary-line, rgba(48, 78, 255, 0.3)); color: var(--primary); box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05); }

/* segmented control (as the app's SegmentedTabs) */
.dk-seg { display: flex; gap: 2px; padding: 2px; border-radius: 8px; background: var(--subtle); border: 1px solid var(--line); }
.dk-seg button { flex: 1 1 0; min-width: 0; min-height: 1.875rem; padding: 0 0.375rem; border-radius: 6px; border: 1px solid transparent; font-size: var(--text-xs); font-weight: 500; color: var(--muted-fg); white-space: nowrap; text-align: center; transition: color 140ms ease-out; }
.dk-seg[data-k='plan'] { display: grid; grid-template-columns: 1fr 1fr; } /* 4 plan labels, 2 x 2, none cut off */
.dk-seg button:hover { color: var(--fg); }
.dk-seg button[aria-checked='true'] { background: #fff; border-color: var(--line-2); color: var(--fg); box-shadow: 0 1px 1px rgba(15, 23, 42, 0.04); }

/* contextual controls */
.dk-act { display: flex; align-items: center; gap: 0.5rem; width: 100%; min-height: 2rem; padding: 0 0.625rem; border-radius: 7px; border: 1px solid var(--line-2); background: #fff; font-size: var(--text-xs); font-weight: 500; color: var(--fg-2); text-align: left; transition: border-color 140ms ease-out, color 140ms ease-out; }
.dk-act:hover { border-color: color-mix(in oklab, var(--fg) 28%, var(--line-2)); color: var(--fg); }
.dk-sel { height: 2rem; padding: 0 0.5rem; border-radius: 7px; border: 1px solid var(--line-2); background: #fff; font: inherit; font-size: var(--text-xs); color: var(--fg); }
.dk-sw { display: flex; align-items: center; gap: 0.625rem; min-height: 1.875rem; font-size: var(--text-xs); color: var(--fg); text-align: left; }
.dk-sw-t { flex: none; position: relative; width: 1.875rem; height: 1.125rem; border-radius: 999px; background: #d5d6de; transition: background-color 160ms ease-out; }
.dk-sw-t i { position: absolute; top: 2px; left: 2px; width: calc(1.125rem - 4px); height: calc(1.125rem - 4px); border-radius: 999px; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18); transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1); }
.dk-sw[aria-checked='true'] .dk-sw-t { background: var(--primary); }
.dk-sw[aria-checked='true'] .dk-sw-t i { transform: translateX(0.75rem); }

.dk-ft { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.625rem 1rem; border-top: 1px solid var(--line); }
.dk-reset { white-space: nowrap; display: inline-flex; align-items: center; gap: 0.375rem; font-size: var(--text-xs); font-weight: 500; color: var(--muted-fg); border-radius: 4px; }
.dk-reset:hover { color: var(--fg); }
.dk-st { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: var(--text-xs); color: var(--muted-fg); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* the pill */
/* closed, it is a 32px disc centred on the sidebar's right edge (like the collapse disc at the top), so it sits in the
 * gutter and never covers page content */
.dk-pill { position: fixed; z-index: 121; left: max(0.5rem, calc(var(--dk-left, 1rem) - 2rem)); bottom: 1rem; display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; padding: 0; border-radius: 999px; border: 1px dashed var(--line-2); background: #fff; color: var(--fg-2); font-size: var(--text-xs); font-weight: 500; box-shadow: 0 4px 14px -6px rgba(15, 23, 42, 0.25); transition: color 140ms ease-out, border-color 140ms ease-out; }
.dk-pill:hover, .dk-pill.on { color: var(--fg); border-color: var(--fg-2); }
.dk-pill.on { border-style: solid; }
.dk-dirs a:focus-visible, .dk-pill:focus-visible, .dk-seg button:focus-visible, .dk-act:focus-visible, .dk-sw:focus-visible, .dk-reset:focus-visible, .dk-sel:focus-visible, .dk-h .btn-icon:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
/* phones: the closed pill sits bottom right, slightly see-through, clear of the cards' text column */
@media (max-width: 640px) {
	.dk-pill { left: auto; right: 0.25rem; bottom: 0.75rem; width: 1.75rem; height: 1.75rem; opacity: 0.8; }
	.dk-pill:hover, .dk-pill:focus-visible, .dk-pill.on { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) { .dk { animation: none; } }
@media print { .dk, .dk-pill { display: none; } }
