/* ── CLI Workspace Styles v3 ─────────────────────────────────────────────────
   Glassmorphism dark theme com animacoes suaves, xterm.js integrado.
   Escopo .cliws-scope aplicado tanto na pagina standalone quanto no embed. */

.cliws-scope {
  --bg: #060b16;
  --surface: #0b1223;
  --sidebar-bg: #080e1d;
  --sidebar-border: rgba(30, 58, 110, 0.25);
  --header-bg: #0a1121;
  --header-border: rgba(30, 58, 110, 0.3);
  --accent: #3b82f6;
  --accent-2: #6366f1;
  --accent-hover: #2563eb;
  --accent-glow: rgba(59,130,246,.22);
  --text: #e2e8f0;
  --text-2: #94a3b8;
  --text-muted: #64748b;
  --text-dim: #475569;
  --border: rgba(30, 41, 59, 0.6);
  --border-hi: rgba(59, 130, 246, 0.2);
  --item-hover: rgba(59,130,246,.07);
  --item-active: rgba(59,130,246,.14);
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
  --tab-bg: #0d1629;
  --tab-active: #0f1a30;
  --input-bg: rgba(0,0,0,.25);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-sm: 0 2px 8px rgba(0,0,0,.4);
  --shadow-md: 0 8px 32px rgba(0,0,0,.55);
  --glass: rgba(11, 18, 35, 0.7);
  --bg-elevated: rgba(255,255,255,.03);
  --bg-secondary: #0a1121;
  --bg-hover: rgba(59,130,246,.07);
  --text-primary: #e2e8f0;
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 13px;
}

.cliws-scope * { box-sizing: border-box }

/* ═══════════════════════ TOP BAR ═══════════════════════ */
.cliws-scope .topbar {
  display: flex; align-items: center; height: 48px;
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  z-index: 100; position: relative; padding: 0 10px 0 0;
  backdrop-filter: blur(12px);
}
.cliws-scope .topbar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 0 18px; border-right: 1px solid var(--header-border);
  height: 100%; min-width: 210px;
  background: linear-gradient(135deg, rgba(59,130,246,.06), transparent);
}
.cliws-scope .topbar-icon { color: var(--accent); font-size: 17px; filter: drop-shadow(0 0 6px rgba(59,130,246,.4)); }
.cliws-scope .topbar-title {
  font-weight: 700; font-size: 14px; letter-spacing: .02em;
  background: linear-gradient(90deg, #60a5fa, #a78bfa);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.cliws-scope .topbar-badge {
  background: rgba(59,130,246,.12); color: #60a5fa;
  border: 1px solid rgba(59,130,246,.25); border-radius: 5px;
  padding: 2px 8px; font-size: 9.5px; font-weight: 700; letter-spacing: .07em;
}
.cliws-scope .topbar-tabs {
  display: flex; align-items: flex-end; flex: 1;
  overflow-x: auto; overflow-y: hidden; height: 100%;
  padding-left: 6px; scrollbar-width: none;
}
.cliws-scope .topbar-tabs::-webkit-scrollbar { display: none }
.cliws-scope .session-tab {
  display: flex; align-items: center; gap: 7px;
  padding: 0 15px; height: 40px;
  border-radius: 8px 8px 0 0;
  background: var(--tab-bg); border: 1px solid var(--border);
  border-bottom: none; cursor: pointer; white-space: nowrap;
  transition: all .16s var(--ease); font-size: 11.5px; color: var(--text-muted);
  margin-right: 3px; margin-top: 8px; position: relative;
  max-width: 190px; min-width: 120px;
}
.cliws-scope .session-tab:hover { background: #13213b; color: var(--text); border-color: var(--border-hi); }
.cliws-scope .session-tab.active {
  background: var(--bg); border-color: var(--accent);
  color: var(--text); border-bottom-color: var(--bg);
  box-shadow: 0 -2px 8px rgba(59,130,246,.08);
}
.cliws-scope .session-tab .tab-proto { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.cliws-scope .session-tab .tab-proto.ssh { background: var(--success); box-shadow: 0 0 5px rgba(34,197,94,.4); }
.cliws-scope .session-tab .tab-proto.telnet { background: var(--warning); box-shadow: 0 0 5px rgba(245,158,11,.4); }
.cliws-scope .session-tab .tab-label { overflow: hidden; text-overflow: ellipsis; flex: 1; font-weight: 500; }
.cliws-scope .session-tab .tab-close {
  opacity: 0; background: none; border: none; color: var(--text-muted);
  cursor: pointer; padding: 2px 5px; border-radius: 3px; font-size: 11px;
  transition: all .12s var(--ease);
}
.cliws-scope .session-tab:hover .tab-close { opacity: 1 }
.cliws-scope .session-tab .tab-close:hover { background: rgba(239,68,68,.18); color: var(--danger); }
.cliws-scope .tab-new-btn {
  background: none; border: 1px solid var(--border); color: var(--text-muted);
  width: 30px; height: 30px; border-radius: 7px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s var(--ease); margin: auto 6px; flex-shrink: 0; font-size: 12px;
}
.cliws-scope .tab-new-btn:hover { background: var(--item-hover); color: var(--accent); border-color: var(--accent); transform: translateY(-1px); }
.cliws-scope .topbar-actions {
  display: flex; align-items: center; gap: 5px; padding-left: 10px;
  border-left: 1px solid var(--header-border); height: 100%;
}
.cliws-scope .tb-btn {
  display: flex; align-items: center; gap: 6px; padding: 6px 12px;
  background: transparent; border: 1px solid var(--border);
  border-radius: 6px; color: var(--text-muted); cursor: pointer;
  transition: all .15s var(--ease); font-size: 11.5px; font-weight: 500;
}
.cliws-scope .tb-btn:hover { background: var(--item-hover); color: var(--text); border-color: var(--border-hi); }
.cliws-scope .tb-btn.tb-danger:hover { background: rgba(239,68,68,.08); border-color: var(--danger); color: var(--danger); }
.cliws-scope .tb-btn.tb-accent { color: var(--accent); border-color: rgba(59,130,246,.2); }
.cliws-scope .tb-btn.tb-accent:hover { background: rgba(59,130,246,.1); }
.cliws-scope .tb-divider { width: 1px; height: 22px; background: var(--border); margin: 0 5px; }

/* ═══════════════════════ LAYOUT ═══════════════════════ */
.cliws-scope .workspace-layout { display: flex; height: calc(100vh - 48px); }

/* ═══════════════════════ SIDEBAR ═══════════════════════ */
.cliws-scope .sidebar {
  width: 275px; min-width: 170px; max-width: 480px;
  background: var(--sidebar-bg); border-right: 1px solid var(--sidebar-border);
  display: flex; flex-direction: column; position: relative;
  transition: width .2s var(--ease);
  backdrop-filter: blur(8px);
}
.cliws-scope .sidebar-header {
  padding: 12px 12px 0; display: flex; flex-direction: column; gap: 8px;
  border-bottom: 1px solid var(--sidebar-border); padding-bottom: 12px;
}
.cliws-scope .sidebar-search {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.03); border: 1px solid var(--border);
  border-radius: 7px; padding: 6px 11px; transition: border-color .15s var(--ease);
}
.cliws-scope .sidebar-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.cliws-scope .sidebar-search i { color: var(--text-muted); font-size: 12px; }
.cliws-scope .sidebar-search input {
  background: none; border: none; color: var(--text);
  outline: none; width: 100%; font-size: 12px; font-family: inherit;
}
.cliws-scope .sidebar-search input::placeholder { color: var(--text-dim); }
.cliws-scope .sidebar-actions { display: flex; gap: 5px; justify-content: flex-end; }
.cliws-scope .icon-btn {
  background: none; border: 1px solid var(--border); color: var(--text-muted);
  width: 30px; height: 30px; border-radius: 6px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; transition: all .15s var(--ease);
}
.cliws-scope .icon-btn:hover { background: var(--item-hover); color: var(--accent); border-color: var(--accent); transform: translateY(-1px); }
.cliws-scope .tree-container { flex: 1; overflow-y: auto; padding: 6px 0; }
.cliws-scope .tree-container::-webkit-scrollbar { width: 4px; }
.cliws-scope .tree-container::-webkit-scrollbar-thumb { background: rgba(59,130,246,.12); border-radius: 2px; }
.cliws-scope .tree-loading { display: flex; align-items: center; gap: 8px; color: var(--text-muted); padding: 20px 16px; font-size: 12px; }
.cliws-scope .sidebar-resize {
  position: absolute; right: 0; top: 0; bottom: 0; width: 5px;
  cursor: col-resize; z-index: 10; background: transparent;
  transition: background .15s var(--ease);
}
.cliws-scope .sidebar-resize:hover, .cliws-scope .sidebar-resize:active { background: var(--accent); }
.cliws-scope .sidebar-section-title {
  padding: 8px 14px 5px; font-size: 10px; text-transform: uppercase;
  color: var(--text-dim); font-weight: 700; letter-spacing: .1em;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--sidebar-border);
}

/* ═══════════════════════ TREE ═══════════════════════ */
.cliws-scope .tree-folder, .cliws-scope .tree-host {
  display: flex; align-items: center; gap: 7px; padding: 6px 10px;
  cursor: pointer; border-radius: 6px; transition: all .12s var(--ease);
  user-select: none; position: relative; margin: 1px 4px;
}
.cliws-scope .tree-folder:hover, .cliws-scope .tree-host:hover { background: var(--item-hover); }
.cliws-scope .tree-host.connecting { background: rgba(59,130,246,.07); }
.cliws-scope .tree-host.active-session { background: var(--item-active); border-left: 2px solid var(--accent); }
.cliws-scope .tree-host .host-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.cliws-scope .tree-host .host-dot.ssh { background: var(--success); box-shadow: 0 0 4px rgba(34,197,94,.3); }
.cliws-scope .tree-host .host-dot.telnet { background: var(--warning); box-shadow: 0 0 4px rgba(245,158,11,.3); }
.cliws-scope .tree-host.device-host { border-left: 2px solid rgba(59,130,246,.25); padding-left: 8px; }
.cliws-scope .tree-host.device-host:hover { border-left-color: var(--accent); }
.cliws-scope .tree-host .host-dot.device-status { animation: cliws-pulse-dot 2.5s ease-in-out infinite; }
.cliws-scope .tree-host .host-dot.device-status.online { background: #22c55e; box-shadow: 0 0 0 0 rgba(34,197,94,.4); }
.cliws-scope .tree-host .host-dot.device-status.offline { background: #ef4444; animation: none; }
@keyframes cliws-pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,.4); }
  50% { box-shadow: 0 0 0 5px rgba(34,197,94,0); }
}
.cliws-scope .tree-folder-chevron { color: var(--text-dim); font-size: 10px; transition: transform .18s var(--ease); width: 12px; text-align: center; flex-shrink: 0; }
.cliws-scope .tree-folder.open .tree-folder-chevron { transform: rotate(90deg); }
.cliws-scope .tree-icon { color: var(--text-muted); font-size: 12px; flex-shrink: 0; }
.cliws-scope .tree-folder .tree-icon { color: #3b82f6; }
.cliws-scope .tree-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.cliws-scope .tree-folder .tree-label { font-weight: 600; color: var(--text); }
.cliws-scope .tree-host .tree-label { color: var(--text-2); }
.cliws-scope .tree-host:hover .tree-label { color: var(--text); }
.cliws-scope .tree-children { padding-left: 18px; }
.cliws-scope .tree-group-title {
  font-size: 9.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-dim); padding: 10px 14px 4px;
  display: flex; align-items: center; justify-content: space-between;
}

/* ═══════════════════════ TERMINAL ═══════════════════════ */
.cliws-scope .terminal-area { flex: 1; background: var(--bg); position: relative; overflow: hidden; }
.cliws-scope .terminal-welcome {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; gap: 18px; color: var(--text-muted); text-align: center; padding: 40px;
}
.cliws-scope .welcome-icon {
  width: 80px; height: 80px; border-radius: 22px;
  background: linear-gradient(135deg, rgba(59,130,246,.12), rgba(167,139,250,.12));
  border: 1px solid rgba(59,130,246,.18);
  display: flex; align-items: center; justify-content: center;
  font-size: 34px; color: #60a5fa;
  box-shadow: 0 0 30px rgba(59,130,246,.08);
  margin-bottom: 6px;
}
.cliws-scope .terminal-welcome h2 { font-size: 24px; font-weight: 700; color: var(--text); letter-spacing: -.01em; }
.cliws-scope .terminal-welcome p { font-size: 13px; line-height: 1.8; max-width: 460px; color: var(--text-2); }
.cliws-scope .welcome-shortcuts { display: flex; gap: 14px; margin-top: 12px; flex-wrap: wrap; justify-content: center; }
.cliws-scope .shortcut {
  background: rgba(255,255,255,.03); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 14px; font-size: 11px;
  display: flex; gap: 10px; align-items: center; transition: all .15s var(--ease);
}
.cliws-scope .shortcut:hover { border-color: var(--border-hi); background: rgba(255,255,255,.05); }
.cliws-scope kbd {
  background: rgba(255,255,255,.06); border: 1px solid var(--border);
  border-radius: 5px; padding: 2px 7px; font-family: 'Inter', system-ui, sans-serif;
  font-size: 10px; font-weight: 600; color: var(--text); min-width: 24px; text-align: center;
}

/* ═══════════════════════ PANE ═══════════════════════ */
.cliws-scope .terminal-pane { position: absolute; inset: 0; display: none; flex-direction: column; }
.cliws-scope .terminal-pane.active { display: flex; }
.cliws-scope .pane-toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 14px; background: var(--surface);
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.cliws-scope .pane-info { display: flex; align-items: center; gap: 10px; flex: 1; font-size: 11px; color: var(--text-muted); }
.cliws-scope .pane-info .conn-badge {
  padding: 2px 9px; border-radius: 5px; font-weight: 700; font-size: 9.5px; letter-spacing: .06em;
}
.cliws-scope .pane-info .conn-badge.ssh { background: rgba(34,197,94,.10); color: #4ade80; border: 1px solid rgba(34,197,94,.2); }
.cliws-scope .pane-info .conn-badge.telnet { background: rgba(245,158,11,.10); color: #fbbf24; border: 1px solid rgba(245,158,11,.2); }
.cliws-scope .pane-status { padding: 2px 9px; border-radius: 5px; font-size: 9.5px; font-weight: 700; letter-spacing: .04em; }
.cliws-scope .pane-status.connected { background: rgba(34,197,94,.08); color: #4ade80; }
.cliws-scope .pane-status.connecting { background: rgba(59,130,246,.08); color: #60a5fa; animation: cliws-blink 1.2s ease-in-out infinite; }
.cliws-scope .pane-status.disconnected { background: rgba(239,68,68,.08); color: #f87171; }
@keyframes cliws-blink { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }
.cliws-scope .pane-btn {
  background: none; border: 1px solid var(--border); color: var(--text-muted);
  padding: 4px 9px; border-radius: 5px; cursor: pointer; font-size: 11px;
  transition: all .15s var(--ease); display: flex; align-items: center; gap: 5px;
}
.cliws-scope .pane-btn:hover { background: var(--item-hover); color: var(--text); border-color: var(--border-hi); }
.cliws-scope .pane-btn.active { background: rgba(59,130,246,.12); color: var(--accent); border-color: var(--accent); }
.cliws-scope .pane-btn.danger:hover { background: rgba(239,68,68,.08); border-color: var(--danger); color: var(--danger); }
.cliws-scope .pane-btn-sep { width: 1px; height: 18px; background: var(--border); margin: 0 2px; flex-shrink: 0; }
.cliws-scope .share-viewer-badge {
  display: flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 5px; font-size: 11px; font-weight: 600;
  background: rgba(59,130,246,.12); color: var(--accent);
  border: 1px solid rgba(59,130,246,.25); cursor: default; white-space: nowrap;
}
.cliws-scope .share-viewer-badge.hidden { display: none; }
.cliws-scope .terminal-holder { flex: 1; background: #000; overflow: hidden; position: relative; }
.cliws-scope .xterm { padding: 6px 8px; height: 100%; }
.cliws-scope .xterm-viewport::-webkit-scrollbar { width: 6px; }
.cliws-scope .xterm-viewport::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 3px; }
.cliws-scope .loader-overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,.85);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; z-index: 5; font-size: 13px; color: var(--text-muted);
  backdrop-filter: blur(2px);
}
.cliws-scope .loader-overlay .spinner {
  width: 38px; height: 38px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.06);
  border-left-color: var(--accent);
  animation: cliws-spin .7s linear infinite;
}
@keyframes cliws-spin { to { transform: rotate(360deg); } }

/* ═══════════════════════ MODALS ═══════════════════════ */
.cliws-scope .modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.72);
  display: flex; align-items: center; justify-content: center;
  z-index: 1100; backdrop-filter: blur(6px);
}
.cliws-scope .modal-overlay .modal {
  background: var(--glass); border: 1px solid var(--border-hi);
  border-radius: 14px; width: 100%; box-shadow: var(--shadow-md);
  max-height: 90vh; display: flex; flex-direction: column;
  backdrop-filter: blur(20px);
}
.cliws-scope .modal-overlay .modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px; border-bottom: 1px solid var(--border);
  font-weight: 700; font-size: 15px; flex-shrink: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.02), transparent);
}
.cliws-scope .modal-overlay .modal-close {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 18px; padding: 4px 8px; border-radius: 4px; transition: all .15s var(--ease);
}
.cliws-scope .modal-overlay .modal-close:hover { color: var(--danger); background: rgba(239,68,68,.08); }
.cliws-scope .modal-overlay .modal-body { padding: 22px; overflow-y: auto; flex: 1; }
.cliws-scope .modal-overlay .modal-footer {
  padding: 14px 22px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px; flex-shrink: 0;
}

/* ═══════════════════════ FORMS ═══════════════════════ */
.cliws-scope .form-row { display: flex; gap: 14px; }
.cliws-scope .form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 16px; }
.cliws-scope .form-group:last-child { margin-bottom: 0; }
.cliws-scope .fg-1 { flex: 1; } .cliws-scope .fg-2 { flex: 2; } .cliws-scope .fg-3 { flex: 3; }
.cliws-scope .form-group label {
  font-size: 10.5px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .07em;
}
.cliws-scope .form-group input, .cliws-scope .form-group select, .cliws-scope .form-group textarea {
  background: var(--input-bg); border: 1px solid var(--border); border-radius: 7px;
  color: var(--text); padding: 8px 11px; font-size: 12px; font-family: inherit;
  outline: none; transition: all .15s var(--ease); width: 100%;
}
.cliws-scope .form-group input:focus, .cliws-scope .form-group select:focus, .cliws-scope .form-group textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow);
}
.cliws-scope .form-group input[type=color] { padding: 2px; height: 36px; cursor: pointer; }
.cliws-scope .form-group textarea { resize: vertical; min-height: 60px; font-family: 'JetBrains Mono', monospace; font-size: 11px; }
.cliws-scope .form-tabs {
  display: flex; gap: 3px; margin-bottom: 20px;
  border-bottom: 1px solid var(--border); padding-bottom: 0;
}
.cliws-scope .form-tab {
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--text-muted); padding: 7px 16px; cursor: pointer;
  font-size: 12px; font-weight: 600; transition: all .15s var(--ease); margin-bottom: -1px;
}
.cliws-scope .form-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.cliws-scope .form-tab-pane { display: none; }
.cliws-scope .form-tab-pane.active { display: block; animation: cliws-fade-in .2s var(--ease); }
@keyframes cliws-fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ═══════════════════════ ALGO CHIPS ═══════════════════════ */
.cliws-scope .algo-section { margin-bottom: 18px; }
.cliws-scope .algo-title {
  font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-dim); margin-bottom: 7px; margin-top: 16px;
}
.cliws-scope .algo-grid { display: flex; flex-wrap: wrap; gap: 5px; }
.cliws-scope .algo-chip {
  padding: 4px 11px; border-radius: 20px; border: 1px solid var(--border);
  font-size: 10.5px; cursor: pointer; transition: all .15s var(--ease);
  color: var(--text-muted); background: rgba(255,255,255,.02);
}
.cliws-scope .algo-chip:hover { border-color: var(--accent); color: var(--text); background: rgba(59,130,246,.06); }
.cliws-scope .algo-chip.selected {
  background: rgba(59,130,246,.14); border-color: var(--accent); color: #93c5fd;
  box-shadow: 0 0 8px rgba(59,130,246,.12);
}
.cliws-scope .algo-chip.legacy { border-style: dashed; }
.cliws-scope .algo-hint { font-size: 11px; color: var(--text-dim); margin-top: 8px; display: flex; gap: 6px; align-items: flex-start; }

/* ═══════════════════════ BUTTONS ═══════════════════════ */
.cliws-scope .btn-primary {
  background: linear-gradient(135deg, #3b82f6, #2563eb); color: #fff; border: none;
  padding: 9px 20px; border-radius: 7px; cursor: pointer; font-size: 12px; font-weight: 600;
  display: flex; align-items: center; gap: 7px; transition: all .15s var(--ease);
  box-shadow: 0 2px 10px rgba(59,130,246,.25);
}
.cliws-scope .btn-primary:hover { background: linear-gradient(135deg, #60a5fa, #3b82f6); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(59,130,246,.35); }
.cliws-scope .btn-secondary {
  background: rgba(255,255,255,.04); color: var(--text-2); border: 1px solid var(--border);
  padding: 8px 18px; border-radius: 7px; cursor: pointer; font-size: 12px; transition: all .15s var(--ease);
}
.cliws-scope .btn-secondary:hover { background: rgba(255,255,255,.08); color: var(--text); border-color: var(--border-hi); }

/* ═══════════════════════ GENERIC BUTTONS ═══════════════════════ */
.cliws-scope .hidden { display: none !important; }
.cliws-scope .btn {
  background: rgba(255,255,255,.05); color: var(--text-2); border: 1px solid var(--border);
  padding: 7px 14px; border-radius: 7px; cursor: pointer; font-size: 12px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px; transition: all .15s var(--ease);
  font-family: inherit;
}
.cliws-scope .btn:hover { background: rgba(255,255,255,.09); color: var(--text); border-color: var(--border-hi); }
.cliws-scope .btn:disabled { opacity: .5; cursor: not-allowed; }
.cliws-scope .btn.btn-sm { padding: 4px 10px; font-size: 11px; border-radius: 5px; gap: 4px; }
.cliws-scope .btn.btn-ghost { background: transparent; border-color: transparent; }
.cliws-scope .btn.btn-ghost:hover { background: var(--item-hover); border-color: var(--border); color: var(--text); }
.cliws-scope .form-control {
  background: var(--input-bg); border: 1px solid var(--border); border-radius: 7px;
  color: var(--text); padding: 7px 11px; font-size: 12px; font-family: inherit;
  outline: none; transition: all .15s var(--ease); width: 100%;
}
.cliws-scope .form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
select.cliws-scope .form-control { cursor: pointer; }

/* ═══════════════════════ BACKUP MODAL ═══════════════════════ */
.cliws-scope .cli-bk-stat-card { display:flex; align-items:center; gap:12px; padding:14px 16px; border-radius:10px; background:var(--bg-elevated); border:1px solid var(--border); transition:border-color .15s; }
.cliws-scope .cli-bk-stat-card:hover { border-color:var(--accent); }
.cliws-scope .cli-bk-stat-icon { width:42px; height:42px; border-radius:10px; display:flex; align-items:center; justify-content:center; font-size:18px; flex-shrink:0; }
.cliws-scope .cli-bk-stat-val { font-size:18px; font-weight:700; color:var(--text-primary); line-height:1.2; }
.cliws-scope .cli-bk-stat-lbl { font-size:11px; color:var(--text-muted); margin-top:2px; }
.cliws-scope .cli-bk-hist-item { display:flex; align-items:center; gap:12px; padding:10px 14px; border-radius:8px; background:var(--bg-elevated); border:1px solid var(--border); transition:all .12s; cursor:pointer; }
.cliws-scope .cli-bk-hist-item:hover { border-color:var(--accent); background:var(--bg-hover); }
.cliws-scope .cli-bk-hist-icon { width:34px; height:34px; border-radius:8px; display:flex; align-items:center; justify-content:center; font-size:14px; flex-shrink:0; }
.cliws-scope .cli-bk-hist-icon.success { background:rgba(34,197,94,.12); color:#22c55e; }
.cliws-scope .cli-bk-hist-icon.failed { background:rgba(239,68,68,.12); color:#ef4444; }
.cliws-scope .cli-bk-hist-info { flex:1; min-width:0; }
.cliws-scope .cli-bk-hist-title { font-size:13px; font-weight:600; color:var(--text-primary); }
.cliws-scope .cli-bk-hist-meta { font-size:11px; color:var(--text-muted); margin-top:2px; display:flex; gap:12px; }
.cliws-scope .cli-bk-hist-actions { display:flex; gap:4px; flex-shrink:0; }
.cliws-scope .cli-bk-diff-add { color:#4ade80; }
.cliws-scope .cli-bk-diff-del { color:#f87171; }
.cliws-scope .cli-bk-diff-hdr { color:#60a5fa; font-weight:600; }
.cliws-scope .cli-bk-diff-ctx { color:var(--text-muted); opacity:.6; }

/* ═══════════════════════ IMPORT CARDS ═══════════════════════ */
.cliws-scope .import-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.cliws-scope .import-card {
  background: rgba(255,255,255,.03); border: 1px solid var(--border);
  border-radius: 12px; padding: 22px 14px; text-align: center;
  cursor: pointer; transition: all .2s var(--ease);
}
.cliws-scope .import-card:hover { background: rgba(59,130,246,.06); border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.cliws-scope .import-icon { font-size: 30px; margin-bottom: 10px; display: block; }
.cliws-scope .import-name { font-weight: 700; font-size: 13px; margin-bottom: 3px; color: var(--text); }
.cliws-scope .import-ext { font-size: 10.5px; color: var(--text-dim); }
.cliws-scope .import-result {
  background: rgba(34,197,94,.06); border: 1px solid rgba(34,197,94,.2);
  border-radius: 8px; padding: 12px 16px; color: #4ade80; font-size: 12px; margin-top: 10px;
  display: flex; align-items: center; gap: 8px;
}

/* ═══════════════════════ CONTEXT MENU ═══════════════════════ */
.cliws-scope .ctx-menu {
  position: fixed; background: var(--glass); border: 1px solid var(--border-hi);
  border-radius: 10px; padding: 5px; z-index: 2100; min-width: 170px;
  box-shadow: var(--shadow-md); backdrop-filter: blur(20px);
}
.cliws-scope .ctx-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 13px;
  border-radius: 6px; cursor: pointer; font-size: 12px; color: var(--text-2);
  transition: all .1s var(--ease);
}
.cliws-scope .ctx-item:hover { background: var(--item-hover); color: var(--text); }
.cliws-scope .ctx-danger { color: #f87171; }
.cliws-scope .ctx-danger:hover { background: rgba(239,68,68,.08); color: var(--danger); }
.cliws-scope .ctx-sep { height: 1px; background: var(--border); margin: 4px 0; }

/* ═══════════════════════ FONT SIZE ═══════════════════════ */
.cliws-scope .font-badge { font-size: 10px; color: var(--text-dim); padding: 0 5px; font-family: 'JetBrains Mono', monospace; font-weight: 500; }

/* ═══════════════════════ SEARCH BAR (in-pane) ═══════════════════════ */
.cliws-scope .pane-search-bar {
  position: absolute; top: 6px; right: 12px; z-index: 10;
  display: flex; align-items: center; gap: 4px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 6px; padding: 3px 6px;
  box-shadow: var(--shadow-sm);
}
.cliws-scope .pane-search-bar input {
  background: none; border: none; color: var(--text); outline: none;
  font-size: 11px; width: 140px; font-family: inherit;
}
.cliws-scope .pane-search-bar .search-count { font-size: 10px; color: var(--text-dim); min-width: 30px; }
.cliws-scope .pane-search-bar button {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 11px; padding: 2px 4px; border-radius: 3px;
}
.cliws-scope .pane-search-bar button:hover { color: var(--text); background: var(--item-hover); }

/* ═══════════════════════ ACTIVE SESSIONS ═══════════════════════ */
.cliws-scope .active-sessions-list { flex: 1; overflow-y: auto; padding: 8px 10px; }
.cliws-scope .session-card {
  background: rgba(255,255,255,.02); border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 11px; margin-bottom: 7px; font-size: 11.5px;
  display: flex; flex-direction: column; gap: 5px;
  transition: all .15s var(--ease);
}
.cliws-scope .session-card:hover { border-color: var(--border-hi); background: rgba(255,255,255,.04); }
.cliws-scope .session-card .sc-header { display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.cliws-scope .session-card .sc-footer { display: flex; justify-content: space-between; align-items: center; font-size: 10px; color: var(--text-dim); }
.cliws-scope .sc-btn {
  background: none; border: 1px solid var(--border); color: var(--text-muted);
  padding: 3px 8px; border-radius: 4px; cursor: pointer; font-size: 10px; transition: all .12s;
}
.cliws-scope .sc-btn:hover { background: var(--item-hover); color: var(--text); }
.cliws-scope .sc-btn.restore { background: rgba(59,130,246,.1); border-color: rgba(59,130,246,.25); color: var(--accent); }
.cliws-scope .sc-btn.restore:hover { background: rgba(59,130,246,.2); }
.cliws-scope .sc-btn.kill:hover { border-color: var(--danger); color: var(--danger); background: rgba(239,68,68,.06); }
.cliws-scope .sc-btn.unshare:hover { border-color: var(--accent); color: var(--accent); background: rgba(59,130,246,.08); }
.cliws-scope .all-shares-list { flex: 1; overflow-y: auto; padding: 8px 10px; }

/* ═══════════════════════ SCROLLBARS ═══════════════════════ */
.cliws-scope ::-webkit-scrollbar { width: 5px; height: 5px; }
.cliws-scope ::-webkit-scrollbar-track { background: transparent; }
.cliws-scope ::-webkit-scrollbar-thumb { background: rgba(255,255,255,.06); border-radius: 3px; }
.cliws-scope ::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.12); }

/* ═══════════════════════ RESPONSIVE ═══════════════════════ */
@media (max-width: 900px) {
  .cliws-scope .sidebar { width: 200px; min-width: 140px; }
  .cliws-scope .topbar-brand { min-width: 150px; padding: 0 12px; }
  .cliws-scope .topbar-title { font-size: 12px; }
  .cliws-scope .tb-btn span { display: none; }
}
