.workbench-panel-body:has(.embedded-browser) { display: flex; padding: 0; overflow: hidden; }
/* --border-subtle is not a theme token; without it the tab separators and row lines vanished. */
.embedded-browser, .browser-dialog { --border-subtle: var(--border); }
.embedded-browser { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; }
.browser-navigation { position: relative; display: flex; align-items: center; gap: 2px; padding: 6px 10px 8px; }
/* One rounded field like Safari/Chrome: site icon, readable address, bookmark star. */
.browser-address { flex: 1; min-width: 40px; display: flex; align-items: center; gap: 6px; height: 30px; margin-inline: 4px; padding: 0 4px 0 10px; border: 1px solid transparent; border-radius: 9px; background: var(--surface-2); transition: background-color 120ms, border-color 120ms; }
.browser-address:hover { background: color-mix(in srgb, var(--surface-2) 92%, var(--text-primary) 8%); }
.browser-address:focus-within { background: var(--surface-1, var(--page)); border-color: var(--border-strong, #b0b0aa); }
.browser-address input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; outline: none; background: transparent; color: var(--text-primary); font: 12px/1 var(--font-ui); text-overflow: ellipsis; }
.browser-address-icon { flex: none; display: inline-flex; color: var(--text-muted); }
.browser-address-action { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--text-muted); cursor: pointer; }
.browser-address-action:hover { background: var(--surface-hover); color: var(--text-primary); }
.browser-address-action[aria-pressed="true"] { color: var(--text-primary); }
/* Loading is a thin line under the toolbar, not a status row. */
.browser-progress { position: relative; height: 2px; margin-top: -2px; overflow: hidden; border-bottom: 1px solid var(--border-subtle); box-sizing: content-box; }
.browser-progress[data-active]::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 40%; background: var(--text-secondary); opacity: .55; animation: browser-progress 1.1s ease-in-out infinite; }
@keyframes browser-progress { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
@media (prefers-reduced-motion: reduce) { .browser-progress[data-active]::after { animation: none; width: 100%; opacity: .3; } }
html[data-reduce-motion="true"] .browser-progress[data-active]::after { animation: none; width: 100%; opacity: .3; }
.browser-page-status { color: var(--text-secondary); font-size: 11px; line-height: 18px; margin: 0; padding: 4px 14px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; border-bottom: 1px solid var(--border-subtle); }
/* The title already shows in the tab; keep the live region for assistive tech only. */
.browser-page-status[data-quiet] { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.browser-native-viewport { flex: 1; min-height: 120px; background: var(--page); position: relative; }
.browser-empty { padding: 32px 24px; display: flex; align-items: center; justify-content: center; gap: 10px; height: 100%; color: var(--text-secondary); text-align: left; font-size: 13px; }
.browser-empty > svg { flex: 0 0 auto; }
.browser-tabs { display: flex; align-items: center; gap: 2px; padding: 6px 8px 2px; overflow-x: auto; scrollbar-width: none; min-height: 38px; flex-shrink: 0; }
.browser-tabs::-webkit-scrollbar { display: none; }
/* Tabs are soft pills: no outline box. The selected one is a raised surface. */
.browser-tab { position: relative; display: flex; align-items: center; flex: 0 1 200px; min-width: 72px; height: 30px; border-radius: 8px; color: var(--text-secondary); transition: background-color 120ms, color 120ms; }
.browser-tab:hover { background: var(--surface-hover); color: var(--text-primary); }
.browser-tab[data-selected="true"] { background: var(--surface-1, var(--page)); color: var(--text-primary); box-shadow: 0 1px 2px rgb(0 0 0 / 8%), 0 0 0 .5px rgb(0 0 0 / 6%); }
.browser-tab + .browser-tab::before { content: ""; position: absolute; left: -2px; top: 9px; bottom: 9px; width: 1px; background: var(--border-subtle); }
.browser-tab:hover::before, .browser-tab:hover + .browser-tab::before, .browser-tab[data-selected="true"]::before, .browser-tab[data-selected="true"] + .browser-tab::before { opacity: 0; }
.browser-tab > button { border: 0; background: transparent; color: inherit; cursor: pointer; }
.browser-tab > [role="tab"] { flex: 1; min-width: 0; display: flex; align-items: center; gap: 7px; height: 100%; padding: 0 4px 0 9px; text-align: left; font: 12px/1 var(--font-ui); border-radius: inherit; }
.browser-tab > [role="tab"] span:not(.browser-tab-icon) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.browser-tab-icon { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 4px; object-fit: contain; color: var(--text-muted); }
.browser-tab-spinner { box-sizing: border-box; width: 12px; height: 12px; margin: 2px; border-radius: 50%; border: 1.5px solid color-mix(in srgb, currentColor 25%, transparent); border-top-color: currentColor; animation: browser-tab-spin .8s linear infinite; }
/* A thin contour keeps white or black site icons visible on either theme. */
img.browser-tab-icon { filter: drop-shadow(0 0 .6px rgb(0 0 0 / 45%)); }
html[data-theme="dark"] img.browser-tab-icon { filter: drop-shadow(0 0 .6px rgb(255 255 255 / 50%)); }
@keyframes browser-tab-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .browser-tab-spinner { animation: none; } }
html[data-reduce-motion="true"] .browser-tab-spinner { animation: none; }
/* Close appears on hover or on the selected tab, as in desktop browsers. */
.browser-tab-close { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; margin-right: 5px; padding: 0; border-radius: 5px; opacity: 0; }
.browser-tab:hover .browser-tab-close, .browser-tab[data-selected="true"] .browser-tab-close, .browser-tab-close:focus-visible { opacity: 1; }
.browser-tab-close:hover { background: var(--surface-hover); }
.browser-tabs > .browser-tab-new { flex-shrink: 0; margin-left: 2px; }
.browser-home-form { margin-block: 24px; display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.browser-home-form label { grid-column: 1/-1; }
.browser-home-form input { border: 1px solid var(--border-subtle); border-radius: 8px; background: var(--surface); color: var(--text-primary); padding: 9px 12px; width: 100%; font: inherit; }
.browser-settings-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.browser-agent-setting { margin-bottom: 20px; }

.browser-agent-controls{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:8px 12px;font-size:12px;color:var(--text-secondary);border-bottom:1px solid var(--border-subtle)}
.browser-agent-controls[hidden]{display:none}

.browser-tools { padding: 6px 10px; border-bottom: 1px solid var(--border-subtle); background: var(--page); }
.browser-tools[hidden], .browser-find[hidden] { display: none; }
/* Everything secondary lives in one wrapping row behind the More button. */
.browser-tools-row { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.browser-tools-row > button:not(.icon-button), .browser-zoom > button { border: 0; background: transparent; border-radius: 7px; color: var(--text-secondary); padding: 6px 8px; font: 12px/1.3 var(--font-ui); cursor: pointer; }
.browser-tools button:hover { background: var(--surface-hover); color: var(--text-primary); }
.browser-tools-divider { width: 1px; height: 16px; margin-inline: 4px; background: var(--border-subtle); }
.browser-tools-spacer { flex: 1; }
.browser-zoom { display: inline-flex; align-items: center; }
.browser-zoom > button[data-action="browser-zoom-reset"] { min-width: 46px; font-variant-numeric: tabular-nums; }
.browser-session-select select { max-width: 150px; height: 28px; padding: 0 8px; border: 1px solid var(--border-subtle); border-radius: 7px; background: var(--surface-1, var(--page)); color: var(--text-primary); font: 12px/1 var(--font-ui); }
.browser-find { display: flex; align-items: center; padding: 6px 12px; gap: 4px; border-bottom: 1px solid var(--border-subtle); }
.browser-find input { flex: 1; min-width: 40px; width: 100%; font: 12px var(--font-ui); color: var(--text-primary); background: var(--surface-1); border: 1px solid var(--border); border-radius: 7px; padding: 7px; }
.browser-find > span { flex: none; font-size: 11px; color: var(--text-secondary); }
.browser-dialog { position: fixed; inset: 0; margin: auto; padding: 24px; width: min(520px, calc(100vw - 48px)); max-height: calc(100vh - 64px); overflow-y: auto; border: 1px solid var(--border); border-radius: 16px; background: var(--page); color: var(--text-primary); box-shadow: var(--shadow-search); }
.browser-dialog::backdrop { background: rgb(0 0 0 / 18%); }
.browser-dialog > header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; gap: 12px; }
.browser-dialog h2 { margin: 0; font-size: 18px; font-weight: 550; }
.browser-dialog p { color: var(--text-secondary); font-size: 12px; line-height: 1.7; }
.browser-form-field { display: grid; gap: 8px; margin: 16px 0; font-size: 13px; color: var(--text-secondary); }
.browser-form-field :is(input,textarea) { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-1); color: var(--text-primary); font: inherit; line-height: 1.5; }
.browser-dialog footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
.browser-dialog :focus-visible { outline: 2px solid color-mix(in srgb, var(--text-secondary) 32%, transparent); outline-offset: 2px; }
.browser-library-section h3 { font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.browser-library-section article { display: flex; align-items: center; gap: 5px; padding: 5px 0; border-bottom: 1px solid var(--border-subtle); }
.browser-library-section article > button:first-child { min-width: 0; flex: 1; border: 0; background: transparent; text-align: left; color: var(--text-primary); padding: 8px; border-radius: 8px; cursor: pointer; }
.browser-library-section strong { font-size: 13px; font-weight: 500; }
.browser-library-section small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 4px; font-size: 11px; color: var(--text-secondary); }
.browser-library-section article > button:hover { background: var(--surface-hover); }
