/* ==========================================================================
   extensions.css — the Extensions view, panel tabs added by extensions,
   the Terminal and the App tab (Tkinter windows drawn like Windows apps).
   ========================================================================== */

/* ---------- Panel tabs from extensions ---------- */
.panel-tabs { display: flex; gap: 4px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.panel-tabs::-webkit-scrollbar { display: none; }
.panel-tab { flex: none; }
.panel-pane { position: absolute; inset: 0; }
.panel.resizing iframe { pointer-events: none; }

/* ---------- Extensions view ---------- */
.ext-body { display: flex; flex-direction: column; gap: 10px; padding: 4px 12px 16px; }
.ext-search .text-input { font-size: 13px; }
.ext-section {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--c-fg-muted);
}
.ext-count { font-variant-numeric: tabular-nums; padding: 0 6px; border-radius: 8px; background: var(--c-hover); }
.ext-list { display: flex; flex-direction: column; gap: 2px; margin: 0 -12px; }
.ext-item { position: relative; border-left: 2px solid transparent; }
.ext-item.open { background: var(--c-hover); border-left-color: var(--c-accent); }
.ext-item.off .ext-icon, .ext-item.off .ext-text { opacity: .55; }
.ext-head {
  display: flex; gap: 10px; align-items: flex-start; width: 100%;
  padding: 8px 12px 8px 10px; text-align: left; color: var(--c-fg);
}
.ext-head:hover { background: var(--c-hover); }
.ext-head:focus-visible { outline: 1px solid var(--c-accent); outline-offset: -1px; }
.ext-icon {
  flex: none; width: 38px; height: 38px; border-radius: 6px;
  display: grid; place-items: center;
  font: 700 13px/1 var(--font-code); color: #fff; letter-spacing: -.02em;
}
.ext-text { min-width: 0; display: grid; gap: 2px; }
.ext-name { display: flex; gap: 6px; align-items: baseline; min-width: 0; padding-right: 64px; }
.ext-name strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ext-version { font-size: 11px; color: var(--c-fg-muted); font-variant-numeric: tabular-nums; }
.ext-desc { font-size: 12px; color: var(--c-fg-muted); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ext-item.open .ext-desc { -webkit-line-clamp: unset; }
.ext-meta { display: flex; gap: 8px; font-size: 11px; color: var(--c-fg-muted); }
.ext-state.on { color: var(--c-success); }
.ext-actions { position: absolute; top: 8px; right: 10px; }
.ext-toggle { padding: 2px 9px; font-size: 12px; }
.ext-details { padding: 2px 14px 14px 58px; display: grid; gap: 6px; font-size: 12.5px; line-height: 1.5; }
.ext-details h3 { margin: 6px 0 0; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--c-fg-muted); }
.ext-details ul { margin: 0; padding-left: 16px; display: grid; gap: 3px; }
.ext-details .ext-cmds { list-style: none; padding: 0; }
.ext-cmds li { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.ext-cmds .welcome-link { padding: 0; font-size: 12.5px; }
.ext-note { margin: 0; font-size: 12px; color: var(--c-fg-muted); line-height: 1.45; }
.ext-empty { margin: 4px 12px; color: var(--c-fg-muted); }
.ext-custom { display: grid; gap: 6px; }
.pip-list { list-style: none; padding: 0 !important; }
.pip-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-family: var(--font-code); font-size: 12px; }
.pip-list .btn { padding: 1px 8px; font-size: 11.5px; font-family: var(--font-ui); }
.pip-install { display: flex; gap: 6px; }
.pip-install .text-input { min-width: 0; }

/* ---------- Terminal ---------- */
.terminal-pane, .app-pane { display: flex; flex-direction: column; }
.term-bar {
  flex: none; display: flex; align-items: center; gap: 6px;
  padding: 2px 12px 4px; font-size: 12px; color: var(--c-fg-muted);
}
.term-bar .spacer { flex: 1; }
.term-label { margin-left: auto; }
.term-profile {
  padding: 2px 6px; border-radius: 4px; border: 1px solid var(--c-border);
  background: var(--c-input-bg); color: var(--c-fg); font-size: 12px;
}
.term-screen {
  flex: 1; min-height: 0; overflow: auto; padding: 4px 16px 12px;
  font-family: var(--font-code); font-size: 12.5px; line-height: 1.5;
  white-space: pre-wrap; overflow-wrap: anywhere; cursor: text;
}
.term-out > div:empty { min-height: 1.5em; }
.term-line { display: flex; align-items: flex-end; flex-wrap: wrap; }
.term-prompt { white-space: pre; }
.term-input {
  flex: 1; min-width: 6ch; border: 0; padding: 0; margin: 0; outline: none;
  background: transparent; color: var(--c-fg); font: inherit; caret-color: var(--c-cursor);
}
.t-error { color: var(--c-error); }
.t-warn { color: var(--c-warning); }
.t-info { color: var(--c-fg-muted); }
.t-input { color: var(--c-success); }
.t-dir { color: #4f9ddb; font-weight: 600; }
.t-exe, .t-user { color: var(--c-success); }
.t-host { color: #a970d8; }
.t-path { color: var(--c-warning); }
.t-cmd { color: var(--c-accent); }
.t-system { color: var(--c-accent); }

/* ---------- App tab: a desktop for Tk windows ---------- */
.app-status { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-desk {
  position: relative; flex: 1; min-height: 0; overflow: auto;
  background: var(--c-sidebar-bg);
  background-image: radial-gradient(color-mix(in srgb, var(--c-fg) 9%, transparent) 1px, transparent 1px);
  background-size: 18px 18px;
}
.app-empty { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 6px; padding: 16px; color: var(--c-fg-muted); }
.app-empty p { margin: 0; max-width: 46ch; }
.app-hint { font-size: 12px; }

/* Windows: light Windows 10/11 look whatever the editor theme is */
.tkw {
  position: absolute; display: flex; flex-direction: column;
  background: #f0f0f0; color: #000; color-scheme: light;
  border: 1px solid #8a8a8a; box-shadow: 0 8px 28px rgba(0, 0, 0, .35);
  font: 400 12px "Segoe UI", Tahoma, Arial, sans-serif;
  outline: none;
}
.tkw:focus-within, .tkw:focus { border-color: #0078d7; }
.tkw.minimized .tkw-client, .tkw.minimized .tkw-menubar { display: none; }
.tkw-bar {
  flex: none; height: 30px; display: flex; align-items: center; gap: 8px;
  padding-left: 8px; background: #fff; user-select: none; cursor: default; touch-action: none;
}
.tkw-icon {
  width: 16px; height: 16px; border-radius: 3px; flex: none;
  background: linear-gradient(135deg, #3b7fc4 0 50%, #f5c518 50% 100%);
}
.tkw-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.tkw-btns { display: flex; align-self: stretch; }
.tkw-btn { width: 46px; height: 100%; display: grid; place-items: center; color: #000; border-radius: 0; }
.tkw-btn:hover { background: #e5e5e5; }
.tkw-btn.close:hover { background: #e81123; color: #fff; }
.tkw-btn::before { content: ""; display: block; }
.tkw-btn.min::before { width: 10px; height: 1px; background: currentColor; }
.tkw-btn.max::before { width: 9px; height: 9px; border: 1px solid currentColor; }
.tkw-btn.close::before { content: "\2715"; font-size: 12px; line-height: 1; }
.tkw-menubar { flex: none; display: flex; height: 22px; background: #fff; border-bottom: 1px solid #f0f0f0; }
.tk-mb-item { padding: 0 8px; font: inherit; color: #000; border-radius: 0; }
.tk-mb-item:hover { background: #cce8ff; }
.tkw-client { position: relative; overflow: hidden; flex: none; }

/* Widgets */
.tkx { position: absolute; box-sizing: border-box; font: inherit; color: #000; margin: 0; }
.measuring .tkx { box-sizing: content-box; }
.measuring .tkx[hidden] { display: none; }
.tkx.is-disabled { color: #6d6d6d; }
.tk-frame { background: #f0f0f0; }
.tk-label { display: flex; padding: 3px 3px; background: #f0f0f0; overflow: hidden; }
.tk-label .tk-text, .tk-button .tk-text, .tk-check .tk-text { white-space: pre; line-height: 1.25; }
.tk-button {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 3px 9px; background: #e1e1e1; border: 1px solid #adadad; border-radius: 0; overflow: hidden;
}
.tk-button:hover:not(:disabled) { background: #e5f1fb; border-color: #0078d7; }
.tk-button:active:not(:disabled) { background: #cce4f7; border-color: #005499; }
.tk-button:focus-visible { outline: 1px dotted #000; outline-offset: -4px; }
.tk-button.is-ttk { min-width: 75px; }
.tk-button.default { border-color: #0078d7; box-shadow: inset 0 0 0 1px #0078d7; }
.tk-optionmenu { justify-content: space-between; background: #e1e1e1; }
.tk-arrow { font-size: 10px; }
.tk-check { display: flex; align-items: center; gap: 5px; padding: 2px 3px; background: #f0f0f0; cursor: default; user-select: none; outline: none; }
.tk-check:focus-visible .tk-text { outline: 1px dotted #000; }
.tk-box { flex: none; width: 13px; height: 13px; border: 1px solid #333; background: #fff; display: grid; place-items: center; }
.tk-box.radio { border-radius: 50%; }
.tk-check:hover .tk-box { border-color: #0078d7; }
.tk-check.checked .tk-box::after { content: ""; width: 7px; height: 4px; border: solid #000; border-width: 0 0 2px 2px; transform: translateY(-1px) rotate(-45deg); }
.tk-check.checked .tk-box.radio::after { width: 7px; height: 7px; border: 0; border-radius: 50%; background: #000; transform: none; }
.tk-entry { display: flex; background: #fff; border: 1px solid #7a7a7a; }
.tk-entry:focus-within { border-color: #0078d7; }
.tk-input { flex: 1; min-width: 0; width: 100%; border: 0; outline: none; padding: 2px 3px; background: #fff; color: #000; font: inherit; }
.tk-input:disabled { background: #f0f0f0; color: #6d6d6d; }
.tk-spin-btns, .tk-drop-btn { flex: none; display: flex; flex-direction: column; border-left: 1px solid #d0d0d0; }
.tk-spin-btns button { flex: 1; width: 16px; font-size: 8px; line-height: 1; color: #333; background: #f0f0f0; border-radius: 0; }
.tk-spin-btns button:hover, .tk-drop-btn:hover { background: #e5f1fb; }
.tk-drop-btn { width: 18px; justify-content: center; align-items: center; font-size: 10px; color: #333; border-radius: 0; background: #fff; }
.tk-textbox { background: #fff; border: 1px solid #7a7a7a; display: flex; }
.tk-textbox:focus-within { border-color: #0078d7; }
.tk-textarea { flex: 1; width: 100%; resize: none; border: 0; outline: none; padding: 1px 3px; font: inherit; line-height: 1.25; background: #fff; color: #000; }
.tk-scale { display: grid; grid-template-columns: 1fr; align-content: center; justify-items: stretch; gap: 0; background: #f0f0f0; padding: 2px 4px; }
.tk-scale-label, .tk-scale-value { font-size: 11px; text-align: center; font-variant-numeric: tabular-nums; }
.tk-range { width: 100%; margin: 0; accent-color: #0078d7; }
.tk-scale.vertical { grid-template-columns: auto auto; justify-content: center; }
.tk-scale.vertical .tk-range { writing-mode: vertical-lr; width: auto; height: 100%; }
.tk-listbox { background: #fff; border: 1px solid #828790; overflow: auto; padding: 1px; outline: none; cursor: default; user-select: none; }
.tk-listbox:focus { border-color: #0078d7; }
.tk-lb-item { padding: 0 3px; line-height: 1.34; white-space: pre; }
.tk-lb-item.selected { background: #0078d7; color: #fff; }
.tk-canvas { background: #f0f0f0; overflow: hidden; outline: none; }
.tk-canvas-el { position: absolute; left: 0; top: 0; }
.tk-scrollbar { width: 17px; min-height: 34px; background: #f0f0f0; border-left: 1px solid #e6e6e6; }
.tk-scrollbar.horizontal { width: auto; height: 17px; min-width: 34px; min-height: 0; }
.tk-scroll-thumb { margin: 17px 2px; height: 30%; background: #cdcdcd; }
.tk-scrollbar.horizontal .tk-scroll-thumb { margin: 2px 17px; height: auto; width: 30%; min-height: 11px; }
.tk-separator { min-width: 2px; min-height: 2px; border-top: 1px solid #a0a0a0; border-bottom: 1px solid #fff; background: transparent; }
.tk-separator.vertical { border: 0; border-left: 1px solid #a0a0a0; border-right: 1px solid #fff; }
.tk-progress { background: #e6e6e6; border: 1px solid #bcbcbc; overflow: hidden; }
.tk-progress-bar { height: 100%; background: #06b025; }
.tk-progress.vertical { display: flex; align-items: flex-end; }
.tk-progress.indeterminate .tk-progress-bar { width: 30%; animation: tk-indeterminate 1.4s linear infinite; }
@keyframes tk-indeterminate { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
@media (prefers-reduced-motion: reduce) { .tk-progress.indeterminate .tk-progress-bar { animation: none; width: 100%; opacity: .5; } }
.tk-labelframe { background: #f0f0f0; }
.tk-lf-box { position: absolute; left: 0; right: 0; top: 8px; bottom: 0; border: 1px solid #dcdcdc; pointer-events: none; }
.tk-lf-label { position: absolute; left: 8px; top: 0; padding: 0 2px; background: inherit; line-height: 16px; white-space: pre; }
.tk-lf-body { position: absolute; left: 2px; right: 2px; top: 16px; bottom: 2px; }
.tk-labelframe:has(.tk-lf-label[hidden]) .tk-lf-body { top: 4px; }
.tk-notebook { background: #f0f0f0; }
.tk-nb-tabs { position: absolute; left: 0; right: 0; top: 0; height: 24px; display: flex; align-items: flex-end; padding-left: 2px; border-bottom: 1px solid #d9d9d9; }
.tk-nb-tab { padding: 2px 10px; font: inherit; color: #000; background: #f0f0f0; border: 1px solid #d9d9d9; border-bottom: 0; border-radius: 0; margin-right: -1px; }
.tk-nb-tab.active { background: #fff; padding-bottom: 4px; position: relative; top: 1px; }
.tk-nb-tab:hover:not(.active) { background: #e5f1fb; }
.tk-nb-body { position: absolute; left: 1px; right: 1px; top: 25px; bottom: 1px; background: #fff; }
.tk-tree { background: #fff; border: 1px solid #828790; overflow: auto; outline: none; cursor: default; user-select: none; }
.tk-tree-table { border-collapse: collapse; width: 100%; table-layout: fixed; font: inherit; }
.tk-tree-table th { font-weight: 400; text-align: left; padding: 2px 4px; background: #fff; border-right: 1px solid #e5e5e5; border-bottom: 1px solid #e5e5e5; position: sticky; top: 0; white-space: nowrap; overflow: hidden; }
.tk-tree-table td { padding: 1px 4px; height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk-tree-table tr.selected td { background: #0078d7; color: #fff; }

/* Drop-down lists and menus */
.tk-pop {
  position: absolute; z-index: 30; background: #fff; color: #000; color-scheme: light;
  border: 1px solid #ccc; box-shadow: 2px 4px 12px rgba(0, 0, 0, .25); padding: 2px;
  font: 400 12px "Segoe UI", Tahoma, Arial, sans-serif; max-height: 260px; overflow: auto;
}
.tk-drop-item { padding: 2px 6px; white-space: pre; cursor: default; }
.tk-drop-item:hover, .tk-drop-item.selected { background: #0078d7; color: #fff; }
.tk-menu { padding: 3px 0; overflow: visible; }
.tk-menu-item { display: grid; grid-template-columns: 22px 1fr auto; gap: 6px; align-items: center; padding: 3px 14px 3px 4px; cursor: default; white-space: nowrap; }
.tk-menu-item:hover { background: #91c9f7; }
.tk-menu-item.disabled { color: #8d8d8d; }
.tk-menu-item.disabled:hover { background: transparent; }
.tk-menu-check { text-align: center; }
.tk-menu-acc { color: #555; font-size: 11px; }
.tk-menu-sep { height: 1px; background: #d7d7d7; margin: 3px 2px 3px 28px; }

/* Message boxes */
.tk-dialog-layer { position: absolute; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(0, 0, 0, .12); }
.tk-dialog { position: relative; min-width: 260px; max-width: min(440px, 90%); }
.tk-dialog-body { display: flex; gap: 12px; align-items: flex-start; padding: 22px 20px 18px; background: #fff; }
.tk-dialog-icon {
  flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  font: 700 18px/1 Georgia, serif; color: #fff; background: #1d6fd1;
}
.tk-dialog-icon.warning { background: #f2b600; color: #000; border-radius: 4px; clip-path: polygon(50% 0, 100% 100%, 0 100%); padding-top: 8px; }
.tk-dialog-icon.error { background: #d93025; font-family: Arial, sans-serif; }
.tk-dialog-text { white-space: pre-wrap; line-height: 1.45; padding-top: 6px; overflow-wrap: anywhere; }
.tk-dialog-buttons { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 12px; background: #f0f0f0; }
.tk-dialog-buttons .tkx { position: static; min-width: 75px; }
