/* ==========================================================================
   NuDesk Web — Clean Modern Enterprise Theme (Matching NuDesk Viewer WPF)
   ========================================================================== */

:root {
  --bg-primary:     #F8FAFC;
  --bg-secondary:   #FFFFFF;
  --bg-tertiary:    #F1F5F9;
  --border-subtle:  #E2E8F0;
  --border-strong:  #CBD5E1;
  --border-focus:   #3B82F6;
  --accent-blue:    #2563EB;
  --accent-hover:   #1D4ED8;
  --accent-light:   #EFF6FF;
  --accent-border:  #DBEAFE;
  --text-primary:   #0F172A;
  --text-secondary: #334155;
  --text-muted:     #64748B;
  --success-color:  #16A34A;
  --success-bg:     #DCFCE7;
  --danger-color:   #DC2626;
  --danger-bg:      #FEF2F2;
  --danger-border:  #FECACA;
  --warning-color:  #D97706;
  --warning-bg:     #FEF3C7;

  --font-family:    'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono:      'JetBrains Mono', Consolas, Menlo, Monaco, "Courier New", monospace;
  --header-height:  54px;
  --footer-height:  34px;
  --sidebar-width:  260px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  font-size: 13px;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ─── Typography & Utilities ─────────────────────────────────────── */
h1, h2, h3, h4 { font-weight: 600; color: var(--text-primary); font-family: var(--font-family); }
code, pre, kbd, samp { font-family: var(--font-mono); font-size: 0.9em; }
code { background: var(--bg-tertiary); padding: 2px 5px; border-radius: 4px; border: 1px solid var(--border-subtle); color: var(--text-secondary); }
a { color: var(--accent-blue); text-decoration: none; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger-color); }
.text-success { color: var(--success-color); }
.text-center { text-align: center; }

/* ─── Buttons ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 5px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
  outline: none;
  user-select: none;
}
.btn-icon { margin-right: 5px; }

.btn-primary {
  background-color: var(--accent-blue);
  color: #FFFFFF;
  border-color: var(--accent-blue);
}
.btn-primary:hover {
  background-color: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-secondary {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--border-strong);
}
.btn-secondary:hover {
  background-color: var(--bg-tertiary);
  border-color: var(--accent-blue);
}

.btn-outline {
  background-color: transparent;
  color: var(--text-secondary);
  border-color: var(--border-strong);
}
.btn-outline:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--accent-blue);
}

.btn-danger {
  background-color: var(--danger-bg);
  color: var(--danger-color);
  border-color: var(--danger-border);
}
.btn-danger:hover {
  background-color: var(--danger-color);
  color: #FFFFFF;
}

.btn-danger-outline {
  background-color: #FEF2F2;
  color: #EF4444;
  border-color: #FECACA;
}
.btn-danger-outline:hover {
  background-color: #FEE2E2;
  border-color: #FCA5A5;
  color: #DC2626;
}

.btn-success {
  background-color: #16A34A;
  color: #FFFFFF;
  border-color: #15803D;
}
.btn-success:hover {
  background-color: #15803D;
  border-color: #166534;
  color: #FFFFFF;
}

.btn-sm { height: 30px; padding: 4px 10px; font-size: 12px; }
.btn-xs { height: 22px; padding: 2px 6px; font-size: 11px; }

/* ─── Forms & Inputs ─────────────────────────────────────────────── */
.form-group {
  margin-bottom: 12px;
}
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.form-input, .form-select {
  width: 100%;
  height: 32px;
  padding: 4px 10px;
  font-size: 12px;
  font-family: inherit;
  color: var(--text-primary);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-input:focus, .form-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}
.select-sm {
  height: 28px;
  padding: 2px 8px;
  font-size: 12px;
}
.form-row {
  display: flex;
  gap: 8px;
}
.col-2 { flex: 2; }
.col-3 { flex: 3; }
.col-4 { flex: 4; }
.col-5 { flex: 5; }
.col-6 { flex: 6; }
.col-8 { flex: 8; }

/* ─── Header (Enterprise Bar) ────────────────────────────────────── */
#header {
  height: var(--header-height);
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
  z-index: 50;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-logo {
  width: 30px;
  height: 30px;
  background-color: var(--accent-blue);
  border-radius: 6px;
  color: #FFFFFF;
  font-weight: 700;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
}
.brand-text {
  display: flex;
  flex-direction: column;
}
.brand-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}
.brand-subtitle {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
}
.header-divider {
  width: 1px;
  height: 24px;
  background-color: var(--border-subtle);
  margin: 0 6px;
}

.header-center {
  flex: 1;
  max-width: 420px;
  margin: 0 20px;
}
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.search-icon {
  position: absolute;
  left: 10px;
  font-size: 12px;
  color: var(--text-muted);
  pointer-events: none;
}
#searchBox {
  width: 100%;
  height: 32px;
  padding: 0 12px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-primary);
  outline: none;
  transition: all 0.15s ease;
}
#searchBox:focus {
  background-color: #FFFFFF;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.user-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background-color: var(--bg-tertiary);
  border-radius: 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ─── Dropdowns ──────────────────────────────────────────────────── */
.dropdown {
  position: relative;
  display: inline-block;
}
.dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 4px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  min-width: 220px;
  padding: 4px 0;
  z-index: 100;
}
.dropdown-menu-left {
  left: 0 !important;
  right: auto !important;
}
.dropdown-menu.show { display: block; }
.dropdown-menu a {
  display: flex;
  align-items: center;
  padding: 8px 14px;
  font-size: 12px;
  color: var(--text-secondary);
  transition: background-color 0.1s ease;
}
.dropdown-menu a:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}
.dropdown-menu a.text-danger:hover {
  background-color: var(--danger-bg);
  color: var(--danger-color);
}
.menu-icon { margin-right: 8px; width: 16px; text-align: center; }
.dropdown-divider {
  height: 1px;
  background-color: var(--border-subtle);
  margin: 4px 0;
}

/* ─── Workspace (Sidebar + Main) ─────────────────────────────────── */
#workspace {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ─── Sidebar ────────────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 8px 14px;
}
.sidebar-header-btns {
  display: flex;
  align-items: center;
  gap: 6px;
}
.sidebar-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}
.tree-view {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px;
}
.tree-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: 5px;
  cursor: pointer;
  user-select: none;
  color: var(--text-secondary);
  font-size: 12px;
  margin-bottom: 2px;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}
.tree-item:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}
.tree-item.active {
  background-color: var(--accent-light);
  color: var(--accent-blue);
  font-weight: 600;
}
.tree-item.drag-over {
  background-color: #DBEAFE !important;
  border: 1px dashed #2563EB !important;
  color: #1D4ED8 !important;
}
.tree-item-label {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tree-item.child {
  padding-left: 24px;
}
.tree-badge {
  background-color: var(--bg-tertiary);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
}
.tree-item.active .tree-badge {
  background-color: var(--accent-border);
  color: var(--accent-blue);
}

/* ─── Main Content ───────────────────────────────────────────────── */
#mainContent {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px 24px;
  overflow: hidden;
  background-color: var(--bg-primary);
}

#contentHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-shrink: 0;
}
.group-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
#selectedGroupName {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
}
.badge-count {
  background-color: var(--border-subtle);
  color: var(--text-secondary);
}
.badge-subtle {
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.group-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ─── Data Grid ──────────────────────────────────────────────────── */
#deviceGridWrap {
  flex: 1;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  overflow: auto;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: left;
}
.data-table th {
  background-color: #FAFAFA;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 10;
}
.data-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
}
.data-table tbody tr {
  transition: background-color 0.1s ease;
}
.data-table tbody tr:hover {
  background-color: #F8FAFC;
}
.data-table tbody tr.selected {
  background-color: var(--accent-light);
}
.data-table tbody tr.dragging {
  opacity: 0.4;
  background-color: #EFF6FF;
}

/* ─── Consolidated 3-Line Device Cell ────────────────────────────── */
.device-host-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 250px;
}
.device-row-line-1 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.device-row-line-2 {
  display: flex;
  align-items: center;
}
.device-row-line-3 {
  display: flex;
  align-items: center;
}
.device-name {
  font-weight: 700;
  font-size: 13px;
  color: var(--text-primary);
}
.ip-badge {
  background-color: #F1F5F9;
  border: 1px solid #E2E8F0;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
  color: #475569;
  font-weight: 500;
}
.role-badge {
  background-color: #EFF6FF;
  border: 1px solid #BFDBFE;
  color: #1D4ED8;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.app-path-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background-color: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
  color: #0F172A;
  font-weight: 500;
  max-width: 550px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-path-badge.unset {
  color: #94A3B8;
  font-style: italic;
}
.path-badge-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background-color: #F8FAFC;
  border: 1px solid #E2E8F0;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  max-width: 550px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  outline: none;
}
.path-badge-btn:hover {
  background-color: #EFF6FF;
  border-color: #BFDBFE;
  color: #1D4ED8;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.1);
}

/* Status Cell */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}
.status-pill.online {
  background-color: var(--success-bg);
  color: var(--success-color);
}
.status-pill.offline {
  background-color: var(--bg-tertiary);
  color: var(--text-muted);
}
.status-pill.pinging {
  background-color: var(--warning-bg);
  color: var(--warning-color);
}

/* Delete Folders Modal List */
.delete-folders-list {
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 8px;
  background-color: var(--bg-secondary);
}
.delete-folder-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.1s ease;
  font-size: 12px;
}
.delete-folder-row:hover {
  background-color: var(--bg-tertiary);
}
.delete-folder-row input[type="checkbox"] {
  cursor: pointer;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}
.dot-green { background-color: var(--success-color); }
.dot-gray { background-color: var(--text-muted); }
.dot-orange { background-color: var(--warning-color); }

/* Table Action Buttons */
.action-buttons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

/* ─── Footer (Status Bar) ────────────────────────────────────────── */
#statusBar {
  height: var(--footer-height);
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-size: 12px;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.forwarder-indicator {
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 6px;
  border-radius: 4px;
}
.forwarder-indicator:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

/* ─── Remote Desktop Viewer (Modal / Overlay) ────────────────────── */
.remote-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #0F172A;
  z-index: 1500;
  display: flex;
  flex-direction: column;
}

/* Multi-Session Tab Bar (Matching AnyDesk / Chrome tabs) */
.remote-tab-bar {
  height: 38px;
  background-color: #1E293B;
  border-bottom: 1px solid #334155;
  display: flex;
  align-items: center;
  padding: 0 8px;
  gap: 6px;
  flex-shrink: 0;
  z-index: 20;
  user-select: none;
}
.remote-tab-home-btn {
  background: transparent;
  border: none;
  color: #94A3B8;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}
.remote-tab-home-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #F8FAFC;
}
.remote-tab-scroll {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  max-width: calc(100vw - 360px);
}
.remote-tab-scroll::-webkit-scrollbar {
  display: none;
}
.remote-session-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: #0F172A;
  color: #94A3B8;
  border: 1px solid #334155;
  border-bottom: none;
  padding: 5px 12px;
  border-radius: 6px 6px 0 0;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  white-space: nowrap;
}
.remote-session-tab:hover {
  background-color: #1E293B;
  color: #E2E8F0;
  border-color: #475569;
}
.remote-session-tab.active {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--border-subtle);
  font-weight: 700;
  box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.15);
}
.remote-session-tab .tab-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--success-color);
  transition: all 0.2s ease;
}
.remote-session-tab .tab-status-dot.active {
  background-color: #10B981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.7);
}
.remote-session-tab .tab-status-dot.paused {
  background-color: #F59E0B;
  opacity: 0.85;
}
.remote-session-tab .tab-status-dot.disconnected {
  background-color: var(--danger-color);
}
.remote-session-tab .tab-close-btn {
  background: transparent;
  border: none;
  color: #94A3B8;
  font-size: 11px;
  padding: 2px 4px;
  border-radius: 3px;
  margin-left: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.remote-session-tab .tab-close-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #EF4444;
}
.remote-tab-add-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed #475569;
  color: #94A3B8;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}
.remote-tab-add-btn:hover {
  background: rgba(37, 99, 235, 0.2);
  border-color: var(--accent-primary);
  color: #93C5FD;
}
.remote-tab-spacer {
  flex: 1;
}
.btn-tab-action {
  color: #CBD5E1;
  font-size: 11px;
  padding: 3px 8px;
}
.btn-tab-action:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #FFFFFF;
}

/* Ribbon Controls (Matching RemoteSessionControl.xaml) */
.remote-ribbon {
  height: 38px;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 8px;
  flex-shrink: 0;
  z-index: 100;
  position: relative;
  user-select: none;
}
.ribbon-row-1 {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 8px;
}
.ribbon-row-2 {
  display: contents;
}
.ribbon-group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ribbon-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}
.ribbon-divider {
  width: 1px;
  height: 20px;
  background-color: var(--border-subtle);
  margin: 0 6px;
}
.ribbon-spacer { flex: 1; }

/* ── Clean Desktop Native Menu Bar (Text Only, No Icons) ── */
.rv-menubar {
  display: flex;
  align-items: center;
  gap: 2px;
}
.rv-menu-item {
  position: relative;
  outline: none;
}
.rv-menu-trigger {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background-color 0.15s ease, color 0.15s ease;
  line-height: 1.4;
  white-space: nowrap;
}
.rv-menu-trigger:hover,
.rv-menu-item.open .rv-menu-trigger {
  background-color: var(--bg-tertiary);
  color: var(--accent-blue);
}
.rv-menu-arrow {
  font-size: 10px;
  color: var(--text-muted);
  transition: transform 0.15s ease;
}
.rv-menu-item.open .rv-menu-arrow {
  transform: rotate(180deg);
}

/* Floating Dropdown Panel */
.rv-dropdown-panel {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  padding: 4px;
  min-width: 190px;
  z-index: 1000;
  animation: rvMenuDropdownFade 0.12s ease-out;
}
@keyframes rvMenuDropdownFade {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.rv-menu-item.open .rv-dropdown-panel {
  display: flex;
  flex-direction: column;
}

/* Menu Dropdown Option (Full Text, with optional checkmark) */
.rv-dropdown-option {
  display: flex;
  align-items: center;
  width: 100%;
  background: transparent;
  border: none;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-primary);
  border-radius: 4px;
  cursor: pointer;
  text-align: left;
  gap: 8px;
  transition: background-color 0.1s ease, color 0.1s ease;
  white-space: nowrap;
}
.rv-dropdown-option:hover {
  background-color: var(--bg-tertiary);
  color: var(--accent-blue);
}
.rv-dropdown-option.selected {
  font-weight: 600;
  color: var(--accent-blue);
}
.rv-check-mark {
  width: 14px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-blue);
  display: inline-block;
  text-align: center;
  flex-shrink: 0;
}
.rv-dropdown-separator {
  height: 1px;
  background-color: var(--border-subtle);
  margin: 4px 6px;
}

/* ── Minimalist Clean Action Buttons (Text Only) ── */
.rv-btn-action {
  height: 28px;
  padding: 0 12px;
  font-size: 11.5px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-primary);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.rv-btn-action:hover {
  background-color: var(--bg-tertiary);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}
.rv-btn-action:active {
  transform: translateY(1px);
}
.rv-btn-danger {
  color: #DC2626 !important;
  border-color: #FECACA !important;
  background-color: #FEF2F2 !important;
}
.rv-btn-danger:hover {
  background-color: #DC2626 !important;
  border-color: #DC2626 !important;
  color: #FFFFFF !important;
}

.remote-viewport {
  flex: 1;
  position: relative;
  overflow: hidden;
  background-color: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
}

#rvCanvas,
.remote-canvas-session {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
  object-position: center;
  display: block;
  image-rendering: auto;
  outline: none;
  cursor: default;
  margin: auto;
  padding: 0;
  flex: 0 0 auto;
  touch-action: none !important;
  user-select: none !important;
  -webkit-user-select: none !important;
  -webkit-touch-callout: none !important;
}

#rvCanvas.hidden-session,
.remote-canvas-session.hidden-session,
#rvCanvas[style*="display: none"],
.remote-canvas-session[style*="display: none"] {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  flex: 0 0 0 !important;
}

/* Mode STRETCH (Fill Viewport / Tanpa Blank Space) */
.remote-viewport.view-stretch:not(.zoomed) #rvCanvas:not(.hidden-session):not([style*="display: none"]),
.remote-viewport.view-stretch:not(.zoomed) .remote-canvas-session:not(.hidden-session):not([style*="display: none"]) {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: fill !important;
  object-position: center !important;
  margin: 0 !important;
  padding: 0 !important;
  flex: 1 1 100% !important;
}

.rv-overlay {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background-color: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(4px);
  color: #FFFFFF;
  padding: 20px 32px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 500;
  z-index: 20;
}
.rv-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.remote-statusbar {
  height: 26px;
  background-color: #0F172A;
  border-top: 1px solid #1E293B;
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-size: 11px;
  color: #94A3B8;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════════════
   IMMERSIVE FULLSCREEN MODE (HIDE HEADER & FOOTER ON REMOTE)
══════════════════════════════════════════════════════════════════ */
#remoteViewerModal.immersive-mode #rvTabBar,
#remoteViewerModal.immersive-mode .remote-ribbon,
#remoteViewerModal.immersive-mode .remote-statusbar {
  display: none !important;
}

#remoteViewerModal.immersive-mode #rvViewport {
  height: 100% !important;
  width: 100% !important;
  flex: 1;
}

/* ══════════════════════════════════════════════════════════════════
   DRAGGABLE FLOATING ACTION BUTTON (FAB) - MOBILE ONLY
══════════════════════════════════════════════════════════════════ */
.rv-floating-fab-container {
  display: none !important; /* Strictly Hidden on Desktop (> 768px) */
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 3100;
  touch-action: none;
  user-select: none;
  transition: transform 0.2s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.rv-floating-fab-container.snapping {
  transition: top 0.25s ease-out, left 0.25s ease-out, right 0.25s ease-out;
}

.rv-floating-fab-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.1);
  cursor: grab;
  outline: none;
  transition: transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.rv-floating-fab-btn:hover {
  background: rgba(30, 41, 59, 0.95);
  border-color: rgba(56, 189, 248, 0.6);
  transform: scale(1.06);
}

.rv-floating-fab-btn:active {
  cursor: grabbing;
  transform: scale(0.92);
  background: rgba(37, 99, 235, 0.9);
}

.rv-floating-fab-btn.menu-open {
  background: #2563EB;
  border-color: #60A5FA;
  box-shadow: 0 0 20px rgba(37, 99, 235, 0.6);
}

/* Quick Action Popover Menu */
.rv-floating-menu {
  position: absolute;
  top: 52px;
  right: 0;
  width: 215px;
  max-height: 82vh;
  overflow-y: auto;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.08);
  animation: fabMenuFadeIn 0.18s ease-out;
  z-index: 2210;
}

.rv-floating-fab-container.align-left .rv-floating-menu {
  right: auto;
  left: 0;
}

@keyframes fabMenuFadeIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.rv-menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px 8px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 6px;
}

.rv-menu-title {
  font-size: 11px;
  font-weight: 700;
  color: #94A3B8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.rv-menu-close-btn {
  background: transparent;
  border: none;
  color: #94A3B8;
  font-size: 14px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}

.rv-menu-close-btn:hover {
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.1);
}

.rv-menu-items {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.rv-menu-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  min-height: 38px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: #F8FAFC;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  user-select: none;
}

.rv-menu-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #38BDF8;
}

.rv-menu-btn:active {
  transform: scale(0.98);
  background: rgba(37, 99, 235, 0.3);
}

.rv-menu-btn .rv-item-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.rv-menu-btn .rv-item-text {
  flex: 1;
  white-space: nowrap;
}

.rv-menu-btn-danger {
  color: #F87171 !important;
}

.rv-menu-btn-danger:hover {
  background: rgba(239, 68, 68, 0.2) !important;
  color: #FCA5A5 !important;
}

/* ══════════════════════════════════════════════════════════════════
   FLOATING DRAGGABLE MOBILE VIRTUAL KEYBOARD (PORTRAIT & LANDSCAPE)
   ══════════════════════════════════════════════════════════════════ */
.rv-virtual-keyboard-dock {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100vw - 16px);
  max-width: 560px;
  z-index: 2800;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1.5px solid rgba(56, 189, 248, 0.45);
  border-radius: 12px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.7), 0 0 20px rgba(56, 189, 248, 0.25);
  display: flex;
  flex-direction: column;
  padding: 4px 6px 10px 6px;
  user-select: none;
  touch-action: none;
  transition: opacity 0.15s ease;
}

.rv-virtual-keyboard-dock.is-dragging {
  opacity: 0.92;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.85), 0 0 30px rgba(56, 189, 248, 0.4);
  border-color: #38BDF8;
  transition: none !important;
}

@keyframes slideUpKbdDock {
  from { transform: translate(-50%, 20px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

.rv-kbd-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 4px 6px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 6px;
  gap: 6px;
  cursor: grab;
  touch-action: none;
}

.rv-kbd-header:active {
  cursor: grabbing;
}

.rv-kbd-drag-handle {
  padding: 3px 8px;
  cursor: grab;
  color: #38BDF8;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  touch-action: none;
  font-size: 13px;
  user-select: none;
}

.rv-kbd-drag-handle:active {
  cursor: grabbing;
  background: rgba(56, 189, 248, 0.35);
  color: #FFFFFF;
}

.rv-kbd-tabs {
  display: flex;
  gap: 4px;
}

.rv-kbd-tab {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #94A3B8;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.rv-kbd-tab.active {
  background: #2563EB;
  border-color: #60A5FA;
  color: #FFFFFF;
  box-shadow: 0 0 10px rgba(37, 99, 235, 0.5);
}

.rv-kbd-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.rv-kbd-key-action {
  background: rgba(51, 65, 85, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #F1F5F9;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.rv-kbd-key-action:active {
  background: #2563EB;
}

.rv-kbd-btn-close {
  background: rgba(239, 68, 68, 0.3) !important;
  border-color: rgba(239, 68, 68, 0.5) !important;
  color: #FCA5A5 !important;
  width: 26px;
  height: 26px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.rv-kbd-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rv-kbd-row {
  display: flex;
  gap: 3px;
  justify-content: center;
  width: 100%;
}

.rv-kbd-key {
  flex: 1;
  height: 38px;
  min-width: 0;
  background: rgba(30, 41, 59, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: #FFFFFF;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  outline: none;
  user-select: none;
  touch-action: manipulation;
  transition: background 0.08s, transform 0.06s;
}

.rv-kbd-key:active, .rv-kbd-key.active-press {
  background: #2563EB !important;
  color: #FFFFFF !important;
  border-color: #60A5FA !important;
  transform: scale(0.92);
}

.rv-kbd-key.active-modifier {
  background: #0284C7 !important;
  border-color: #38BDF8 !important;
  color: #FFFFFF !important;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.6);
}

.rv-kbd-fn {
  background: rgba(51, 65, 85, 0.85);
  color: #93C5FD;
  font-size: 11.5px;
  font-weight: 600;
}

.rv-kbd-space {
  flex: 3.5;
}

.rv-kbd-enter {
  flex: 1.6;
  background: rgba(37, 99, 235, 0.7);
  color: #FFFFFF;
}

.rv-kbd-backspace {
  flex: 1.3;
}

.rv-kbd-shift {
  flex: 1.4;
}

.rv-kbd-tab-btn {
  flex: 1.2;
}

.rv-kbd-caps {
  flex: 1.3;
}

.rv-kbd-nav {
  font-size: 15px;
  font-weight: bold;
}

/* Tab 2: Symbols & Numpad Layout */
.rv-kbd-symbols-container {
  display: flex;
  gap: 8px;
}

.rv-kbd-symbols-grid {
  flex: 1.2;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 3px;
}

.rv-kbd-numpad-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
}

.rv-kbd-num {
  background: rgba(15, 76, 129, 0.5);
  font-size: 16px;
  font-weight: bold;
}

.rv-kbd-zero {
  grid-column: span 2;
}

/* Tab 3: Shortcuts & Function Keys */
.rv-kbd-shortcuts-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rv-kbd-fkeys-row {
  display: flex;
  gap: 4px;
}

.rv-kbd-fkey {
  flex: 1;
  height: 34px;
  background: rgba(30, 58, 138, 0.6);
  border-color: rgba(96, 165, 250, 0.3);
  color: #93C5FD;
  font-size: 12px;
}

.rv-kbd-quick-tools-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.rv-kbd-tool {
  height: 36px;
  font-size: 11.5px;
  background: rgba(30, 41, 59, 0.9);
}

.rv-kbd-tool-cad {
  background: rgba(239, 68, 68, 0.3) !important;
  border-color: rgba(239, 68, 68, 0.5) !important;
  color: #FCA5A5 !important;
  font-weight: bold;
}

/* Responsive Landscape & Ultra-Slim Mode */
@media (max-width: 950px) and (orientation: landscape), (max-height: 520px) {
  .rv-virtual-keyboard-dock {
    bottom: 6px;
    padding: 2px 5px 4px 5px !important;
    max-width: 96vw !important;
    width: 96vw !important;
    border-radius: 8px !important;
  }
  .rv-kbd-header {
    padding: 1px 2px 2px 2px !important;
    margin-bottom: 2px !important;
  }
  .rv-kbd-drag-handle {
    padding: 1px 6px !important;
    font-size: 11px !important;
    height: 19px !important;
  }
  .rv-kbd-tab {
    padding: 1px 8px !important;
    font-size: 9.5px !important;
    height: 19px !important;
  }
  .rv-kbd-key-action {
    padding: 1px 6px !important;
    font-size: 9.5px !important;
    height: 19px !important;
  }
  .rv-kbd-btn-close {
    width: 19px !important;
    height: 19px !important;
    font-size: 10px !important;
  }
  .rv-kbd-key {
    height: 20px !important;
    font-size: 11px !important;
    border-radius: 3px !important;
  }
  .rv-kbd-row {
    gap: 2px !important;
  }
  .rv-kbd-body {
    gap: 2px !important;
  }
  .rv-kbd-fkey {
    height: 20px !important;
    font-size: 9.5px !important;
  }
  .rv-kbd-tool {
    height: 20px !important;
    font-size: 9px !important;
  }
  .rv-kbd-symbols-grid {
    gap: 2px !important;
  }
  .rv-kbd-numpad-grid {
    gap: 2px !important;
  }
}





/* ─── WinSCP-Style Dual-Pane Commander Modal ────────── */
.fm-winscp-container {
  max-width: 1180px;
  width: 95vw;
  height: 88vh;
  max-height: 780px;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-primary);
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 20px 40px -10px rgba(0,0,0,0.18), 0 0 1px 1px rgba(0,0,0,0.06);
  overflow: hidden;
}

.fm-winscp-header {
  padding: 10px 16px;
  background-color: #FFFFFF;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.fm-header-icon {
  color: var(--accent-blue);
  stroke-width: 2.2;
}

.fm-dual-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 10px;
  overflow: hidden;
  background-color: #F1F5F9;
  gap: 8px;
}

.fm-dual-panes {
  display: flex;
  flex: 1;
  gap: 8px;
  overflow: hidden;
}

.fm-pane {
  flex: 1;
  background-color: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.fm-pane.drag-over {
  border: 2px dashed var(--accent-blue);
  background-color: var(--accent-light);
}

.fm-pane-header {
  padding: 6px 10px;
  background: linear-gradient(180deg, #F8FAFC 0%, #F1F5F9 100%);
  border-bottom: 1px solid #CBD5E1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 38px;
  flex-shrink: 0;
}
.fm-pane-title-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}
.fm-pane-icon {
  font-size: 14px;
}
.fm-pane-badge {
  font-size: 12px;
  font-weight: 700;
  color: #1E293B;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.fm-pane-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

/* App Lifecycle Options Bar in File Manager */
.fm-options-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 12px;
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  margin-top: 4px;
}
.fm-opt-group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.fm-opt-label {
  font-size: 11px;
  font-weight: 700;
  color: #475569;
}
.fm-opt-checkboxes {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.fm-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 500;
  color: #1E293B;
  cursor: pointer;
  user-select: none;
  margin: 0;
}
.fm-checkbox-label input[type="checkbox"] {
  cursor: pointer;
}

.fm-dropzone-bar {
  padding: 8px 10px;
  background: #F8FAFC;
  border-bottom: 1px dashed #CBD5E1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748B;
  font-size: 11px;
  text-align: center;
}
.fm-dropzone-hint {
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 500;
}

.fm-toolbar {
  padding: 5px 8px;
  background-color: #FAFAFA;
  border-bottom: 1px solid #E2E8F0;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.fm-btn-nav {
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.1s ease;
}
.fm-btn-nav:hover {
  background-color: #F1F5F9;
  border-color: #94A3B8;
}

.fm-drive-select {
  height: 26px;
  padding: 0 4px;
  font-size: 12px;
  font-weight: 600;
  background-color: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: 4px;
  width: 70px;
}

.fm-path-box {
  flex: 1;
}
.fm-path-input {
  height: 26px;
  font-size: 12px;
  font-family: inherit;
  background-color: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: 4px;
  padding: 2px 8px;
  width: 100%;
}
.fm-path-input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px rgba(37,99,235,0.12);
}

.fm-table-wrap {
  flex: 1;
  overflow-y: auto;
  background-color: #FFFFFF;
}
.fm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.fm-table th {
  background: #F8FAFC;
  color: #475569;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 6px 8px;
  border-bottom: 1px solid #CBD5E1;
  position: sticky;
  top: 0;
  z-index: 2;
  user-select: none;
}
.fm-table td {
  padding: 4px 8px;
  border-bottom: 1px solid #F1F5F9;
  white-space: nowrap;
  vertical-align: middle;
}
.fm-table tbody tr {
  cursor: default;
  transition: background 0.05s ease;
}
.fm-table tbody tr:hover {
  background-color: #F8FAFC;
}
.fm-table tbody tr.selected {
  background-color: #EFF6FF !important;
}

.fm-item-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  color: #1E293B;
  cursor: pointer;
  user-select: none;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fm-item-name.is-dir {
  font-weight: 600;
  color: #0F172A;
}
.fm-item-name:hover {
  color: var(--accent-blue);
  text-decoration: underline;
}
.fm-file-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.fm-parent-dir-row {
  background-color: #FAFAFA;
  font-weight: 600;
  cursor: pointer;
}
.fm-parent-dir-row:hover {
  background-color: #F1F5F9 !important;
}

.fm-pane.drag-over {
  border-color: #2563EB !important;
  box-shadow: inset 0 0 0 2px #3B82F6, 0 0 16px rgba(59, 130, 246, 0.25) !important;
  background-color: #F0F9FF !important;
}
.fm-pane.drag-over .fm-table-wrap {
  background-color: #F0F9FF !important;
}
.fm-table tbody tr[draggable="true"] {
  cursor: grab;
}
.fm-table tbody tr[draggable="true"]:active {
  cursor: grabbing;
}

.fm-pane-statusbar {
  padding: 4px 8px;
  background-color: #F8FAFC;
  border-top: 1px solid #E2E8F0;
  font-size: 11px;
  color: #64748B;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.fm-center-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 2px;
}
.fm-transfer-btn {
  width: 82px;
  font-size: 11px;
  font-weight: 600;
  padding: 7px 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.transfer-arrow {
  font-weight: 800;
  font-size: 12px;
}

/* WinSCP Commander Function Keys Toolbar */
.fm-winscp-fnbar {
  display: flex;
  gap: 4px;
  padding: 6px 10px;
  background-color: #F1F5F9;
  border-top: 1px solid #CBD5E1;
  flex-shrink: 0;
}
.fn-btn {
  flex: 1;
  height: 28px;
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #334155;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.1s ease;
  user-select: none;
}
.fn-btn:hover {
  background-color: #E2E8F0;
  color: #0F172A;
  border-color: #94A3B8;
}
.fn-btn:active {
  background-color: #CBD5E1;
}
.fn-key {
  font-weight: 800;
  color: var(--accent-blue);
  font-size: 11px;
}

.fm-progress-card {
  padding: 8px 12px;
  background-color: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  flex-shrink: 0;
}
.fm-progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.progress-track {
  height: 6px;
  background-color: #E2E8F0;
  border-radius: 3px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background-color: var(--accent-blue);
  transition: width 0.2s ease;
}
.fm-footer {
  padding: 6px 14px;
  background-color: #FFFFFF;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
}

/* ─── Modals ─────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2500;
}
.modal-dialog {
  background-color: var(--bg-secondary);
  border-radius: 8px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  animation: modalFadeIn 0.15s ease-out;
}
.modal-sm { max-width: 380px; }
.modal-md { max-width: 520px; }
.modal-lg { max-width: 820px; width: 95%; }
.modal-xl { max-width: 1020px; width: 96%; }

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-header-icon, .modal-title-icon { display: none !important; }
.modal-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}
.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-close {
  background: transparent;
  border: none;
  font-size: 16px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}
.modal-close:hover { color: var(--text-primary); }

.modal-body {
  padding: 18px;
  overflow-y: auto;
  max-height: calc(85vh - 120px);
}
.modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border-subtle);
  background-color: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* ─── Scanner & Batch Tables ─────────────────────────────────────── */
.scan-actions-bar {
  display: flex;
  align-items: center;
  margin: 12px 0;
}
.scan-table-wrap {
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
}

.batch-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #1E293B, #0F172A);
  border: 1px solid #3B82F6;
  border-radius: 8px;
  padding: 10px 16px;
  margin-bottom: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  animation: slideDown 0.2s ease-out;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.batch-bar-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.batch-bar-badge {
  background: #2563EB;
  color: #FFFFFF;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.batch-bar-title {
  color: #F8FAFC;
  font-size: 13px;
  font-weight: 500;
}
.batch-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Modal Tabs for Batch Action */
.batch-tab-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
}
.batch-tab-btn {
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}
.batch-tab-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border-strong);
}
.batch-tab-btn.active {
  background: #2563EB;
  color: #FFFFFF;
  border-color: #2563EB;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

/* Batch Config Grid (2 Columns) */
.batch-config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
@media (max-width: 640px) {
  .batch-config-grid {
    grid-template-columns: 1fr;
  }
}

.role-auto-hint {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

/* Patch Options Chips */
.batch-patch-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.batch-option-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}
.batch-option-chip:hover {
  border-color: var(--accent-blue);
  background: var(--accent-light);
  color: var(--accent-blue);
}
.batch-option-chip input[type="checkbox"] {
  accent-color: var(--accent-blue);
  cursor: pointer;
}

/* Unified Staging & Dropzone Card */
.batch-staging-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.batch-staging-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}
.batch-staging-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
}
.batch-staging-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Clean Dropzone */
.batch-drop-zone {
  border: 1.5px dashed var(--border-strong);
  border-radius: 6px;
  padding: 18px 12px;
  text-align: center;
  background: var(--bg-primary);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  transition: all 0.15s ease;
}
.batch-drop-zone:hover, .batch-drop-zone.drag-over {
  border-color: var(--accent-blue);
  background: var(--accent-light);
}
.batch-drop-icon {
  font-size: 22px;
  margin-bottom: 2px;
}
.batch-drop-text {
  font-weight: 600;
  font-size: 12.5px;
  color: var(--text-primary);
}
.batch-drop-sub {
  font-size: 11px;
  color: var(--text-muted);
}

/* Batch Progress Bar */
.batch-progress-wrap {
  margin-top: 8px;
}
.batch-progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  margin-bottom: 4px;
  color: var(--text-secondary);
}

/* File list box */
.batch-file-list-wrap {
  margin-top: 10px;
}
.batch-file-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.batch-file-list, .pkg-file-list-box {
  max-height: 130px;
  overflow-y: auto;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 4px 6px;
  background: var(--bg-primary);
  font-size: 11.5px;
}
.pkg-file-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 8px;
  border-bottom: 1px solid var(--border-subtle);
  border-radius: 4px;
  transition: background-color 0.1s ease;
}
.pkg-file-item:last-child {
  border-bottom: none;
}
.pkg-file-item:hover {
  background-color: var(--bg-tertiary);
}
.pkg-file-item-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}
.pkg-file-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
  font-size: 11.5px;
}
.pkg-file-del-btn {
  padding: 2px 6px;
  font-size: 11px;
  opacity: 0.7;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.15s ease;
}
.pkg-file-del-btn:hover {
  opacity: 1;
  background-color: var(--danger-bg);
  transform: scale(1.05);
}

/* Target Devices Section */
.batch-target-section {
  margin-top: 14px;
}
.batch-target-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.batch-target-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
}
.batch-device-checklist {
  max-height: 160px;
  overflow-y: auto;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 6px;
  background-color: var(--bg-secondary);
}
.batch-device-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  font-size: 12px;
  border-radius: 4px;
  transition: background-color 0.1s ease;
}
.batch-device-item:hover {
  background-color: var(--bg-tertiary);
}
.batch-log-box {
  margin-top: 12px;
  padding: 10px;
  background-color: #0F172A;
  color: #38BDF8;
  border-radius: 6px;
  max-height: 140px;
  overflow-y: auto;
  font-family: 'JetBrains Mono', Consolas, Menlo, Monaco, monospace;
  font-size: 11px;
}

/* ─── Context Menu ───────────────────────────────────────────────── */
.context-menu {
  position: fixed;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  box-shadow: 0 10px 20px -3px rgba(0, 0, 0, 0.18);
  min-width: 180px;
  padding: 4px 0;
  z-index: 450;
}
.context-menu-item {
  display: flex;
  align-items: center;
  padding: 8px 14px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}
.context-menu-item:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}
.context-menu-divider {
  height: 1px;
  background-color: var(--border-subtle);
  margin: 4px 0;
}

.rv-quick-keys {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.rv-quick-keys .btn {
  flex: 1 1 calc(33.3% - 6px);
  min-width: 70px;
  height: 36px;
  font-size: 11px;
}

/* ─── Toast Notifications ────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 45px;
  right: 20px;
  background-color: var(--text-primary);
  color: #FFFFFF;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
  z-index: 3000;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.2s ease;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ─── Agent Update Package & Batch Monitor ───────────────────────── */
.agent-update-source-panel {
  background: var(--bg-secondary, #F8FAFC);
  border: 1px solid var(--border-subtle, #E2E8F0);
  border-radius: 8px;
  padding: 14px;
}
.pkg-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.pkg-header-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pkg-title {
  font-size: 13px;
  font-weight: bold;
  color: var(--text-primary, #0F172A);
}
.pkg-sub {
  font-size: 11px;
  color: var(--text-secondary, #64748B);
}
.pkg-actions-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.pkg-drop-zone {
  border: 2px dashed #CBD5E1;
  border-radius: 6px;
  padding: 16px;
  text-align: center;
  background: var(--bg-tertiary, #F1F5F9);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}
.pkg-drop-zone:hover, .pkg-drop-zone.drag-over {
  border-color: #2563EB;
  background: #EFF6FF;
}
.pkg-file-list-box {
  max-height: 120px;
  overflow-y: auto;
  border: 1px solid var(--border-subtle, #E2E8F0);
  border-radius: 4px;
  padding: 6px 8px;
  background: #FFFFFF;
  font-size: 11px;
}
.pkg-file-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
  border-bottom: 1px solid #F1F5F9;
}
.pkg-file-item:last-child {
  border-bottom: none;
}
.batch-monitor-summary-card {
  background: var(--bg-secondary, #F8FAFC);
  border: 1px solid var(--border-subtle, #E2E8F0);
  border-radius: 8px;
  padding: 12px 14px;
}
.progress-bar-track {
  width: 100%;
  height: 6px;
  background: #E2E8F0;
  border-radius: 3px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: #2563EB;
  border-radius: 3px;
  transition: width 0.25s ease;
}
.batch-monitor-table-wrap {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid var(--border-subtle, #E2E8F0);
  border-radius: 8px;
  background: #FFFFFF;
}
.badge-info {
  background: #EFF6FF;
  color: #2563EB;
  border: 1px solid #DBEAFE;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}
.badge-success {
  background: #ECFDF5;
  color: #059669;
  border: 1px solid #A7F3D0;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}
.badge-warning {
  background: #FFFBEB;
  color: #D97706;
  border: 1px solid #FDE68A;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE DESIGN (MOBILE PORTRAIT & LANDSCAPE ADAPTATIONS)
   Covers phones in portrait (<= 768px) and phones in landscape (height <= 550px).
   Desktop layout is 100% preserved.
   ══════════════════════════════════════════════════════════════════════════ */

.mobile-only {
  display: none !important;
}

@media (max-width: 768px), (max-height: 550px) and (orientation: landscape), (pointer: coarse) and (max-width: 1024px) and (max-height: 700px) {
  .desktop-only {
    display: none !important;
  }
  .mobile-only {
    display: flex !important;
  }
  .mobile-only.btn {
    display: inline-flex !important;
  }

  /* ── Shell & Body ── */
  body {
    height: 100dvh;
    height: 100vh;
    overflow: hidden;
  }

  /* ── Header ── */
  #header {
    height: auto;
    min-height: 48px;
    padding: 6px 12px;
    gap: 8px;
    flex-wrap: wrap;
  }
  .header-left {
    gap: 8px;
  }
  .brand-logo {
    width: 28px;
    height: 28px;
    font-size: 14px;
    border-radius: 5px;
  }
  .brand-name {
    font-size: 14px;
  }
  .brand-subtitle {
    font-size: 9px;
  }
  .header-center {
    order: 3;
    width: 100%;
    max-width: 100%;
    margin: 4px 0 2px 0;
  }
  #searchBox {
    height: 36px;
    font-size: 13px;
    border-radius: 6px;
  }
  .header-right {
    margin-left: auto;
  }
  .mobile-menu-btn {
    height: 32px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
  }

  /* ── Mobile Drawer Menu ── */
  .mobile-drawer {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(3px);
    z-index: 1000;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
  }
  .mobile-drawer-card {
    width: 290px;
    max-width: 85vw;
    height: 100%;
    background-color: var(--bg-secondary);
    box-shadow: -4px 0 20px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    padding: 16px;
    animation: drawerSlideIn 0.2s ease-out;
  }
  @keyframes drawerSlideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
  }
  .mobile-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 12px;
  }
  .btn-drawer {
    width: 100%;
    height: 42px;
    margin-bottom: 8px;
    justify-content: flex-start;
    font-size: 13px;
    font-weight: 500;
    padding: 0 14px;
    border-radius: 6px;
  }

  /* ── Mobile View Tabs ── */
  .mobile-nav-tabs {
    display: flex;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-subtle);
    padding: 4px 10px;
    gap: 6px;
    flex-shrink: 0;
  }
  .mobile-tab-btn {
    flex: 1;
    height: 36px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
  }
  .mobile-tab-btn.active {
    background-color: var(--accent-light);
    color: var(--accent-blue);
    border-color: var(--accent-border);
  }

  /* ── Workspace & Sidebar ── */
  #workspace {
    flex-direction: column;
    height: calc(100dvh - 128px);
    position: relative;
    overflow: hidden;
  }
  #sidebar {
    display: none;
    width: 100%;
    height: 100%;
    border-right: none;
    overflow-y: auto;
    padding: 10px;
  }
  #sidebar.mobile-visible {
    display: flex;
  }
  #sidebar .tree-item {
    padding: 10px 12px;
    font-size: 13px;
    margin-bottom: 4px;
  }
  #mainContent {
    display: none;
    width: 100%;
    height: 100%;
    padding: 10px;
    overflow-y: auto;
  }
  #mainContent.mobile-visible {
    display: flex;
  }

  /* ── Content Header ── */
  #contentHeader {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 10px;
    padding-bottom: 8px;
  }
  .group-info {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .group-actions {
    width: 100%;
    display: flex;
    gap: 6px;
  }
  .group-actions .btn {
    flex: 1;
    height: 36px;
    padding: 4px 8px;
    font-size: 11px;
  }

  /* ── Device Table Reflow (Cards View) ── */
  #deviceGridWrap {
    overflow-y: auto;
    flex: 1;
    padding-right: 2px;
  }
  #deviceTable {
    display: block;
    width: 100%;
    border: none;
  }
  #deviceTable thead {
    display: none;
  }
  #deviceTable tbody {
    display: block;
    width: 100%;
  }
  #deviceTable tbody tr {
    display: block;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  }
  #deviceTable tbody td {
    display: block;
    padding: 3px 0;
    border: none;
    width: 100% !important;
  }
  #deviceTable td:nth-child(1) {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
  }
  #deviceTable .device-cell {
    gap: 10px;
    margin-bottom: 4px;
  }
  #deviceTable .device-icon-box {
    width: 38px;
    height: 38px;
    font-size: 20px;
  }
  #deviceTable .device-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
  }
  #deviceTable .device-ip {
    font-size: 12px;
    color: var(--accent-blue);
    font-weight: 600;
  }
  #deviceTable .role-badge, #deviceTable .path-badge {
    display: inline-block;
    margin-right: 4px;
    margin-bottom: 4px;
    font-size: 11px;
    padding: 2px 8px;
  }
  #deviceTable .action-buttons {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-subtle);
  }
  #deviceTable .action-buttons .btn {
    flex: 1;
    height: 38px;
    font-size: 12px;
    font-weight: 600;
  }

  /* ── WinSCP File Manager on Mobile ── */
  .fm-dialog-wide {
    max-width: 98vw;
    width: 98vw;
    height: 94dvh;
    max-height: 94dvh;
  }
  .fm-dual-body {
    padding: 8px;
    overflow-y: auto;
  }
  .fm-dual-panes {
    flex-direction: column;
    height: auto;
    min-height: 500px;
    gap: 12px;
  }
  .fm-pane {
    height: 280px;
    min-height: 260px;
  }
  .fm-center-controls {
    flex-direction: row;
    width: 100%;
    padding: 4px 0;
    gap: 8px;
  }
  .fm-transfer-btn {
    flex: 1;
    height: 40px;
    font-size: 13px;
  }
  .fm-winscp-fnbar {
    overflow-x: auto;
    white-space: nowrap;
    padding: 4px;
    gap: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .fn-btn {
    min-width: 70px;
    height: 32px;
    font-size: 11px;
  }

  /* ── Remote Desktop Viewer on Mobile (2-Tier Ultra Compact Light Header - No Scrollbars) ── */
  .remote-ribbon {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
    height: auto;
    min-height: unset;
    padding: 4px 6px;
    gap: 3px;
    display: flex;
    flex-direction: column;
    overflow: hidden !important;
    white-space: normal;
    scrollbar-width: none !important;
  }
  .remote-ribbon::-webkit-scrollbar,
  .ribbon-row-1::-webkit-scrollbar,
  .ribbon-row-2::-webkit-scrollbar {
    display: none !important;
  }
  .ribbon-row-1 {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 3px;
    min-width: 0;
    overflow: hidden;
  }
  .ribbon-row-2 {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 3px;
    min-width: 0;
    overflow: hidden !important;
    white-space: nowrap;
    scrollbar-width: none !important;
  }
  .ribbon-row-1 .ribbon-group {
    display: flex;
    align-items: center;
    gap: 2px;
    min-width: 0;
  }
  .rv-menubar {
    display: flex;
    align-items: center;
    gap: 1px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .rv-menubar::-webkit-scrollbar {
    display: none;
  }
  .rv-menu-trigger {
    padding: 3px 6px;
    font-size: 11px;
  }
  .rv-btn-action {
    height: 25px;
    padding: 0 7px;
    font-size: 10.5px;
  }
  .ribbon-row-2 .ribbon-group {
    display: contents;
  }
  .ribbon-top-actions {
    display: flex;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
    margin-left: auto;
  }
  .remote-ribbon .ribbon-label {
    display: none;
  }
  .remote-ribbon .form-select {
    background-color: #FFFFFF;
    color: #1E293B;
    border: 1px solid #CBD5E1;
    font-size: 10.5px;
    height: 26px;
    padding: 0 4px;
    min-width: 0;
    border-radius: 4px;
  }
  .ribbon-row-2 .form-select {
    flex: 1;
    min-width: 0;
    padding: 0 2px;
    font-size: 10px;
  }
  .remote-ribbon .btn {
    height: 26px;
    font-size: 10.5px;
    padding: 0 6px;
    border-radius: 4px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    flex-shrink: 0;
  }
  .remote-ribbon .btn-secondary {
    background-color: #FFFFFF;
    color: #334155;
    border: 1px solid #CBD5E1;
  }
  .remote-ribbon .btn-primary {
    background-color: #2563EB;
    color: #FFFFFF;
    border: 1px solid #2563EB;
  }
  .remote-ribbon .btn-danger {
    background-color: #EF4444;
    color: #FFFFFF;
    border: 1px solid #EF4444;
  }
  .remote-ribbon .btn-success {
    background-color: #16A34A;
    color: #FFFFFF;
    border: 1px solid #16A34A;
  }
  .remote-ribbon .btn-success:hover {
    background-color: #15803D;
    border: 1px solid #15803D;
    color: #FFFFFF;
  }
  .ribbon-row-2 .btn {
    flex: 1;
    min-width: 0;
    padding: 0 2px;
    font-size: 10px;
    text-overflow: ellipsis;
    overflow: hidden;
  }
  
  /* Mobile Remote FAB Display - Visible on all Mobile Screens */
  .rv-floating-fab-container {
    display: block !important;
  }

  /* By default on Mobile, Remote Header & Footer are completely hidden for full immersion */
  #remoteViewerModal:not(.show-ribbon) #rvTabBar,
  #remoteViewerModal:not(.show-ribbon) .remote-ribbon,
  #remoteViewerModal:not(.show-ribbon) .remote-statusbar {
    display: none !important;
  }

  /* When explicitly toggled via Floating Menu, ribbon is displayed */
  #remoteViewerModal.show-ribbon #rvTabBar {
    display: flex !important;
  }
  #remoteViewerModal.show-ribbon .remote-ribbon {
    display: flex !important;
  }
  #remoteViewerModal.show-ribbon .remote-statusbar {
    display: flex !important;
  }

  .remote-viewport {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100dvh !important;
    background-color: #000000 !important;
    overflow: hidden !important;
    -webkit-overflow-scrolling: touch;
    touch-action: none;
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    margin: 0 !important;
    z-index: 1510;
  }

  #remoteViewerModal.show-ribbon .remote-viewport {
    position: relative !important;
    height: calc(100dvh - 90px) !important;
    max-height: calc(100dvh - 90px) !important;
  }
  
  /* Mobile Remote Canvas: Mode Normal (Fit Center / Proportional Fit) */
  .remote-viewport:not(.view-stretch):not(.zoomed) #rvCanvas:not(.hidden-session):not([style*="display: none"]),
  .remote-viewport:not(.view-stretch):not(.zoomed) .remote-canvas-session:not(.hidden-session):not([style*="display: none"]) {
    width: auto !important;
    height: auto !important;
    max-width: 100vw !important;
    max-height: 100dvh !important;
    max-height: 100vh !important;
    min-width: 0 !important;
    min-height: 0 !important;
    object-fit: contain !important;
    object-position: center center !important;
    margin: auto !important;
    padding: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    display: block !important;
    flex: 0 0 auto !important;
  }

  /* Mobile Remote Canvas: Mode STRETCH (Fill Entire Mobile Viewport) */
  .remote-viewport.view-stretch:not(.zoomed) #rvCanvas:not(.hidden-session):not([style*="display: none"]),
  .remote-viewport.view-stretch:not(.zoomed) .remote-canvas-session:not(.hidden-session):not([style*="display: none"]) {
    width: 100vw !important;
    height: 100dvh !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100dvh !important;
    max-height: 100vh !important;
    min-width: 0 !important;
    min-height: 0 !important;
    object-fit: fill !important;
    object-position: center center !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    display: block !important;
    flex: 1 1 100% !important;
  }

  #remoteViewerModal.show-ribbon .remote-viewport:not(.view-stretch):not(.zoomed) #rvCanvas:not(.hidden-session):not([style*="display: none"]),
  #remoteViewerModal.show-ribbon .remote-viewport:not(.view-stretch):not(.zoomed) .remote-canvas-session:not(.hidden-session):not([style*="display: none"]) {
    max-height: calc(100dvh - 90px) !important;
  }

  #remoteViewerModal.show-ribbon .remote-viewport.view-stretch:not(.zoomed) #rvCanvas:not(.hidden-session):not([style*="display: none"]),
  #remoteViewerModal.show-ribbon .remote-viewport.view-stretch:not(.zoomed) .remote-canvas-session:not(.hidden-session):not([style*="display: none"]) {
    height: calc(100dvh - 90px) !important;
    max-height: calc(100dvh - 90px) !important;
  }

  /* Zoom Mode on Mobile */
  .remote-viewport.zoomed #rvCanvas,
  .remote-viewport.zoomed .remote-canvas-session {
    width: 200% !important;
    height: auto !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
  }
  .remote-viewport.zoomed {
    overflow: auto !important;
    touch-action: pan-x pan-y !important;
    display: block !important;
  }

  /* ── Modals on Mobile ── */
  .modal-dialog {
    width: 95vw;
    max-width: 95vw;
    margin: 10px auto;
    max-height: 92dvh;
  }
  .modal-body {
    padding: 12px;
    max-height: calc(92dvh - 110px);
  }
  .form-row {
    flex-direction: column;
    gap: 0;
  }
  .modal-footer {
    padding: 10px 14px;
  }
  .modal-footer .btn {
    flex: 1;
    height: 38px;
  }

  /* ── Toasts on Mobile (Floating at Top Center) ── */
  .toast {
    top: 72px;
    bottom: auto;
    left: 50%;
    right: auto;
    transform: translate(-50%, -12px);
    max-width: 90vw;
    text-align: center;
    border-radius: 20px;
    background: rgba(15, 23, 42, 0.94);
    color: #FFFFFF;
    font-size: 11.5px;
    padding: 7px 16px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.35);
    z-index: 3500;
  }
  .toast.show {
    transform: translate(-50%, 0);
  }
}

/* ══════════════════════════════════════════════════════════════════
   MODERN BATCHING & GROUPING & TRANSFER CARD STYLES
══════════════════════════════════════════════════════════════════ */
.batch-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  padding: 6px 14px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  animation: fadeInDown 0.2s ease-out;
}
.batch-bar-info {
  display: flex;
  align-items: center;
  gap: 8px;
}
.batch-bar-badge {
  background: #EFF6FF;
  color: #2563EB;
  font-weight: 700;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid #BFDBFE;
}
.batch-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
/* ══════════════════════════════════════════════════════════════════
   BATCH GROUPING MODAL STYLES (DESKTOP & MOBILE RESPONSIVE)
══════════════════════════════════════════════════════════════════ */
.batch-grouping-dialog {
  max-width: 880px;
  width: 100%;
}

.batch-grouping-body {
  padding: 16px;
}

.grouping-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 16px;
  align-items: start;
}

.grouping-config-pane {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 14px;
}

.grouping-preview-pane {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
  gap: 8px;
  flex-wrap: wrap;
}

.preview-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--text-primary);
}

.group-preview-tree {
  flex: 1;
  overflow-y: auto;
  max-height: 380px;
  font-size: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 10px;
  background: var(--bg-tertiary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.preview-group-node {
  margin-bottom: 8px;
}

.preview-subgroup-node {
  margin: 4px 0;
}

.preview-node-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 12px;
  min-height: 28px;
}

.preview-node-header:hover {
  background: rgba(0, 0, 0, 0.04);
}

.preview-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.preview-name {
  color: var(--text-primary);
  font-weight: 600;
  word-break: break-word;
}

.preview-count {
  margin-left: auto;
  font-size: 10.5px;
  background: var(--bg-secondary);
  color: var(--text-muted);
  padding: 1px 6px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  font-weight: 600;
  flex-shrink: 0;
}

.preview-node-children {
  margin-left: 16px;
  padding-left: 8px;
  border-left: 2px dashed var(--border-subtle);
  margin-top: 2px;
  margin-bottom: 2px;
}

.preview-node-devices {
  margin-left: 16px;
  padding-left: 8px;
  border-left: 1px solid var(--border-subtle);
  margin-top: 2px;
}

.preview-device-item {
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 6px;
  font-size: 11px;
  min-height: 24px;
  word-break: break-all;
  border-radius: 4px;
}

.preview-device-item:hover {
  background: var(--accent-light);
  color: var(--accent-blue);
}

/* Radio Card Selector */
.radio-card-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.radio-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--bg-tertiary);
  border: 1.5px solid var(--border-subtle);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  min-height: 48px;
}

.radio-card:hover {
  border-color: var(--accent-blue, #2563EB);
  background: var(--bg-secondary);
}

.radio-card input[type="radio"]:checked ~ .radio-card-content .radio-card-title {
  color: var(--accent-blue, #2563EB);
}

.radio-card input[type="radio"] {
  width: 17px;
  height: 17px;
  margin-top: 2px;
  accent-color: var(--accent-blue, #2563EB);
  flex-shrink: 0;
  cursor: pointer;
}

.radio-card-content {
  flex: 1;
  min-width: 0;
}

.radio-card-title {
  font-weight: 700;
  font-size: 12.5px;
  color: var(--text-primary);
  word-break: break-word;
}

.radio-card-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.35;
}

.batch-grouping-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
}

/* Batch Grouping Mobile Viewport Adaptations */
@media (max-width: 768px) {
  .batch-grouping-dialog {
    width: 95vw !important;
    max-width: 95vw !important;
    margin: 8px auto !important;
    max-height: calc(100dvh - 16px) !important;
    border-radius: 12px !important;
  }

  .batch-grouping-body {
    max-height: calc(100dvh - 150px) !important;
    padding: 12px 10px !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .grouping-grid {
    grid-template-columns: 1fr !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
  }

  .grouping-config-pane,
  .grouping-preview-pane {
    padding: 10px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .radio-card {
    padding: 10px 12px;
    min-height: 48px;
  }

  .radio-card input[type="radio"] {
    width: 18px;
    height: 18px;
  }

  .form-select {
    min-height: 42px;
    font-size: 13px;
  }

  .group-preview-tree {
    max-height: 230px !important;
    padding: 8px !important;
  }

  .preview-node-children,
  .preview-node-devices {
    margin-left: 12px !important;
    padding-left: 6px !important;
  }

  .batch-grouping-footer {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
    padding: 10px 12px !important;
  }

  .batch-grp-btn-apply,
  .batch-grp-btn-cancel {
    width: 100% !important;
    min-height: 44px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
}

@media (max-width: 480px) {
  .batch-grouping-dialog {
    width: 98vw !important;
    max-width: 98vw !important;
    margin: 4px auto !important;
  }

  .preview-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}


/* Drop Zone (Radmin Import) */
.drop-zone {
  border: 2px dashed #94A3B8;
  border-radius: 8px;
  background: #F8FAFC;
  padding: 28px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: #2563EB;
  background: #EFF6FF;
}
.drop-zone-icon {
  font-size: 32px;
  margin-bottom: 8px;
}
.drop-zone-text {
  font-size: 13px;
  color: #475569;
}

/* Floating File Transfer Card Overlay on Remote Screen */
.rv-transfer-card {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 320px;
  max-width: calc(100% - 36px);
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 12px 14px;
  color: #FFFFFF;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  z-index: 2100;
  animation: fadeIn 0.2s ease;
}
.rv-transfer-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.rv-transfer-icon {
  font-size: 20px;
}
.rv-transfer-info {
  flex: 1;
  min-width: 0;
}
.rv-transfer-title {
  font-size: 11px;
  color: #94A3B8;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.rv-transfer-filename {
  font-size: 13px;
  font-weight: 700;
  color: #FFFFFF;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rv-transfer-percent {
  font-weight: 800;
  font-size: 13px;
  color: #38BDF8;
}
.rv-progress-bar-wrap {
  width: 100%;
  height: 6px;
  background: #334155;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}
.rv-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #38BDF8, #2563EB);
  border-radius: 3px;
  transition: width 0.15s ease;
}
.rv-transfer-footer {
  font-size: 11px;
  color: #64748B;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ══════════════════════════════════════════════════════════════════
   ROLE MANAGER & STATUS PILLS (NUDESK VIEWER PARITY)
   ══════════════════════════════════════════════════════════════════ */
.role-manager-list {
  max-height: 420px;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
}

.role-card {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
  transition: all 0.15s ease;
}

.role-card:hover {
  border-color: #CBD5E1;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.role-card-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.role-card-header {
  display: flex;
  align-items: center;
  gap: 6px;
}

.role-card-badge {
  background: #EFF6FF;
  border: 1px solid #DBEAFE;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11px;
}

.role-card-name {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.role-card-props {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 11.5px;
  margin-left: 26px;
  flex-wrap: wrap;
}

.role-card-prop-label {
  font-weight: 600;
  color: var(--text-muted);
}

.role-card-prop-val {
  color: var(--text-secondary);
  word-break: break-all;
}

.role-card-prop-folder {
  color: #2563EB;
  font-weight: 600;
  word-break: break-all;
}

.role-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  white-space: nowrap;
}

/* Modal Layering & Stacking (Browse Picker, File Manager & Confirm on top of Remote Desktop & Modals) */
#fileManagerModal {
  z-index: 2500 !important;
}

#roleEditModal {
  z-index: 3000 !important;
}

#setAppPathModal {
  z-index: 4000 !important;
}

#customConfirmModal {
  z-index: 10000 !important;
}

#toastContainer {
  z-index: 10050 !important;
}

/* Status Pill Variations (NuDesk Viewer Parity) */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.status-pill.status-running,
.status-pill.online {
  background-color: #DCFCE7 !important;
  color: #15803D !important;
  border: 1px solid #BBF7D0;
}

.status-pill.status-stopped {
  background-color: #FFEDD5 !important;
  color: #C2410C !important;
  border: 1px solid #FED7AA;
}

.status-pill.status-notfound {
  background-color: #FEF9C3 !important;
  color: #A16207 !important;
  border: 1px solid #FEF08A;
}

.status-pill.status-authfailed {
  background-color: #F3E8FF !important;
  color: #7E22CE !important;
  border: 1px solid #E9D5FF;
}

.status-pill.status-offline,
.status-pill.offline {
  background-color: #FEE2E2 !important;
  color: #B91C1C !important;
  border: 1px solid #FECACA;
}

.status-pill.pinging {
  background-color: #FEF3C7 !important;
  color: #B45309 !important;
  border: 1px solid #FDE68A;
}

.status-pill.status-unknown {
  background-color: #F1F5F9 !important;
  color: #64748B !important;
  border: 1px solid #E2E8F0;
}

/* ══════════════════════════════════════════════════════════════════
   FILE SERVER FOLDER TREE VIEW STYLES (DESKTOP & MOBILE RESPONSIVE)
══════════════════════════════════════════════════════════════════ */
.fst-modal-dialog {
  max-width: 700px;
  width: 100%;
}

.fst-stat-card {
  background: var(--bg-tertiary);
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 14px;
  border: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.fst-stat-group {
  display: flex;
  align-items: center;
  gap: 28px;
}

.fst-stat-item {
  display: flex;
  flex-direction: column;
}

.fst-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.fst-stat-val {
  font-size: 18px;
  font-weight: 800;
  margin-top: 2px;
}

.fst-stat-val.text-primary {
  color: var(--text-primary);
}

.fst-stat-val.text-accent {
  color: var(--accent-blue);
}

.fst-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding: 6px 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  min-height: 38px;
}

.fst-toolbar-select-all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--text-secondary);
  user-select: none;
}

.fst-cb-custom {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent-blue, #2563EB);
}

.fst-selected-badge {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.fst-tree {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fst-branch {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  transition: all 0.2s ease;
}

.fst-branch:hover {
  border-color: #94A3B8;
}

.fst-branch-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-subtle);
  user-select: none;
  gap: 10px;
  cursor: pointer;
}

.fst-branch-header-single {
  cursor: default;
}

.fst-branch-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 13px;
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
}

.fst-cb-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin: 0;
  padding: 2px;
  user-select: none;
}

.fst-cb-label input {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent-blue, #2563EB);
  margin: 0;
}

.fst-branch-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.fst-branch-text {
  flex: 1;
  min-width: 0;
}

.fst-branch-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.fst-branch-name {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text-primary);
}

.fst-path-badge {
  font-size: 11px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent-blue);
  font-weight: 600;
}

.fst-branch-desc {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: normal;
  margin-top: 2px;
  line-height: 1.4;
}

.fst-toggle-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 11px;
  color: var(--text-muted);
  padding: 4px 6px;
  border-radius: 4px;
  transition: transform 0.2s ease, background-color 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.fst-toggle-btn:hover {
  background-color: rgba(0, 0, 0, 0.05);
  color: var(--text-primary);
}

.fst-toggle-btn.collapsed {
  transform: rotate(-90deg);
}

.fst-branch-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.fst-badges-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.fst-action-btn {
  white-space: nowrap;
}

.fst-children {
  display: flex;
  flex-direction: column;
  padding: 6px 14px 10px 34px;
  position: relative;
  background: var(--bg-secondary);
}

.fst-children::before {
  content: "";
  position: absolute;
  top: 6px;
  bottom: 14px;
  left: 22px;
  width: 2px;
  background: var(--border-subtle, #CBD5E1);
}

.fst-node {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: 6px;
  margin-top: 3px;
  transition: background 0.15s ease;
  position: relative;
  border: 1px solid transparent;
  gap: 8px;
}

.fst-node::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -12px;
  width: 12px;
  height: 2px;
  background: var(--border-subtle, #CBD5E1);
}

.fst-node:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-subtle);
}

.fst-node-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.fst-node-icon {
  font-size: 15px;
  flex-shrink: 0;
}

.fst-node-text {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
}

.fst-node-name {
  font-weight: 600;
  font-size: 12.5px;
  color: var(--text-primary);
}

.fst-node-path {
  font-size: 10.5px;
  color: var(--text-muted);
}

.fst-node-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.fst-node-del-btn {
  padding: 2px 6px;
  font-size: 12px;
  cursor: pointer;
  border-radius: 4px;
}

.fst-modal-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 12px 16px;
  gap: 12px;
}

.fst-footer-notice {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.35;
}

.fst-notice-icon {
  font-size: 13px;
  flex-shrink: 0;
}

.fst-footer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════════════
   MOBILE VIEWPORT ADAPTATIONS (ANTISLOP-LAYOUTMOBILE)
══════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .fst-modal-dialog {
    width: 95vw !important;
    max-width: 95vw !important;
    margin: 8px auto !important;
    max-height: calc(100dvh - 16px) !important;
    border-radius: 10px !important;
  }

  .fst-modal-body {
    max-height: calc(100dvh - 155px) !important;
    padding: 12px 10px !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  /* Stat Summary Card Mobile Reflow */
  .fst-stat-card {
    flex-wrap: wrap;
    padding: 10px 12px;
    gap: 10px;
    margin-bottom: 10px;
  }

  .fst-stat-group {
    flex: 1;
    min-width: 180px;
    gap: 14px;
    justify-content: space-between;
  }

  .fst-stat-label {
    font-size: 10px;
  }

  .fst-stat-val {
    font-size: 15px;
  }

  .fst-refresh-btn {
    min-height: 38px;
    padding: 0 12px;
    font-size: 12px;
    font-weight: 600;
  }

  /* Toolbar Mobile */
  .fst-toolbar {
    padding: 6px 10px;
    min-height: 42px;
    margin-bottom: 10px;
  }

  .fst-toolbar-select-all {
    min-height: 38px;
    font-size: 12px;
  }

  .fst-cb-custom {
    width: 18px;
    height: 18px;
  }

  /* Tree Branch Mobile Reflow */
  .fst-branch-header {
    flex-direction: column;
    align-items: stretch;
    padding: 10px;
    gap: 8px;
  }

  .fst-branch-title {
    width: 100%;
    align-items: flex-start;
    gap: 8px;
  }

  .fst-toggle-btn {
    min-width: 38px;
    min-height: 38px;
    font-size: 13px;
    background: rgba(0,0,0,0.04);
    border-radius: 6px;
  }

  .fst-cb-label {
    min-width: 36px;
    min-height: 36px;
  }

  .fst-cb-label input {
    width: 18px;
    height: 18px;
  }

  .fst-branch-icon {
    font-size: 20px;
    margin-top: 4px;
  }

  .fst-branch-name-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  .fst-branch-name {
    font-size: 13px;
  }

  .fst-path-badge {
    font-size: 10.5px;
    word-break: break-all;
  }

  .fst-branch-desc {
    font-size: 10.5px;
    line-height: 1.35;
    margin-top: 3px;
  }

  .fst-branch-stats {
    width: 100%;
    justify-content: space-between;
    padding-top: 8px;
    border-top: 1px dashed var(--border-subtle);
    gap: 6px;
  }

  .fst-badges-wrap {
    gap: 4px;
  }

  .fst-badges-wrap .badge {
    font-size: 10px !important;
    padding: 3px 6px !important;
  }

  .fst-action-btn {
    min-height: 36px;
    padding: 0 10px;
    font-size: 11.5px;
    font-weight: 600;
  }

  /* Tree Children Mobile */
  .fst-children {
    padding: 4px 6px 8px 18px;
  }

  .fst-children::before {
    left: 10px;
    top: 4px;
    bottom: 10px;
  }

  .fst-node {
    flex-direction: column;
    align-items: stretch;
    padding: 8px;
    margin-top: 4px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    gap: 6px;
  }

  .fst-node::before {
    left: -8px;
    width: 8px;
    top: 20px;
  }

  .fst-node-info {
    width: 100%;
    align-items: flex-start;
    gap: 6px;
  }

  .fst-node-icon {
    font-size: 16px;
    margin-top: 2px;
  }

  .fst-node-text {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  .fst-node-name {
    font-size: 12px;
    word-break: break-word;
  }

  .fst-node-path {
    font-size: 10px;
    word-break: break-all;
    line-height: 1.3;
  }

  .fst-node-meta {
    width: 100%;
    justify-content: space-between;
    align-items: center;
    padding-top: 6px;
    border-top: 1px dotted rgba(0, 0, 0, 0.08);
    gap: 6px;
  }

  .fst-node-meta .fst-badges-wrap .badge {
    font-size: 9.5px !important;
    padding: 2px 6px !important;
  }

  .fst-node-del-btn {
    min-width: 38px;
    min-height: 36px;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 4px;
  }

  /* Modal Footer Mobile */
  .fst-modal-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 10px 12px;
  }

  .fst-footer-notice {
    font-size: 10.5px;
    text-align: center;
    justify-content: center;
  }

  .fst-footer-actions {
    width: 100%;
    display: flex;
    gap: 8px;
  }

  .fst-btn-close, .fst-btn-delete {
    flex: 1;
    min-height: 42px;
    font-size: 12.5px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    text-align: center;
  }

  /* Custom Confirmation Modal Mobile */
  #customConfirmModal .modal-dialog {
    width: 90vw !important;
    max-width: 400px !important;
    margin: 20px auto !important;
    border-radius: 10px !important;
  }
  #customConfirmModal .modal-footer {
    display: flex;
    gap: 8px;
    padding: 10px 14px;
  }
  #customConfirmModal .modal-footer .btn {
    flex: 1;
    min-height: 42px;
    font-size: 13px;
    font-weight: 600;
  }
}

@media (max-width: 480px) {
  .fst-modal-dialog {
    width: 98vw !important;
    max-width: 98vw !important;
    margin: 4px auto !important;
  }

  .fst-stat-group {
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
  }

  .fst-stat-card {
    flex-direction: column;
    align-items: stretch;
  }

  .fst-refresh-btn {
    width: 100%;
  }

  .fst-footer-actions {
    flex-direction: column;
  }

  .fst-btn-close, .fst-btn-delete {
    width: 100%;
  }
}

/* Touch feedback for active states */
.fst-toggle-btn:active,
.fst-action-btn:active,
.fst-node-del-btn:active,
.fst-refresh-btn:active {
  transform: scale(0.96);
}

/* ═══════════════════════════ FLOATING MINI WINDOW (LIGHT THEME) ══════════════════════════ */
.rv-floating-pip {
  position: fixed;
  bottom: 44px;
  right: 24px;
  z-index: 9990;
  width: 380px;
  height: 250px;
  min-width: 280px;
  min-height: 180px;
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: 12px;
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.22), 0 2px 8px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  resize: both;
  overflow: hidden;
  user-select: none;
  animation: modalFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.rv-pip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  cursor: grab;
  background: linear-gradient(180deg, #F8FAFC 0%, #EDF2F7 100%);
  border-bottom: 1px solid #CBD5E1;
  flex-shrink: 0;
}

.rv-pip-header:active {
  cursor: grabbing;
}

.rv-pip-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.rv-pip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10B981;
  box-shadow: 0 0 6px #10B981;
  flex-shrink: 0;
  animation: rvPulse 2s infinite;
}

@keyframes rvPulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.rv-pip-title {
  font-size: 12px;
  font-weight: 700;
  color: #0F172A;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 170px;
}

.rv-pip-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
  background: #EFF6FF;
  color: #2563EB;
  border: 1px solid #BFDBFE;
  flex-shrink: 0;
}

.rv-pip-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.rv-pip-btn {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.rv-pip-btn-show {
  background: #2563EB;
  border-color: #1D4ED8;
  color: #FFFFFF;
}

.rv-pip-btn-show:hover {
  background: #1D4ED8;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
}

.rv-pip-btn-close {
  background: #FEE2E2;
  border-color: #FECACA;
  color: #DC2626;
}

.rv-pip-btn-close:hover {
  background: #EF4444;
  border-color: #DC2626;
  color: #FFFFFF;
}

.rv-pip-preview {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 0;
  background: #090D16;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
}

.rv-pip-canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  outline: none;
}

.rv-pip-overlay-hint {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.rv-pip-preview:hover .rv-pip-overlay-hint {
  opacity: 1;
}

/* ══════════════════════════════════════════════════════════════════
   CUSTOM FLOATING & DRAGGABLE MOBILE VIRTUAL KEYBOARD
══════════════════════════════════════════════════════════════════ */
.rv-virtual-keyboard-dock {
  position: fixed;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2500;
  display: flex;
  flex-direction: column;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.08);
  padding: 6px;
  gap: 5px;
  width: 98vw;
  max-width: 680px;
  box-sizing: border-box;
  touch-action: none !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}

.rv-virtual-keyboard-dock.floating-custom-pos {
  transform: none !important;
}

.rv-virtual-keyboard-dock.is-dragging {
  opacity: 0.92;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.8), 0 0 0 2px #38BDF8;
}

.rv-kbd-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 2px 4px 6px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  touch-action: none !important;
  user-select: none !important;
  cursor: move;
}

.rv-kbd-drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  color: #E2E8F0;
  font-size: 11px;
  font-weight: 700;
  cursor: grab;
  touch-action: none !important;
  user-select: none !important;
  flex-shrink: 0;
}

.rv-kbd-drag-handle:active {
  cursor: grabbing;
  background: rgba(56, 189, 248, 0.25);
  border-color: #38BDF8;
  color: #FFFFFF;
}

.rv-kbd-tabs {
  display: flex;
  gap: 4px;
  touch-action: manipulation;
}

.rv-kbd-tab {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: #94A3B8;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  touch-action: manipulation;
}

.rv-kbd-tab:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #FFFFFF;
}

.rv-kbd-tab.active {
  background: #2563EB;
  border-color: #3B82F6;
  color: #FFFFFF;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.4);
}

.rv-kbd-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  touch-action: manipulation;
}

.rv-kbd-key-action {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  color: #F8FAFC;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.15s ease;
}

.rv-kbd-key-action:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
}

.rv-kbd-key-action:active {
  transform: scale(0.95);
}

.rv-kbd-btn-close {
  background: rgba(239, 68, 68, 0.25) !important;
  border-color: rgba(239, 68, 68, 0.45) !important;
  color: #FCA5A5 !important;
}

.rv-kbd-btn-close:hover {
  background: #EF4444 !important;
  color: #FFFFFF !important;
}

.rv-kbd-body {
  display: flex;
  flex-direction: column;
  gap: 3.5px;
}

.rv-kbd-row {
  display: flex;
  gap: 3px;
  width: 100%;
}

.rv-kbd-key {
  flex: 1;
  min-width: 0;
  height: 32px;
  min-height: 32px;
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  color: #F8FAFC;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  transition: background 0.1s ease, transform 0.08s ease, border-color 0.1s ease;
}

.rv-kbd-key:hover {
  background: rgba(51, 65, 85, 0.95);
  border-color: rgba(255, 255, 255, 0.25);
}

.rv-kbd-key:active {
  transform: scale(0.94);
  background: #2563EB !important;
  border-color: #60A5FA !important;
  color: #FFFFFF !important;
}

.rv-kbd-fn {
  background: rgba(15, 23, 42, 0.85);
  color: #94A3B8;
  font-size: 11px;
}

.rv-kbd-backspace,
.rv-kbd-enter,
.rv-kbd-tab-btn,
.rv-kbd-caps,
.rv-kbd-shift {
  flex: 1.35;
  font-size: 11px;
}

.rv-kbd-space {
  flex: 4;
}

.rv-kbd-nav {
  flex: 0.9;
  font-size: 13px;
}

.rv-kbd-key.active-modifier {
  background: #2563EB !important;
  border-color: #60A5FA !important;
  color: #FFFFFF !important;
  box-shadow: 0 0 10px rgba(37, 99, 235, 0.6) !important;
}

.rv-kbd-symbols-container {
  display: flex;
  gap: 8px;
}

.rv-kbd-symbols-grid {
  flex: 2;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 3.5px;
}

.rv-kbd-numpad-grid {
  flex: 1.2;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3.5px;
}

.rv-kbd-shortcuts-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.rv-kbd-shortcuts-grid .rv-kbd-key {
  height: 34px;
  font-size: 11px;
}

/* ── Ultra-Slim Landscape Mode for Mobile Screens ── */
@media (orientation: landscape) and (max-height: 520px), (max-width: 950px) and (orientation: landscape) {
  .rv-virtual-keyboard-dock {
    width: 92vw;
    max-width: 620px;
    padding: 3px 5px;
    gap: 2.5px;
    border-radius: 8px;
    bottom: 4px;
  }
  
  .rv-kbd-header {
    padding: 1px 2px 3px 2px;
    gap: 4px;
  }
  
  .rv-kbd-drag-handle {
    font-size: 9.5px;
    padding: 2px 6px;
    border-radius: 4px;
  }
  
  .rv-kbd-tab {
    font-size: 9.5px;
    padding: 2px 6px;
    border-radius: 4px;
  }
  
  .rv-kbd-key-action {
    font-size: 9.5px;
    padding: 2px 6px;
    border-radius: 4px;
  }
  
  .rv-kbd-row {
    gap: 2px;
  }
  
  .rv-kbd-key {
    height: 22px;
    min-height: 22px;
    font-size: 10.5px;
    border-radius: 4px;
  }
  
  .rv-kbd-fn,
  .rv-kbd-backspace,
  .rv-kbd-enter,
  .rv-kbd-tab-btn,
  .rv-kbd-caps,
  .rv-kbd-shift {
    font-size: 9.5px;
  }
  
  .rv-kbd-symbols-grid {
    gap: 2px;
  }
  
  .rv-kbd-numpad-grid {
    gap: 2px;
  }
  
  .rv-kbd-shortcuts-grid {
    gap: 2.5px;
  }
  
  .rv-kbd-shortcuts-grid .rv-kbd-key {
    height: 22px;
    font-size: 9.5px;
  }
}

/* ══════════════════════════════════════════════════════════════════
   DIRECT DRAG & DROP OVERLAY & CONFIRMATION MODAL
══════════════════════════════════════════════════════════════════ */
.rv-direct-drop-overlay {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  bottom: 12px;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 2.5px dashed #38BDF8;
  border-radius: 16px;
  z-index: 3400;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  animation: dropOverlayFadeIn 0.2s ease-out;
  box-shadow: 0 0 35px rgba(56, 189, 248, 0.35) inset, 0 8px 32px rgba(0, 0, 0, 0.5);
}

@keyframes dropOverlayFadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

.rv-drop-zone-content {
  text-align: center;
  color: #FFFFFF;
}

.rv-drop-icon {
  font-size: 54px;
  margin-bottom: 10px;
  animation: bounceDropIcon 1.2s infinite ease-in-out;
}

@keyframes bounceDropIcon {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.rv-drop-title {
  font-size: 22px;
  font-weight: 700;
  color: #F8FAFC;
  letter-spacing: -0.3px;
  margin-bottom: 4px;
}

.rv-drop-subtitle {
  font-size: 13.5px;
  color: #94A3B8;
}

/* Direct Transfer Files List Preview */
.rv-direct-files-list {
  max-height: 140px;
  overflow-y: auto;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rv-direct-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  font-size: 12.5px;
}

.rv-direct-file-item .file-name {
  font-weight: 600;
  color: #1E293B;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}

.rv-direct-file-item .file-size {
  font-size: 11.5px;
  color: #64748B;
  font-family: monospace;
  white-space: nowrap;
}

/* Role Quick Paths Chip Container */
.rv-quick-paths-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 135px;
  overflow-y: auto;
  padding: 4px 0;
}

.rv-quick-path-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 20px;
  background: #F1F5F9;
  border: 1px solid #CBD5E1;
  color: #334155;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.rv-quick-path-chip:hover {
  background: #E2E8F0;
  border-color: #94A3B8;
  color: #0F172A;
  transform: translateY(-1px);
}

.rv-quick-path-chip.active {
  background: #EFF6FF;
  border-color: #3B82F6;
  color: #1D4ED8;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.rv-quick-path-chip.role-custom {
  background: #FDF4FF;
  border-color: #E879F9;
  color: #86198F;
}

.rv-quick-path-chip.role-custom:hover {
  background: #FAE8FF;
  border-color: #C084FC;
}

.rv-quick-path-chip .chip-del-btn {
  margin-left: 2px;
  color: #94A3B8;
  font-size: 11px;
  padding: 0 2px;
  border-radius: 50%;
  line-height: 1;
  transition: color 0.1s ease;
}

.rv-quick-path-chip .chip-del-btn:hover {
  color: #EF4444;
  background: rgba(239, 68, 68, 0.15);
}

/* Floating Remote File Transfer Card */
.rv-transfer-card {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 2800;
  width: 320px;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 12px 14px;
  color: #FFFFFF;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.08);
  animation: modalFadeIn 0.2s ease-out;
}

.rv-transfer-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.rv-transfer-icon {
  font-size: 20px;
}

.rv-transfer-info {
  flex: 1;
  min-width: 0;
}

.rv-transfer-title {
  font-size: 11.5px;
  font-weight: 700;
  color: #38BDF8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.rv-transfer-filename {
  font-size: 12px;
  font-weight: 600;
  color: #F8FAFC;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rv-transfer-percent {
  font-size: 12.5px;
  font-weight: 700;
  color: #10B981;
  font-family: monospace;
}

.rv-progress-bar-wrap {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.rv-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3B82F6 0%, #10B981 100%);
  border-radius: 4px;
  transition: width 0.15s ease-out;
}

.rv-transfer-footer {
  font-size: 11px;
  color: #94A3B8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  justify-content: space-between;
}

/* ══════════════════════════════════════════════════════════════════
   REMOTE FOLDER PICKER MODAL STYLES
══════════════════════════════════════════════════════════════════ */
.rv-picker-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  margin-bottom: 10px;
}

.rv-picker-breadcrumb-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: thin;
}

.rv-picker-crumb {
  font-size: 11.5px;
  font-weight: 600;
  color: #2563EB;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background 0.1s ease;
}

.rv-picker-crumb:hover {
  background: #EFF6FF;
  text-decoration: underline;
}

.rv-picker-crumb-separator {
  color: #94A3B8;
  font-size: 11px;
}

.rv-picker-folder-list {
  height: 240px;
  max-height: 240px;
  overflow-y: auto;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rv-picker-folder-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: #1E293B;
  cursor: pointer;
  user-select: none;
  transition: background 0.1s ease, transform 0.05s ease;
}

.rv-picker-folder-row:hover {
  background: #EFF6FF;
  color: #1D4ED8;
}

.rv-picker-folder-row.selected {
  background: #DBEAFE;
  color: #1E40AF;
  font-weight: 700;
}

.rv-picker-folder-row .folder-info {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rv-picker-folder-row .folder-icon {
  font-size: 15px;
  color: #F59E0B;
}

.rv-picker-folder-row .folder-date {
  font-size: 11px;
  color: #94A3B8;
  font-family: monospace;
}

.rv-picker-selected-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: #F1F5F9;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  margin-top: 10px;
}

/* ══════════════════════════════════════════════════════════════════
   USER MANAGEMENT MODAL & ACTION MENU STYLES
══════════════════════════════════════════════════════════════════ */
.user-mgmt-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 10px;
  flex-wrap: wrap;
}

.user-mgmt-summary {
  font-size: 12px;
  color: #64748B;
  font-weight: 500;
}

.user-mgmt-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.user-mgmt-table-container {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow-x: auto;
  background: var(--bg-panel);
  -webkit-overflow-scrolling: touch;
}

.user-mgmt-table {
  width: 100%;
  margin: 0;
  border-collapse: collapse;
}

.user-mgmt-table th {
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 700;
  color: #64748B;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  background: #F8FAFC;
  white-space: nowrap;
}

.user-mgmt-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  font-size: 12px;
}

.user-mgmt-table tbody tr:hover {
  background-color: #F8FAFC;
}

.user-mgmt-username-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-mgmt-username {
  font-weight: 700;
  color: #0F172A;
  font-size: 13px;
  letter-spacing: 0.2px;
}

.user-mgmt-created {
  font-size: 10.5px;
  color: #94A3B8;
  font-family: monospace;
}

.btn-action-dots {
  min-width: 32px;
  height: 30px;
  padding: 0 8px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  border-radius: 6px;
  border: 1px solid #CBD5E1;
  background: #FFFFFF;
  color: #475569;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-action-dots:hover, .btn-action-dots:focus {
  background: #EFF6FF;
  border-color: #93C5FD;
  color: #1D4ED8;
  outline: none;
}

.user-action-menu {
  position: fixed;
  z-index: 9999;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.12), 0 8px 10px -6px rgba(15, 23, 42, 0.08);
  padding: 4px;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: dropdownFadeIn 0.12s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dropdownFadeIn {
  from { opacity: 0; transform: scale(0.95) translateY(-4px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.user-action-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 12.5px;
  font-weight: 500;
  color: #1E293B;
  border-radius: 6px;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background 0.1s ease, color 0.1s ease;
  min-height: 36px;
}

.user-action-menu-item:hover {
  background: #F1F5F9;
  color: #0F172A;
}

.user-action-menu-item .menu-item-icon {
  font-size: 14px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.user-action-menu-item.danger {
  color: #DC2626;
}

.user-action-menu-item.danger:hover {
  background: #FEF2F2;
  color: #B91C1C;
}

.user-action-menu-item.warning {
  color: #D97706;
}

.user-action-menu-item.warning:hover {
  background: #FFFBEB;
  color: #B45309;
}

.user-action-menu-item.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.user-action-menu-divider {
  height: 1px;
  background: #E2E8F0;
  margin: 3px 0;
}

.user-mgmt-ip-pill {
  font-family: monospace;
  font-size: 11px;
  padding: 2px 6px;
  background: #F1F5F9;
  border: 1px solid #E2E8F0;
  border-radius: 4px;
  color: #334155;
  display: inline-block;
  margin-top: 2px;
}

/* ══════════════════════════════════════════════════════════════════
   MOBILE VIEW REFLOW (RESPONSIVE CARDS)
══════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .user-mgmt-dialog {
    width: 96vw !important;
    max-width: 96vw !important;
    margin: 10px auto !important;
  }

  .user-mgmt-table thead {
    display: none;
  }

  .user-mgmt-table, 
  .user-mgmt-table tbody, 
  .user-mgmt-table tr, 
  .user-mgmt-table td {
    display: block;
    width: 100%;
  }

  .user-mgmt-table tbody {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 8px;
  }

  .user-mgmt-table tr {
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    padding: 12px 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  }

  .user-mgmt-table td {
    padding: 6px 0;
    border-bottom: 1px solid #F8FAFC;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12.5px;
  }

  .user-mgmt-table td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 11px;
    color: #64748B;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-right: 12px;
    flex-shrink: 0;
  }

  .user-mgmt-table td.cell-user-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #E2E8F0;
    padding-bottom: 8px;
    margin-bottom: 6px;
  }

  .user-mgmt-table td.cell-user-header::before {
    display: none;
  }

  .user-mgmt-table td.cell-action {
    display: flex;
    justify-content: flex-end;
    border-bottom: none;
    padding-top: 8px;
    margin-top: 4px;
    border-top: 1px dashed #E2E8F0;
  }

  .user-mgmt-table td.cell-action::before {
    display: none;
  }

  .btn-action-dots {
    min-width: 44px;
    height: 44px;
    font-size: 20px;
    border-radius: 8px;
  }

  .user-action-menu {
    min-width: 220px;
  }

  .user-action-menu-item {
    min-height: 44px;
    font-size: 13.5px;
    padding: 10px 14px;
  }
}

/* ══════════════════════════════════════════════════════════════════
   CONTEXT MENU & DEVICE ACTION MENU
══════════════════════════════════════════════════════════════════ */
.context-menu,
#contextMenu {
  position: fixed !important;
  z-index: 999999 !important;
  background: #FFFFFF !important;
  border: 1px solid #CBD5E1 !important;
  border-radius: 8px !important;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.2), 0 8px 10px -6px rgba(15, 23, 42, 0.1) !important;
  padding: 6px !important;
  min-width: 210px !important;
  max-width: 280px !important;
  display: none;
  flex-direction: column !important;
  gap: 2px !important;
  box-sizing: border-box !important;
}

.context-menu-item {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 8px 12px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  color: #1E293B !important;
  border-radius: 5px !important;
  border: none !important;
  background: transparent !important;
  width: 100% !important;
  text-align: left !important;
  cursor: pointer !important;
  transition: background 0.1s ease, color 0.1s ease !important;
  user-select: none !important;
  box-sizing: border-box !important;
}

.context-menu-item:hover {
  background: #F1F5F9 !important;
  color: #0F172A !important;
}

.context-menu-item.text-danger {
  color: #DC2626 !important;
}

.context-menu-item.text-danger:hover {
  background: #FEF2F2 !important;
  color: #B91C1C !important;
}

.context-menu-divider {
  height: 1px !important;
  background: #E2E8F0 !important;
  margin: 4px 0 !important;
}

/* ══════════════════════════════════════════════════════════════════
   STANDARD DROPDOWN MENUS (BATCH BAR, CONFIGURATION NAVBAR, ETC.)
══════════════════════════════════════════════════════════════════ */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 1000;
  display: none;
  min-width: 190px;
  padding: 6px 0;
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-primary);
  text-align: left;
  list-style: none;
  background-color: #FFFFFF;
  background-clip: padding-box;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.dropdown-menu.show {
  display: block !important;
}

.dropdown-menu-right {
  right: 0;
  left: auto;
}

.dropdown-menu-left {
  left: 0;
  right: auto;
}

.dropdown-menu a,
.dropdown-menu .dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 14px;
  clear: both;
  font-weight: 500;
  color: #1E293B;
  text-align: inherit;
  text-decoration: none;
  white-space: nowrap;
  background-color: transparent;
  border: 0;
  cursor: pointer;
  transition: background-color 0.1s ease, color 0.1s ease;
}

.dropdown-menu a:hover,
.dropdown-menu .dropdown-item:hover {
  background-color: #F1F5F9;
  color: var(--accent-blue);
}

.dropdown-divider {
  height: 1px;
  margin: 4px 0;
  overflow: hidden;
  background-color: #E2E8F0;
}

/* ══════════════════════════════════════════════════════════════════
   FILE MANAGER RIGHT-CLICK CONTEXT MENU
══════════════════════════════════════════════════════════════════ */
.fm-context-menu {
  position: fixed;
  z-index: 9999;
  min-width: 220px;
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  padding: 6px;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.18), 0 8px 10px -6px rgba(15, 23, 42, 0.1);
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: fmCtxFadeIn 0.12s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

@keyframes fmCtxFadeIn {
  from { opacity: 0; transform: scale(0.96) translateY(-2px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.fm-ctx-header {
  font-size: 11px;
  font-weight: 700;
  color: #64748B;
  padding: 4px 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 230px;
}

.fm-ctx-divider {
  height: 1px;
  background: #E2E8F0;
  margin: 4px 0;
}

.fm-ctx-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  border-radius: 5px;
  border: none;
  background: transparent;
  color: #1E293B;
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.1s ease, color 0.1s ease;
}

.fm-ctx-item:hover {
  background-color: #EFF6FF;
  color: #1D4ED8;
}

.fm-ctx-icon {
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
}

.fm-ctx-item.fm-ctx-danger {
  color: #DC2626;
}

.fm-ctx-item.fm-ctx-danger:hover {
  background-color: #FEF2F2;
  color: #B91C1C;
}

.fm-row-selected {
  background-color: #EFF6FF !important;
}
